React native随笔——解决navigation导航栏 android和ios样式不统一

时间:2020-06-12 16:48:26   收藏:0   阅读:60

navigation导航栏存在android和ios样式不统一的问题。Android手机上标题不居中,导航栏与状态栏重合。

解决方法为在navigationOptions中进行如下配置。

一、Android中标题不居中

headerTitleStyle: {
  alignSelf: center,
  textAlign: center,
  flex: 1
},

 

二、Android中导航栏与状态栏重合

判断为Android手机,margin上面状态栏的高度。

headerStyle: {
  marginTop: $IS_ANDROID ? $STATUS_BAR_HEIGHT : 0,
  height: 44,
  elevation: 0,
  borderBottomWidth: 0
},

 

End---------------

 

原文:https://www.cnblogs.com/MaiJiangDou/p/13100334.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!