反应本机键盘

时间:2020-01-03 17:03:41

标签: react-native textinput

当texInput集中在react-native时,我的标题会在键盘打开时消失在屏幕上。我无法在android manifest.xml keyboardSoftINputMode中进行更改来调整AdjustSize。因为如果我让它调整AdjustResize,那么keyboardAwareScrollView将无法正常工作。

请给我建议一种方法,以便当我的TextInput聚焦时,标题不会离开屏幕。这是本机发生的。

2 个答案:

答案 0 :(得分:0)

突出显示TextInput时,您可以使用KeyboardAvoidingView自动调整可见区域的大小。

用法:只需使用<View>将顶级App或其他组件包装在render()的{​​{1}}函数中即可:

<KeyboardAvoidingView>

答案 1 :(得分:0)

render(){ const {styles} = this.state const style = this.props.testType ==='实践'? styles.containerStyleCPP:styles.container 返回( {this.renderQuestionBasedOnType()} {/ * * /} ) } }

const getStyle =()=> StyleSheet.create({ 容器: { 高度:heightPercentage(100) }, containerStyleCPP:{ 宽度:widthPercentage(100) } })

这是我的代码