Skip to content

Fix crash on shouldCallGetNode in tests #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion lib/KeyboardAwareHOC.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ const ScrollIntoViewDefaultOptions: KeyboardAwareHOCOptions = {
// see https://github.com/facebook/react-native/issues/19650
// see https://stackoverflow.com/questions/42051368/scrollto-is-undefined-on-animated-scrollview/48786374
// see https://github.com/facebook/react-native/commit/66e72bb4e00aafbcb9f450ed5db261d98f99f82a
const shouldCallGetNode = !Platform.constants || (Platform.constants.reactNativeVersion.major === 0 && Platform.constants.reactNativeVersion.minor < 62)
const shouldCallGetNode =
typeof Platform?.constants?.reactNativeVersion === 'object' &&
Platform.constants.reactNativeVersion.major === 0 &&
Platform.constants.reactNativeVersion.minor < 62;

if (ref.getNode && shouldCallGetNode) {
return ref.getNode()
} else {
Expand Down