appandflow / appandflow/react-native-safe-area-context

jest mock and RN 0.76.1: TypeError: NativeModule.getConstants is not a function

Offen
#550 8 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
help wanted
Vorherrschende Sprache
TypeScript
Sterne
2.8k
Forks
258
Ø Merge
3 T. 1 Std.
Gemergte PRs (30 T.)
2

Beschreibung

After upgrading to RN 0.76.1, the jest mock seems to fail to import:

```

TypeError: NativeModule.getConstants is not a function

> 9 | import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock';
| ^

at Object.getConstants (node_modules/react-native/src/private/specs/modules/NativeDeviceInfo.js:52:32)
at Object.getConstants (node_modules/react-native/Libraries/Utilities/Dimensions.js:121:33)
at Object.require (node_modules/react-native/Libraries/Utilities/PixelRatio.js:13:20)
at Object.require (node_modules/react-native/Libraries/StyleSheet/StyleSheet.js:29:20)
at Object.require [as StyleSheet] (node_modules/react-native/index.js:306:12)
at Object.StyleSheet (node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaContext.js:77:29)
at Object.require (node_modules/react-native-safe-area-context/lib/commonjs/index.js:7:24)
at Object.requireActual (node_modules/react-native-safe-area-context/jest/mock.tsx:25:32)
at Object.require (jest.setup.js:9:1)
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.