Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/KeyboardAwareListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const KeyboardAwareListView = React.createClass({
this.setResetScrollToCoords(this.props.resetScrollToCoords)
},

getScrollHandle: function () {
return this.refs._rnkasv_keyboardView
},

render: function () {
return (
<ListView
Expand Down
14 changes: 11 additions & 3 deletions lib/KeyboardAwareMixin.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,7 +24,7 @@ const KeyboardAwareMixin = {

setViewIsInsideTabBar: function (viewIsInsideTabBar: bool) {
this.viewIsInsideTabBar = viewIsInsideTabBar
this.setState({keyboardSpace: _KAM_DEFAULT_TAB_BAR_HEIGHT})
this.setState({keyboardSpace: this.viewIsInsideTabBar ? _KAM_DEFAULT_TAB_BAR_HEIGHT : 0 })
},

setResetScrollToCoords: function (coords: {x: number, y: number}) {
Expand Down Expand Up @@ -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) {

}
Expand Down
4 changes: 4 additions & 0 deletions lib/KeyboardAwareScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const KeyboardAwareScrollView = React.createClass({
this.setResetScrollToCoords(this.props.resetScrollToCoords)
},

getScrollHandle: function () {
return this.refs._rnkasv_keyboardView
},

render: function () {
return (
<ScrollView
Expand Down