如何在Facebook登录按钮中为React Native(Android)设置文本中心?

如何在Facebook登录按钮中为React Native(Android)设置文本中心?,android,reactjs,react-native,fbsdk,Android,Reactjs,React Native,Fbsdk,我正在我的react native应用程序中使用Facebook SDK(通过react native fbsdk)登录按钮 “继续使用Facebook”按钮文本在iOS中垂直居中,但在Android(7.0)中偏离中心 我唯一的选择是创建自己的自定义按钮,手动调用LoginManager,还是有办法使用样式对齐文本(我尝试了alignItems和justifyContent)?似乎我必须根据自己的想法来做前者 这是我目前的代码: <LoginButton scope={'publi

我正在我的react native应用程序中使用Facebook SDK(通过react native fbsdk)登录按钮

“继续使用Facebook”按钮文本在iOS中垂直居中,但在Android(7.0)中偏离中心

我唯一的选择是创建自己的自定义按钮,手动调用LoginManager,还是有办法使用样式对齐文本(我尝试了alignItems和justifyContent)?似乎我必须根据自己的想法来做前者

这是我目前的代码:

<LoginButton
   scope={'public_profile email'}
   style={{
       width: 220,
       height: 40
   }}
   onLoginFinished={this._facebookLogin}
   onLogoutFinished={() => console.log('logout.')}
/>
console.log('logout')}
/>

您可以将按钮包装到容器中

<View style={{
  width: 220, // whatever you want
  height: 50, // whatever you want
  justifyContent: 'center', // center the button
  backgroundColor: '#4267B2', // the same as the actual button
  paddingHorizontal: 10 // optionally add some horizontal padding for better looking
}}>
  <LoginButton
    scope={'public_profile email'}
    style={{
       flex: 1, // fill the container
       maxHeight: 30 // the default height
   }}
   onLoginFinished={this._facebookLogin}
   onLogoutFinished={() => console.log('logout.')}
  />
</View>

console.log('logout.')}
/>
结果


你找到解决方案了吗?没有,放弃了:/好的,我现在就把我的答案贴出来,让你经历这场噩梦。谢谢你