Skip to content

Commit da27a8c

Browse files
author
joseph kim
committed
v0.1.2 with ancestor_check
- Change method name "viewIsAncestorOf" as "viewIsDescendantOf" according to PR facebook/react-native#7876
1 parent ecbdfd7 commit da27a8c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/KeyboardAwareMixin.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow */
22

33
import { PropTypes } from 'react'
4-
import ReactNative, { TextInput, Keyboard } from 'react-native'
4+
import ReactNative, { TextInput, Keyboard, UIManager } from 'react-native'
55
import TimerMixin from 'react-timer-mixin'
66

77
const _KAM_DEFAULT_TAB_BAR_HEIGHT = 49
@@ -53,7 +53,15 @@ const KeyboardAwareMixin = {
5353
return
5454
}
5555
try {
56-
this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField)
56+
UIManager.viewIsDescendantOf(
57+
currentlyFocusedField,
58+
this.getScrollHandle().getScrollResponder().getInnerViewNode(),
59+
(isAncestor) => {
60+
if (isAncestor) {
61+
this.scrollToFocusedInputWithNodeHandle(currentlyFocusedField)
62+
}
63+
}
64+
)
5765
} catch (e) {
5866

5967
}

0 commit comments

Comments
 (0)