I am trying to mock a module that ships with react-native (not 3rd party modules), such as LayoutAnimation
:
import * as RN from 'react-native'
RN.LayoutAnimation = jest.fn()
But the test fails with:
TypeError: Cannot read property 'decelerationRate' of undefined
at Object.<anonymous> (node_modules/react-native/Libraries/Components/WebView/WebView.ios.js:555:3254)
at Object.get WebView [as WebView] (node_modules/react-native/Libraries/react-native/react-native-implementation.js:73:22)
Is there any other way to mock/stub out a RN module such as LayoutAnimation
or any other react-native (not 3rd party) module?