react-native-safe-area-context
react-native-safe-area-context copied to clipboard
SafeAreaView with jest breaks
I am getting this error message:
TypeError: _NativeSafeAreaContext.default.getConstants is not a function
at Object.<anonymous> (node_modules/react-native-safe-area-context/lib/commonjs/InitialWindow.native.ts:4:61)
at Object.<anonymous> (node_modules/react-native-safe-area-context/lib/commonjs/index.tsx:3:1)
Running version 4.2.2
I had to add a mock for the functions
jest.mock("react-native-safe-area-context", () => ({
getConstants: () => {/* constants to return here */}
// additional mocks
})
)