Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jest-expo] create __REACT_DEVTOOLS_GLOBAL_HOOK__ stub (expo#27434)
# Why Fix the React Navigation errors in 0.74 The issue is caused by this commit facebook/react-native@a286f00 Here is the chain of code that causes the issue 1. React Native now checks for the existence of `__REACT_DEVTOOLS_GLOBAL_HOOK__` on startup if the `getInspectorDataForViewAtPoint` function is imported. 2. `getInspectorDataForViewAtPoint` is imported by `AppContainer` in its `DevtoolsOverlay` https://github.com/hoxyq/react-native/blob/fbbb4246707d85b692c006e0cb3b186a7c9068bc/packages/react-native/Libraries/ReactNative/AppContainer.js#L55 3. React Navigation `<DebugContainer />` creates a `<AppContainer />` in non-production environments https://github.com/react-navigation/react-navigation/blob/523fa4f3afb7c428a8370bfd83933c0163224e66/packages/native-stack/src/views/DebugContainer.native.tsx#L21-L35 4. `@react-navigation/native-stack` creates a `<DebugContainer />` TLDR: Any project running `@react-navigation/native-stack` (the default Stack for Expo Router) in a non-production test environment will fail in 0.74 @tsapeta This PR only fixes this issue. The router tests in 0.74 are still failing due to `react-navigate-gesture-handler` errors in fabric # How Add a stub for `__REACT_DEVTOOLS_GLOBAL_HOOK__` in the `jest-expo` environment setup # Test Plan <!-- Please describe how you tested this change and how a reviewer could reproduce your test, especially if this PR does not include automated tests! If possible, please also provide terminal output and/or screenshots demonstrating your test/reproduction. --> # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
- Loading branch information