本机键盘

问题描述 投票:0回答:2

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

[建议我一种方法,这样当我的TextInput聚焦时,我的标题就不会离开屏幕。这是在本机中发生的。

react-native textinput
2个回答
0
投票

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

用法:只需用<View>将顶级App或其他组件包装在render()<KeyboardAvoidingView>函数中:

import {KeyboardAvoidingView} from 'react-native';

...
<KeyboardAvoidingView>
  ... your UI ...
</KeyboardAvoidingView>;

0
投票

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

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

这是我的代码

© www.soinside.com 2019 - 2024. All rights reserved.