diff --git a/example/src/index.tsx b/example/src/index.tsx index 0a5e691a..66f7ee39 100644 --- a/example/src/index.tsx +++ b/example/src/index.tsx @@ -60,6 +60,9 @@ YellowBox.ignoreWarnings(['Require cycle:', 'Warning: Async Storage']); enableScreens(); +// @ts-ignore +global.REACT_NAVIGATION_REDUX_DEVTOOLS_EXTENSION_INTEGRATION_ENABLED = true; + type RootDrawerParamList = { Root: undefined; Another: undefined; diff --git a/packages/core/src/BaseNavigationContainer.tsx b/packages/core/src/BaseNavigationContainer.tsx index 3f8b8c16..3edd61fd 100644 --- a/packages/core/src/BaseNavigationContainer.tsx +++ b/packages/core/src/BaseNavigationContainer.tsx @@ -21,6 +21,9 @@ import { NavigationContainerRef, NavigationContainerProps } from './types'; type State = NavigationState | PartialState | undefined; +const DEVTOOLS_CONFIG_KEY = + 'REACT_NAVIGATION_REDUX_DEVTOOLS_EXTENSION_INTEGRATION_ENABLED'; + const MISSING_CONTEXT_ERROR = "Couldn't find a navigation context. Have you wrapped your app with 'NavigationContainer'? See https://reactnavigation.org/docs/getting-started for setup instructions."; @@ -143,7 +146,9 @@ const BaseNavigationContainer = React.forwardRef( ); const { trackState, trackAction } = useDevTools({ - enabled: false, + enabled: + // @ts-ignore + DEVTOOLS_CONFIG_KEY in global ? global[DEVTOOLS_CONFIG_KEY] : false, name: '@react-navigation', reset, state,