Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 避免在底部的项目上使用键盘-React Native_React Native_Styles_React Native Android_React Native Ios - Fatal编程技术网

React native 避免在底部的项目上使用键盘-React Native

React native 避免在底部的项目上使用键盘-React Native,react-native,styles,react-native-android,react-native-ios,React Native,Styles,React Native Android,React Native Ios,我有一个React原生项目(带有Expo),在容器底部有两个按钮。当我打开键盘写东西时,这些东西会随着键盘一起出现。我怎样才能避免呢 这是集装箱代码-> render() { return ( <View style={{flex: 1}}> <Text style={styles.titulo}>Nueva Tarjeta</Text> <View style={{ flex: 1}}>

我有一个React原生项目(带有Expo),在容器底部有两个按钮。当我打开键盘写东西时,这些东西会随着键盘一起出现。我怎样才能避免呢

这是集装箱代码->

render() {
    return (
      <View style={{flex: 1}}>
        <Text style={styles.titulo}>Nueva Tarjeta</Text>
        <View style={{  flex: 1}}>
          <CreditCardInput
            requiresName={true}
            allowScroll={true}
            labels={{
              name: "Nombre del titular",
              number: "Número de tarjeta",
              expiry: "Venc",
              cvc: "CVC",
            }}
            cardScale={1}
            labelStyle={{ fontFamily: "OpenSansRegular" }}
            placeholders={{
              name: "Juan Perez",
              number: "1234 1234 1234 1234",
              expiry: "MM/AA",
              cvc: "123",
            }}
            onChange={this._onChange}
          />
        </View>
        <View style={{ flexDirection: "row", alignSelf: "center", 
    justifyContent: 'flex-end', marginBottom: 10}}>
          <TouchableOpacity style={styles.botonVolver}>
            <Text style={styles.textoVolver}>Volver</Text>
          </TouchableOpacity>
          <TouchableOpacity style={styles.botonAceptar}>
            <Text style={styles.textoAceptar}>Aceptar</Text>
          </TouchableOpacity>
        </View>
      </View>
    );
  }
render(){
返回(
新塔热塔
玩美女人
接受器
);
}
提前谢谢

您可以尝试在Android上使用其
行为
道具设置为
“高度”

const screenHeight = Dimensions.get("window").height;

export default function App() {
  return (
    <KeyboardAvoidingView behavior="height" style={{ flex: 1 }}>
      <View style={{ height: screenHeight - 75 }}>
        <Text style={styles.titulo}>Nueva Tarjeta</Text>
        <CreditCardInput
          requiresName={true}
          allowScroll={true}
          labels={{
            name: "Nombre del titular",
            number: "Número de tarjeta",
            expiry: "Venc",
            cvc: "CVC",
          }}
          cardScale={1}
          labelStyle={{ fontFamily: "OpenSansRegular" }}
          placeholders={{
            name: "Juan Perez",
            number: "1234 1234 1234 1234",
            expiry: "MM/AA",
            cvc: "123",
          }}
        />
      </View>
      <View
        style={{
          flexDirection: "row",
          alignSelf: "center",
          justifyContent: "flex-end",
          marginBottom: 10,
        }}
      >
        <TouchableOpacity style={styles.botonVolver}>
          <Text style={styles.textoVolver}>Volver</Text>
        </TouchableOpacity>
        <TouchableOpacity style={styles.botonAceptar}>
          <Text style={styles.textoAceptar}>Aceptar</Text>
        </TouchableOpacity>
      </View>
    </KeyboardAvoidingView>
  );
}
const screenHeight=Dimensions.get(“窗口”).height;
导出默认函数App(){
返回(
新塔热塔
玩美女人
接受器
);
}
我还使用
维度
将包含
信用卡输入
视图的高度更改为基于屏幕高度,因为在该
视图
上设置
flex
时,转换会出现故障


确保从
'react-native'
导入
维度和
键盘avoidingview