Javascript react native:如何解决键盘位于文本框上方且无法看到所写内容的问题?
react native:如何解决键盘位于文本框上方且无法看到所写内容的问题? 在我的例子中,Javascript react native:如何解决键盘位于文本框上方且无法看到所写内容的问题?,javascript,reactjs,react-native,expo,Javascript,Reactjs,React Native,Expo,react native:如何解决键盘位于文本框上方且无法看到所写内容的问题? 在我的例子中,TextInput隐藏在键盘后面,我不知道如何防止它。 我还尝试以下示例: 这对我来说也不管用。 有什么问题吗 function E_BitsuaDigdum() { const [selectedValue3, setSelectedValue3] = useState('1'); const [value2, onChangeText] = React.useState(''); re
TextInput
隐藏在键盘后面,我不知道如何防止它。
我还尝试以下示例:
这对我来说也不管用。
有什么问题吗
function E_BitsuaDigdum() {
const [selectedValue3, setSelectedValue3] = useState('1');
const [value2, onChangeText] = React.useState('');
return (
<View
style={{
flex: 1,
backgroundColor: '#cbced4',
}}
>
<View
style={{
flexDirection: 'column',
paddingTop: 20,
}}
>
<Text style={styles.label}>ebitua</Text>
<View
style={{
width: 200,
borderWidth: 2,
borderRadius: 5,
backgroundColor: 'white',
left: 15,
}}
>
<Picker
mode="dropdown"
selectedValue={selectedValue3}
style={{
placeholderTextColor: 'black',
height: 50,
width: 200,
right: -10,
transform: [{ scaleY: 1.2 }, { scaleX: 1.2 }],
}}
onValueChange={(itemValue, itemIndex) =>
setSelectedValue3(itemValue)
}
>
<Picker.Item label="close" value="1" />
<Picker.Item label="no sig" value="2" />
<Picker.Item label="error" value="3" />
</Picker>
</View>
</View>
<View
style={{
top: 20,
alignSelf: 'center',
backgroundColor: '#275d9f',
height: 50,
width: 400,
borderRadius: 5,
borderColor: 'black',
borderWidth: 2,
}}
>
<Text style={styles.Notice}>notifi</Text>
</View>
<KeyboardAvoidingView
behaviour="position"
style={styles.container}
enabled
>
<TextInput
style={{
top: 20,
alignSelf: 'center',
height: 200,
width: 400,
backgroundColor: 'white',
borderWidth: 2,
borderRadius: 5,
fontSize: 18,
}}
placeholder="put here"
onChangeText={(text) => onChangeText(text)}
value={value2}
/>
</KeyboardAvoidingView>
<View style={styles.AreasPrototypesBottomView}>
<View style={styles.BottleView}>
<TouchableOpacity
onPress={() => {
navigation.navigate('ways', { item });
}}
>
<Image
source={require('../assets/bottle.png')}
style={{ height: 40, width: 40 }}
/>
</TouchableOpacity>
</View>
<View style={styles.NoteView}>
<TouchableOpacity
onPress={() => {
navigation.navigate('all');
}}
>
<Image
source={require('../assets/note2.png')}
style={{ height: 35, width: 35 }}
/>
</TouchableOpacity>
</View>
<View style={styles.SendView}>
<TouchableOpacity
onPress={() => {
navigation.navigate('');
}}
>
<Image
source={require('../assets/send.png')}
style={{ height: 45, width: 45 }}
/>
</TouchableOpacity>
</View>
</View>
</View>
);
}
函数E_BitsuaDigdum(){
常量[selectedValue3,setSelectedValue3]=useState('1');
const[value2,onChangeText]=React.useState(“”);
返回(
艾比图
设置选定值3(项目值)
}
>
通知
onChangeText(文本)}
值={value2}
/>
{
navigation.navigate('ways',{item});
}}
>
{
导航。导航(“全部”);
}}
>
{
导航。导航(“”);
}}
>
);
}
使用react native而不是父主视图
在您的代码中如下所示:
return (
<KeyBoardAvoidingView
style={{
flex: 1,
backgroundColor: '#cbced4',
}}
>
返回(
如果你想聊天什么的,我会给你看