地味に辛いこの問題。vertical-align: middle
問題。 iOSが英語環境(設定 -> 一般 -> 言語と地域が英語)の場合は問題なくセンターとれるのですが、日本語環境にするとflex-start
みたいにpaddingTopがゼロになってしまう問題があります。やっかいなのは、paddingで調整するとAndroidはこの問題がないため表示がずれます。。
Text(iOS) with Japanese can't be vertically center'ed on #reactnative I need to add padding on top which is not good for android. :S pic.twitter.com/IjRHwK6NjA
— Shohei Kameda (@shohey1226) May 29, 2017
コードはボタンだったら、下記みたいな感じ。ボタンに限らず、この問題はおきていると思います。
<FAIcon.Button onPress={this.onPressFBLogin} name="facebook" iconStyle= backgroundColor="#3b5998" borderRadius={0}> <Text style=>Facebookでログイン・登録</Text> </FAIcon.Button>
解決方法は、fontサイズと同じViewでラップする。(試行錯誤後、閃きました)
<FAIcon.Button onPress={this.onPressFBLogin} name="facebook" iconStyle= backgroundColor="#3b5998" borderRadius={0}> <View style=><Text style=>Facebookでログイン・登録</Text></View> </FAIcon.Button>