[英]Login screen push up while typing on android and iphone
import { TextField } from 'react-native-material-textfield';
<KeyboardAvoidingView
behavior={'position'}
style={styles.container}
>
<View style={{flex: 1}}>
<TextField label='username' value={username}/>
<TextField label='password' value={password}/>
<TouchableOpacity>
<Text> Login </Text>
</TouchableOpacity>
<TouchableOpacity>
<Text> Register </Text>
</TouchableOpacity>
</View>
</KeyboardAvoidingView>
我想在使用软件键盘在android和iphone上键入时向上推登录屏幕屏幕。
我已经尝试过使用KeyboardAvoidingView组件,但对我不起作用。
当我使用behavior = {'position'}键盘时,它不在屏幕上。
如果有人知道,请给我建议任何解决方案。
从KeyboardAwareScrollView删除此代码
resetScrollToCoords={{ x: 0, y: 0 }}
scrollEnabled={false}
我在KeyboardAvoidingView组件中使用了keyboardVerticalOffset = {-30} ,现在可以正常工作了。
import { TextField } from 'react-native-material-textfield';
<KeyboardAvoidingView
keyboardVerticalOffset={-30}
behavior={'position'}
style={styles.container}
>
<View style={{flex: 1}}>
<TextField label='username' value={username}/>
<TextField label='password' value={password}/>
<TouchableOpacity>
<Text> Login </Text>
</TouchableOpacity>
<TouchableOpacity>
<Text> Register </Text>
</TouchableOpacity>
</View>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.