KeyboardAvoidingView + ListView [英] KeyboardAvoidingView + ListView
本文介绍了KeyboardAvoidingView + ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个提交表单界面,使用 ListView
组件,并且该行包含 TextInput
组件,我想使用 KeyboardAvoidingView
来避免键盘 cover
行中的TextInput,但是它不起作用,行不向上移动.
I have a submission form interface,use ListView
Component, and the row contain TextInput
Component, I want to user KeyboardAvoidingView
to avoid The Keyboard cover
the TextInput in row , But it is not working,The row does not move up.
我的代码:
render() {
return (
<KeyboardAvoidingView style={styles.container} behavior='padding'>
<ListView
dataSource = {this.state.dataSource}
renderRow = {this._renderRow.bind(this)}
onEndReachedThreshold = {0}
overflow = 'hidden'
keyboardDismissMode = 'on-drag'
removeClippedSubviews = {true}
/>
</KeyboardAvoidingView>
);
}
推荐答案
There is one module which I have used for keyboard issue: https://github.com/APSL/react-native-keyboard-aware-scroll-view
您可以使用相同的方式:
You can use it same way:
import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
render() {
return (
<KeyboardAwareScrollView extraHeight={130}>
// your code here
</KeyboardAwareScrollView>
);
}
让我知道使用它是否遇到任何问题.
Let me know if face any issue to use it.
这篇关于KeyboardAvoidingView + ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文