react-native-keyboard-aware-scroll-view
react-native-keyboard-aware-scroll-view copied to clipboard
Newest version has a missing check, breaks jest tests
Version 0.9.4 released today breaks at line 135 https://prnt.sc/129rhwg.
Addition that caused the issue: https://prnt.sc/129rjt2.
Recommendation:
const shouldCallGetNode = !Platform.constants || !Platform.constants.reactNativeVersion || (Platform.constants.reactNativeVersion.major === 0 && Platform.constants.reactNativeVersion.minor < 62)
Have you managed to find a work around for this @KevRyan2 ?
I'm running into this same issue upgrading a project to React Native 0.64.0... I ended up mocking the reactNativeVersion object in our testing utility that utilizes react-test-renderer calls in our project. Definitely hoping there's a fix on the way soon.
import { Platform } from 'react-native';
...
Platform.constants.reactNativeVersion = { minor: '64', major: '0' };
...
Have you managed to find a work around for this @KevRyan2 ?
Yes just hardcode it to an older version in your package.json dependencies. It won't benefit from any upgrades or optimizations until you change that back, but it won't break at least.
This is my workaround:
jest.mock('react-native/Libraries/Utilities/Platform', () => {
const Platform = jest.requireActual('react-native/Libraries/Utilities/Platform');
Platform.constants.reactNativeVersion = { major: 0, minor: 64, patch: 0 };
return Platform;
});