diff --git a/lib/KeyboardAwareMixin.js b/lib/KeyboardAwareMixin.js index 8d740c9..50180eb 100644 --- a/lib/KeyboardAwareMixin.js +++ b/lib/KeyboardAwareMixin.js @@ -1,7 +1,7 @@ /* @flow */ import { PropTypes } from 'react' -import ReactNative, { TextInput, Keyboard } from 'react-native' +import ReactNative, { TextInput, Keyboard, UIManager } from 'react-native' import TimerMixin from 'react-timer-mixin' const _KAM_DEFAULT_TAB_BAR_HEIGHT = 49 @@ -53,7 +53,15 @@ const KeyboardAwareMixin = { return } try { - this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField) + UIManager.viewIsDescendantOf( + currentlyFocusedField, + this.getScrollHandle().getScrollResponder().getInnerViewNode(), + (isAncestor) => { + if (isAncestor) { + this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField) + } + } + ) } catch (e) { }