问题:
我在 ios 中使用KeyboardAvoidingViewbehavior="padding"
但它不起作用。我的屏幕有四个文本输入字段,它们在打开时被键盘隐藏。
代码:
屏幕:
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应在键盘打开后立即将所有文本输入字段向上移动。