【问题标题】:My react-native TextInput disappear when I start typing当我开始输入时,我的 react-native TextInput 消失了
【发布时间】:2021-05-11 15:05:04
【问题描述】:

我有一个名为 EditScreen 的屏幕。它具有采用设备高度的文本输入。 问题是当我开始打字时,文本会出现在上方并消失。 请有任何解决方案。

这是我的文本输入组件

 <View style={styles.InputContainer}>
      <ScrollView>
        <TextInput
          style={styles.inputText}
          placeholder={"Take Notes ..."}
          onChangeText={HandlingTextValut}
          value={notes}
          multiline={true}
        />
      </ScrollView>
    </View>

// and here is its styles
InputContainer: {
    flex:1,
  },
  inputText: {
    paddingBottom: Dimensions.get("window").height- 100,
    paddingLeft: 10,
    paddingRight: 10,
    fontSize: 20,
  },

【问题讨论】:

    标签: reactjs react-native react-native-android react-native-navigation react-native-native-ui-component


    【解决方案1】:

    请你试试这些道具numberOfLines 和onContentSizeChange 。

    参考链接:https://reactnative.dev/docs/textinput#numberoflines

    【讨论】:

      【解决方案2】:

      从输入样式中删除paddingBottom: Dimensions.get("window").height- 100,

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-01-06
        • 2021-08-11
        • 2020-09-17
        • 1970-01-01
        • 2021-02-02
        • 1970-01-01
        • 2022-09-29
        • 2020-01-21
        相关资源
        最近更新 更多