Reputation: 556
Im new to react-native and may be the question Im asking can be very noob. But Im not able to find any reference for it somehow.
There are 6 text inputs in the picture, but we can merely see 4 when keyboard appears, so how can we get 5th text input into visible area when keyboard is still there ?
Upvotes: 0
Views: 1547
Reputation: 687
I assume you want to scroll the input when clicked so it is visible when the keyboard is opened. There is a nice library to handle this easily.
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>
);
},
});
Upvotes: 1