Skip to content

Commit 0da4ee4

Browse files
committed
1 parent d9b968e commit 0da4ee4

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ A ScrollView component that handles keyboard appearance and automatically scroll
1414

1515
## Supported versions
1616

17+
- `v2.0.0` requires `RN>=0.65.1`
1718
- `v1.0.0` requires `RN>=0.63.0`
1819

1920
## Installation

lib/KeyboardAwareHOC.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,8 @@ const ScrollIntoViewDefaultOptions: KeyboardAwareHOCOptions = {
123123
// getNode() permit to support Animated.ScrollView automatically
124124
// see https://github.com/facebook/react-native/issues/19650
125125
// see https://stackoverflow.com/questions/42051368/scrollto-is-undefined-on-animated-scrollview/48786374
126-
if (ref.getNode) {
127-
return ref.getNode()
128-
} else {
129-
return ref
130-
}
126+
// see https://github.com/facebook/react-native/commit/66e72bb4e00aafbcb9f450ed5db261d98f99f82a
127+
return ref
131128
}
132129
}
133130

@@ -241,12 +238,12 @@ function KeyboardAwareHOC(
241238

242239
scrollToPosition = (x: number, y: number, animated: boolean = true) => {
243240
const responder = this.getScrollResponder()
244-
responder && responder.scrollResponderScrollTo({ x, y, animated })
241+
responder && responder.scrollTo({ x, y, animated })
245242
}
246243

247244
scrollToEnd = (animated?: boolean = true) => {
248245
const responder = this.getScrollResponder()
249-
responder && responder.scrollResponderScrollToEnd({ animated })
246+
responder && responder.scrollToEnd({ animated })
250247
}
251248

252249
scrollForExtraHeightOnAndroid = (extraHeight: number) => {
@@ -339,7 +336,7 @@ function KeyboardAwareHOC(
339336
keyboardSpace -= _KAM_DEFAULT_TAB_BAR_HEIGHT
340337
}
341338
this.setState({ keyboardSpace })
342-
const currentlyFocusedField = TextInput.State.currentlyFocusedInput ? findNodeHandle(TextInput.State.currentlyFocusedInput()) : TextInput.State.currentlyFocusedField()
339+
const currentlyFocusedField = findNodeHandle(TextInput.State.currentlyFocusedInput())
343340
const responder = this.getScrollResponder()
344341
if (!currentlyFocusedField || !responder) {
345342
return
@@ -462,7 +459,7 @@ function KeyboardAwareHOC(
462459
}
463460

464461
update = () => {
465-
const currentlyFocusedField = TextInput.State.currentlyFocusedInput ? findNodeHandle(TextInput.State.currentlyFocusedInput()) : TextInput.State.currentlyFocusedField()
462+
const currentlyFocusedField = findNodeHandle(TextInput.State.currentlyFocusedInput())
466463
const responder = this.getScrollResponder()
467464

468465
if (!currentlyFocusedField || !responder) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"react-native-iphone-x-helper": "^1.0.3"
4040
},
4141
"peerDependencies": {
42-
"react-native": ">=0.63.0"
42+
"react-native": ">=0.65.1"
4343
},
4444
"devDependencies": {
4545
"babel-eslint": "^10.0.2",

0 commit comments

Comments
 (0)