+-
android – 如何在react-native中将TextInput附加到键盘
我正在使用react-native构建一个应用程序,该应用程序针对iOS和 Android.
其中一件事就是有一个连接到键盘的文本输入.
它的工作方式是TextInput位于屏幕的底部.触摸时 – 键盘打开,文本输入在键盘上以相同的速度向上或向下动画(因为它们连在一起).
现在,我使用onKeyboardWillShow和onKeyboardWillHide并动画TextInput.问题是它不会以相同的速度移动.
基本上,我正在尝试这样做:

https://github.com/Just-/UIViewController-KeyboardAnimation

任何建议都会有所帮助.

最佳答案
使用本机的键盘避免查看
KeyboardAvoidingView和 Example
喜欢

import {ScrollView, Text, TextInput, View, KeyboardAvoidingView} from "react-native";

并在渲染函数中嵌套View和TextInput

<KeyboardAvoidingView behavior='padding'>
  <View style={styles.textInputContainer}>
    <TextInput
      value={this.state.data}
      style={styles.textInput}
      onChangeText={this.handleChangeData}
    />
  </View>
</KeyboardAvoidingView>

它将照顾到这一点

点击查看更多相关文章

转载注明原文:android – 如何在react-native中将TextInput附加到键盘 - 乐贴网