答案 0 :(得分:1)
我假设您想在单击时滚动输入,以便在打开键盘时可见。有一个很好的库可以轻松处理这个问题。
https://github.com/APSL/react-native-keyboard-aware-scroll-view
const Screen = React.createClass({
_scrollToInput(event) {
this.refs.scrollview.scrollToFocusedInput(event, event.nativeEvent.target);
},
render() {
return (
<KeyboardAwareScrollView ref="scrollview">
<View>
<TextInput onFocus={this._scrollToInput}/>
</View>
</KeyboardAwareScrollView>
);
},
});