APSL / react-native-keyboard-aware-scroll-view

A ScrollView component that handles keyboard appearance and automatically scrolls to focused TextInput.
MIT License
5.27k stars 646 forks source link

Fix crash on `shouldCallGetNode` in tests #511

Open GertjanReynaert opened 3 years ago

GertjanReynaert commented 3 years ago

In our test suite (jest + react-native-testing-library) Platform.constants is an empty object. This was making the previous !Platform.constants check pass, but caused a crash when trying to access major on reactNativeVersion.

This fix correctly checks if reactNativeVersion is present and is an object to avoid this issue.

rodperottoni commented 2 years ago

This is a legitimate issue breaking all test suites on the latest versions of React Native. Could any contributor in this project please approve this PR ?

rvera commented 2 years ago

Can second this is a huge issue for me too and this fixes it for me.