- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我遇到了 KeyboardAvoidingView 的问题,我有 3 个 TextInput,当我想在最后一个 TextInput 上写东西时,这个 TextInput 就被我的键盘偷走了。
export default class App extends React.Component {
render() {
return (
<LinearGradient colors={['#72afd3', '#37ecba']} style={styles.container}>
<KeyboardAvoidingView behavior='padding' enabled>
<TextInput placeholder='Hello World'/>
<View style={{height: 200}}/>
<TextInput placeholder='Hello World'/>
<View style={{height: 200}}/>
<TextInput placeholder='Hello World'/>
</KeyboardAvoidingView>
</LinearGradient>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
})
最佳答案
使用keyboardVerticalOffset
,这样textInput
就不会隐藏在键盘后面
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={(Platform.OS === 'ios') ? "padding" : null} enabled
keyboardVerticalOffset={Platform.select({ios: 80, android: 500})}>
And to anyone who is having trouble with a
position:'absolute' View
keep being pushed by the keyboard, put theView
insideKeyboardAvoidingView
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={(Platform.OS === 'ios') ? "padding" : null} enabled>
//content here
<Button title="Login" style={{position:'absolute', bottom:20}}/>
</KeyboardAvoidingView>
关于javascript - KeyboardAvoidingView "Padding"无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54239812/
enter image description here 当前行为KeyBoardAvoidingView 隐藏了登录按钮。在 Android 和 iPhone 上都一样。在 Android 平板电脑
我正在使用 React Natives KeyboardAvoidingView 设置显示键盘时我的 View 的高度。但是,当我在应用程序中关闭键盘时,View 的高度并没有变回原来的值。
上面的黄色区域是 Textarea 和一个按钮面板,预计会始终粘在屏幕底部。然而,当用户尝试输入时,键盘将阻止 View ,如下所示 我已经实现了 KeyboardAvoidingView 但它未能使
我搜索了很多关于这个问题,我现在不知道该怎么做,所以我决定在这里问,任何帮助将不胜感激。在我的注册屏幕中,我有一些 input该用户必须填写,最后一个我需要避免键盘覆盖。所以我用了 KeyboardA
我正在使用 react native 开发一个应用程序,我们有我们的设计师制作的屏幕布局。但我无法正确实现预期的行为。基本上它是一个带有一些文本输入和一个按钮的屏幕,当键盘出现时我需要一些东西来正确调
KeyboardAvoidingView 无法正常工作 我正在尝试将 KeyboardAvoidingView 与 behavior="padding" 一起使用。 出于某种原因,当我尝试在 Text
在我的 React-Native Expo 应用程序中,我似乎无法使用键盘来推送内容。我正在通过从我的开发机器发布它来从 expo App 测试它。 尽我所能,当键盘进入焦点时,似乎没有任何东西可以插
在我的 React-Native Expo 应用程序中,我似乎无法使用键盘来推送内容。我正在通过从我的开发机器发布它来从 expo App 测试它。 尽我所能,当键盘进入焦点时,似乎没有任何东西可以插
我遇到了 KeyboardAvoidingView 的问题,我有 3 个 TextInput,当我想在最后一个 TextInput 上写东西时,这个 TextInput 就被我的键盘偷走了。 expo
我有一个 TextInput按下时会被键盘覆盖。所以我把它包裹在 KeyboardAvoidingView .但不管我为此 View 设置的行为如何,TextInput不会在键盘上方移动。使用 pos
我在 tabnavigator 中有组件。在我的组件中,我有多行文本,所以当我在 InputText 键盘上输入多行时,我想使用 KeyboardAvoidingView 在键盘显示时推送屏幕。 这是
当使用具有behavior =“position”属性的KeyboardAvoidingView时,如果该KeyboardAvoidingView组件包含一个包含多个项目的View,则所有内部组件都会
我正在尝试将 KeyboardAvoidingView 与 behavior="padding"一起使用。 当我尝试在 TextInput 中输入任何文本时,TextInput 字段没有向上移动。我在
我使用 keyboardAvoidingView 来显示输入并使用下一个焦点。但是,当我点击第一个输入(打印标签 1623 - Acidez)时,这是隐藏的。如何显示这个?
I am using keyboardavoidingview in the following scroll to move up keyboard so that the submit butto
我有一个 FlatList 组件,每行内都有一个 Input。当我选择输入时,我希望它在键盘上方向上滚动。 我的代码: return ( } ListFooterCompo
我正在使用 React Native 的 Keyboard Avoiding View行为设置为填充(在 Android 上测试)。 我的屏幕上有多个 TextInput。当我单击最后一个 TextI
我正在尝试创建一个 KeyboardAvoidingView注册表单的区域。我已经将组件放到了一个在 iOS 和 Android 上可以进行实际键盘调整的地方。 但是,KeyboardAvoiding
我无法让 KeyboardAvoidingView 正常工作。对于类似的屏幕,它工作得很顺利,但是,对于另一个屏幕,它会将内容在屏幕上推得太远,在两者之间添加过多的空间。有修复吗? 代码:
我想知道如何在 React Native 中使用键盘。 当我点击输入内容(“发送”)时,没有键盘显示。 我尝试使用“KeyboardAvoidingView”,但键盘不显示。 ChatScreen.j
我是一名优秀的程序员,十分优秀!