React-Native 使用中的坑

android

  1、键盘会在 ScrollView 之上----不知道是不是未给ScrollView 设置高度的问题

  2、navigation的标题在android居中显示办法

navigationOptions: {
        headerBackTitle: null,
        headerTintColor: '#080808',
        headerTitleStyle:{flex: 1, textAlign: 'center'},
        headerStyle: {backgroundColor: 'white', borderBottomColor: 'transparent'}
    }

  3、

ios:

  1、TextInput 父级元素设置onPress 事件,在输入框内点击无效,但是android在输入框editable = false时有效别用

android和ios 兼容问题

  1、ios   键盘遮挡输入框解决办法  KeyboardAvoidingView (react-native组件提供)

  2、ios   iphone X 等StatusBar 问题用 SafeAreaView解决

  3、ios   使用 borderRadius 时需要使用 overflow:hidden

  4、ios  使用line-height 时会撑开高度,但是ios并不居中,应减少使用。

  5、android line-height 只能设置int类型,否则会报错

使用中的小知识点----不说你可能都发现不了

  1、Keyboard 可以控制键盘相关事件 

  2、Dimensions 获取dim 宽高。

  

  

猜你喜欢

转载自www.cnblogs.com/web-Rain/p/11721643.html