Javascript react native:什么是正确的方式,使键盘不在文本输入上?

Javascript react native:什么是正确的方式,使键盘不在文本输入上?,javascript,reactjs,react-native,flexbox,keyboard,Javascript,Reactjs,React Native,Flexbox,Keyboard,我想知道什么是正确的方法,使键盘不在文本输入上,而是应该在它下面? 我创建了一个文本框,但每次我尝试写东西时,键盘都会覆盖我的文本框,我看不到我在那里写什么。 我很乐意帮助解决这个问题 function E_BitsuaDigdum() { const [selectedValue3, setSelectedValue3] = useState('1'); const [value2, onChangeText] = React.useState(''); return (

我想知道什么是正确的方法,使键盘不在文本输入上,而是应该在它下面? 我创建了一个文本框,但每次我尝试写东西时,键盘都会覆盖我的文本框,我看不到我在那里写什么。 我很乐意帮助解决这个问题

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}>סיבת אי ביצוע:</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="מתקן סגור" value="1" />
            <Picker.Item label="אין קליטה" value="2" />
            <Picker.Item label="תקלה במכשיר" 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}>הערות אי ביצוע</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="כתוב כאן.."
          onChangeText={(text) => onChangeText(text)}
          value={value2}
        />
      </KeyboardAvoidingView>
      <View style={styles.AreasPrototypesBottomView}>
        <View style={styles.BottleView}>
          <TouchableOpacity
            onPress={() => {
              navigation.navigate('אופן הדיגום', { item });
            }}
          >
            <Image
              source={require('../assets/bottle.png')}
              style={{ height: 40, width: 40 }}
            />
          </TouchableOpacity>
        </View>

        <View style={styles.NoteView}>
          <TouchableOpacity
            onPress={() => {
              navigation.navigate('פרטים כלליים');
            }}
          >
            <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}
/>
{
导航。导航(‘项目’);
}}
>
{
导航。导航(‘פריכלים’);
}}
>
{
导航。导航(“”);
}}
>
);
}

您可以使用
键盘ingavoidingview
向上滚动
键盘

这里有一个例子

import React from 'react';
import { View, KeyboardAvoidingView, TextInput, StyleSheet, Text, Platform, TouchableWithoutFeedback, Button, Keyboard  } from 'react-native';

const KeyboardAvoidingComponent = () => {
  return (
    <KeyboardAvoidingView
      behavior={Platform.OS == "ios" ? "padding" : "height"}
      style={styles.container}
    >
      <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
        <View style={styles.inner}>
          <Text style={styles.header}>Header</Text>
          <TextInput placeholder="Username" style={styles.textInput} />
          <View style={styles.btnContainer}>
            <Button title="Submit" onPress={() => null} />
          </View>
        </View>
      </TouchableWithoutFeedback>
    </KeyboardAvoidingView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1
  },
  inner: {
    padding: 24,
    flex: 1,
    justifyContent: "space-around"
  },
  header: {
    fontSize: 36,
    marginBottom: 48
  },
  textInput: {
    height: 40,
    borderColor: "#000000",
    borderBottomWidth: 1,
    marginBottom: 36
  },
  btnContainer: {
    backgroundColor: "white",
    marginTop: 12
  }
});

export default KeyboardAvoidingComponent;
从“React”导入React;
从“react native”导入{视图、键盘AVOIDGVIEW、文本输入、样式表、文本、平台、无反馈触摸屏、按钮、键盘};
常量键盘避免组件=()=>{
返回(
标题
null}/>
);
};
const styles=StyleSheet.create({
容器:{
弹性:1
},
内部:{
填充:24,
弹性:1,
为内容辩护:“周围的空间”
},
标题:{
尺寸:36,
marginBottom:48
},
文本输入:{
身高:40,
边框颜色:#000000“,
边界宽度:1,
marginBottom:36
},
BTN容器:{
背景颜色:“白色”,
玛金托普:12
}
});
导出默认键盘避免组件;

你没有看我的例子..我的代码有什么错,因为我做的每件事都是对的,你也没有读我的答案。你检查过我的例子中的行为了吗?但是你只是从链接中复制它。我知道这个例子。这对我解决问题没有帮助