简体   繁体   English

React Native android TextInput 在切换到表情符号时在键盘下消失

[英]React Native android TextInput disappears under keyboard when changing to emoticons

We wrapped our TextInput inside the KeyboardAvoidingView and all works fine until one changes the keyboard to choose an emoticon.我们将TextInput包装在KeyboardAvoidingView中,并且一切正常,直到有人更改键盘以选择表情符号。 The size of the keyboard changes then and covers the TextInput .然后键盘的大小发生变化并覆盖TextInput

It is possible then to write an emoticon but the user can't see anymore what is going on with his/her text.然后可以写一个表情符号,但用户再也看不到他/她的文本发生了什么。

Here's our code:这是我们的代码:

const headerHeight = useHeaderHeight();

... ...

<KeyboardAvoidingView
      behavior={Platform.OS == "ios" ? "padding" : "height"}
      keyboardVerticalOffset={headerHeight}
      style={styles.screen}
    >
      <ScrollView keyboardShouldPersistTaps="handled">
        <View style={styles.radContainer}>
          <TextInput
              style={styles.addCommentInput}
              value={comment}
              onChangeText={changeCommentHandler}
              onSubmitEditing={() => {
                sendCommentHandler();
              }}
           />
        </View>
      </ScrollView>
</KeyboardAvoidingView>

... ...

const styles = StyleSheet.create({
  screen: {
    alignContent: "space-between",
    backgroundColor: styleConstants.colors.silver03,
    flex: 1,
    marginBottom: 10,
  },
  radContainer: {
    padding: 10,
  },
  addCommentInput: {
    backgroundColor: "#fff",
    borderColor: styleConstants.colors.silver01,
    borderRadius: 8,
    borderWidth: 1,
    fontFamily: "work-sans_regular",
    fontSize: 14,
    height: 40,
    paddingBottom: 8,
    paddingLeft: 10,
    paddingRight: 10,
    paddingTop: 8,
    textAlignVertical: "center",
  },
});

诺基亚安卓测试

We're using react native with expo SDK44.我们正在使用带有 expo SDK44 的本机反应。 The GIF you see is from a test flight binary on a Nokia Android version 10.您看到的 GIF 来自诺基亚 Android 版本 10 上的测试飞行二进制文件。

this problem is related with React Native, here's the PR in Github , it is merged but not active in current version of React Native 0.70.6, you can add the fixed code manually and maintain validity until it is added to RN, using patch-package这个问题与React Native有关,这里是Github中的PR,它在当前版本的React Native 0.70.6中已合并但未激活,您可以手动添加固定代码并保持有效性,直到它被添加到RN,使用补丁-包裹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Android 上更改高度时,react-native TextInput 显示错误 - react-native TextInput displays wrong when changing height on Android React Native Keyboard 涵盖 Android 上的 TextInput KeyboardAvoidingView - React Native Keyboard covers TextInput KeyboardAvoidingView on Android React Native android TextInput 无法显示键盘 - React Native android TextInput fail to show keyboard 当Android Textinput autoFocus为true时,不会弹出本机键盘 - react native keyboard does not pop up when the Android Textinput autoFocus is true 如何在不按 TextInput 的情况下在 React Native 中打开 Android 和 IOS 键盘 - How to open Android and IOS keyboard in React Native without pressing the TextInput React Native Android App中TextInput下的意外行 - Unexpected Lines under TextInput in React Native Android App 在React Native的绝对视图中插入TextInput时处理键盘 - Handling the keyboard when TextInput is inserted in absolute view in react native 当本机上的TextInput上的键盘显示时如何处理 - How to handle when keyboard display on TextInput in react native 如何在react-native中将TextInput附加到键盘 - How to attach TextInput to the keyboard in react-native React Native TextInput 自动模糊并隐藏键盘 - React Native TextInput auto Blur and hides keyboard
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM