我在behavior="padding"
的ios中使用 KeyboardAvoidingView ,但无法正常工作。
我的屏幕有四个文本输入字段,它们在打开时通过键盘被隐藏。
屏幕:
const Screen = () => {
return (
<SafeAreaView>
<KeyboardAvoidingView behavior="padding">
<TextInput style={styles.input} />
<TextInput style={styles.input} />
<TextInput style={styles.input} />
<TextInput style={styles.input} />
</KeyboardAvoidingView>
</SafeAreaView>
);
};
文本输入样式:
input: {
height: 100,
borderWidth: 1,
marginBottom: 60,
borderColor: 'black',
marginHorizontal: 30,
},
KeyboardAvoidView 应该在键盘打开后立即将所有文本输入字段上移。