I am using listView with TextInputs, on ios when TextInput focused it's behind keyboard. How to fix it?
Sample code: http://rnplay.org/apps/8baZSA
I am using listView with TextInputs, on ios when TextInput focused it's behind keyboard. How to fix it?
Sample code: http://rnplay.org/apps/8baZSA
You need to use <ScrollView>
instead of <View>
in order to use this method.
The key method is scrollResponderScrollNativeHandleToKeyboard(refToElement, scrollHeight, preventNegativeOffset)
(sounds cool, right ;))
I have:
<TextInput ref='ccName' onFocus={(() => this.onFieldFocus('ccName'))} />
where function looks like:
onFieldFocus(fieldName) {
this.setTimeout(() => {
let scrollResponder = this.refs.scrollView.getScrollResponder()
scrollResponder.scrollResponderScrollNativeHandleToKeyboard(
React.findNodeHandle(this.refs[fieldName]), 200, true
)
}, 125)
}
Seems this thread is what you're looking for.