diff --git a/lib/KeyboardAwareMixin.js b/lib/KeyboardAwareMixin.js index 8d740c9..15a132d 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 @@ -52,11 +52,15 @@ const KeyboardAwareMixin = { if (!currentlyFocusedField) { return } - try { - this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField) - } catch (e) { - - } + UIManager.viewIsDescendantOf( + currentlyFocusedField, + this.getScrollResponder().getInnerViewNode(), + (isAncestor) => { + if (isAncestor) { + this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField) + } + } + ) } },