@react-navigation/core 6.4.3 → 6.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/BaseNavigationContainer.js +17 -69
- package/lib/commonjs/BaseNavigationContainer.js.map +1 -1
- package/lib/commonjs/CurrentRenderContext.js +0 -4
- package/lib/commonjs/CurrentRenderContext.js.map +1 -1
- package/lib/commonjs/EnsureSingleNavigator.js +1 -12
- package/lib/commonjs/EnsureSingleNavigator.js.map +1 -1
- package/lib/commonjs/Group.js +0 -1
- package/lib/commonjs/Group.js.map +1 -1
- package/lib/commonjs/NavigationBuilderContext.js +0 -4
- package/lib/commonjs/NavigationBuilderContext.js.map +1 -1
- package/lib/commonjs/NavigationContainerRefContext.js +0 -4
- package/lib/commonjs/NavigationContainerRefContext.js.map +1 -1
- package/lib/commonjs/NavigationContext.js +0 -4
- package/lib/commonjs/NavigationContext.js.map +1 -1
- package/lib/commonjs/NavigationHelpersContext.js +0 -4
- package/lib/commonjs/NavigationHelpersContext.js.map +1 -1
- package/lib/commonjs/NavigationRouteContext.js +0 -4
- package/lib/commonjs/NavigationRouteContext.js.map +1 -1
- package/lib/commonjs/NavigationStateContext.js +0 -12
- package/lib/commonjs/NavigationStateContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveContext.js +0 -4
- package/lib/commonjs/PreventRemoveContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveProvider.js +3 -21
- package/lib/commonjs/PreventRemoveProvider.js.map +1 -1
- package/lib/commonjs/SceneView.js +8 -13
- package/lib/commonjs/SceneView.js.map +1 -1
- package/lib/commonjs/Screen.js +0 -1
- package/lib/commonjs/Screen.js.map +1 -1
- package/lib/commonjs/StaticContainer.js +0 -10
- package/lib/commonjs/StaticContainer.js.map +1 -1
- package/lib/commonjs/UnhandledActionContext.js +0 -4
- package/lib/commonjs/UnhandledActionContext.js.map +1 -1
- package/lib/commonjs/checkDuplicateRouteNames.js +0 -5
- package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -1
- package/lib/commonjs/checkSerializable.js +0 -9
- package/lib/commonjs/checkSerializable.js.map +1 -1
- package/lib/commonjs/createNavigationContainerRef.js +0 -13
- package/lib/commonjs/createNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/createNavigatorFactory.js +0 -5
- package/lib/commonjs/createNavigatorFactory.js.map +1 -1
- package/lib/commonjs/findFocusedRoute.js +5 -10
- package/lib/commonjs/findFocusedRoute.js.map +1 -1
- package/lib/commonjs/fromEntries.js +0 -3
- package/lib/commonjs/fromEntries.js.map +1 -1
- package/lib/commonjs/getActionFromState.js +11 -22
- package/lib/commonjs/getActionFromState.js.map +1 -1
- package/lib/commonjs/getFocusedRouteNameFromRoute.js +7 -8
- package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/commonjs/getPathFromState.js +25 -55
- package/lib/commonjs/getPathFromState.js.map +1 -1
- package/lib/commonjs/getStateFromPath.js +48 -105
- package/lib/commonjs/getStateFromPath.js.map +1 -1
- package/lib/commonjs/index.js +0 -30
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/isArrayEqual.js +0 -3
- package/lib/commonjs/isArrayEqual.js.map +1 -1
- package/lib/commonjs/isRecordEqual.js +0 -4
- package/lib/commonjs/isRecordEqual.js.map +1 -1
- package/lib/commonjs/types.js +3 -5
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useChildListeners.js +0 -5
- package/lib/commonjs/useChildListeners.js.map +1 -1
- package/lib/commonjs/useComponent.js +3 -9
- package/lib/commonjs/useComponent.js.map +1 -1
- package/lib/commonjs/useCurrentRender.js +0 -7
- package/lib/commonjs/useCurrentRender.js.map +1 -1
- package/lib/commonjs/useDescriptors.js +11 -21
- package/lib/commonjs/useDescriptors.js.map +1 -1
- package/lib/commonjs/useEventEmitter.js +2 -24
- package/lib/commonjs/useEventEmitter.js.map +1 -1
- package/lib/commonjs/useFocusEffect.js +2 -20
- package/lib/commonjs/useFocusEffect.js.map +1 -1
- package/lib/commonjs/useFocusEvents.js +9 -15
- package/lib/commonjs/useFocusEvents.js.map +1 -1
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js +0 -8
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -1
- package/lib/commonjs/useIsFocused.js +0 -8
- package/lib/commonjs/useIsFocused.js.map +1 -1
- package/lib/commonjs/useKeyedChildListeners.js +0 -4
- package/lib/commonjs/useKeyedChildListeners.js.map +1 -1
- package/lib/commonjs/useNavigation.js +3 -11
- package/lib/commonjs/useNavigation.js.map +1 -1
- package/lib/commonjs/useNavigationBuilder.js +34 -91
- package/lib/commonjs/useNavigationBuilder.js.map +1 -1
- package/lib/commonjs/useNavigationCache.js +18 -30
- package/lib/commonjs/useNavigationCache.js.map +1 -1
- package/lib/commonjs/useNavigationContainerRef.js +0 -8
- package/lib/commonjs/useNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/useNavigationHelpers.js +4 -18
- package/lib/commonjs/useNavigationHelpers.js.map +1 -1
- package/lib/commonjs/useNavigationState.js +5 -9
- package/lib/commonjs/useNavigationState.js.map +1 -1
- package/lib/commonjs/useOnAction.js +8 -25
- package/lib/commonjs/useOnAction.js.map +1 -1
- package/lib/commonjs/useOnGetState.js +6 -16
- package/lib/commonjs/useOnGetState.js.map +1 -1
- package/lib/commonjs/useOnPreventRemove.js +9 -24
- package/lib/commonjs/useOnPreventRemove.js.map +1 -1
- package/lib/commonjs/useOnRouteFocus.js +0 -8
- package/lib/commonjs/useOnRouteFocus.js.map +1 -1
- package/lib/commonjs/useOptionsGetters.js +5 -24
- package/lib/commonjs/useOptionsGetters.js.map +1 -1
- package/lib/commonjs/usePreventRemove.js +0 -11
- package/lib/commonjs/usePreventRemove.js.map +1 -1
- package/lib/commonjs/usePreventRemoveContext.js +0 -8
- package/lib/commonjs/usePreventRemoveContext.js.map +1 -1
- package/lib/commonjs/useRegisterNavigator.js +0 -8
- package/lib/commonjs/useRegisterNavigator.js.map +1 -1
- package/lib/commonjs/useRoute.js +0 -8
- package/lib/commonjs/useRoute.js.map +1 -1
- package/lib/commonjs/useRouteCache.js +1 -10
- package/lib/commonjs/useRouteCache.js.map +1 -1
- package/lib/commonjs/useScheduleUpdate.js +1 -8
- package/lib/commonjs/useScheduleUpdate.js.map +1 -1
- package/lib/commonjs/useSyncState.js +9 -17
- package/lib/commonjs/useSyncState.js.map +1 -1
- package/lib/commonjs/validatePathConfig.js +0 -7
- package/lib/commonjs/validatePathConfig.js.map +1 -1
- package/lib/module/BaseNavigationContainer.js +17 -46
- package/lib/module/BaseNavigationContainer.js.map +1 -1
- package/lib/module/CurrentRenderContext.js +1 -1
- package/lib/module/CurrentRenderContext.js.map +1 -1
- package/lib/module/EnsureSingleNavigator.js +1 -7
- package/lib/module/EnsureSingleNavigator.js.map +1 -1
- package/lib/module/Group.js.map +1 -1
- package/lib/module/NavigationBuilderContext.js +0 -1
- package/lib/module/NavigationBuilderContext.js.map +1 -1
- package/lib/module/NavigationContainerRefContext.js +0 -1
- package/lib/module/NavigationContainerRefContext.js.map +1 -1
- package/lib/module/NavigationContext.js +0 -1
- package/lib/module/NavigationContext.js.map +1 -1
- package/lib/module/NavigationHelpersContext.js +0 -1
- package/lib/module/NavigationHelpersContext.js.map +1 -1
- package/lib/module/NavigationRouteContext.js +1 -1
- package/lib/module/NavigationRouteContext.js.map +1 -1
- package/lib/module/NavigationStateContext.js +0 -6
- package/lib/module/NavigationStateContext.js.map +1 -1
- package/lib/module/PreventRemoveContext.js +1 -0
- package/lib/module/PreventRemoveContext.js.map +1 -1
- package/lib/module/PreventRemoveProvider.js +3 -12
- package/lib/module/PreventRemoveProvider.js.map +1 -1
- package/lib/module/SceneView.js +8 -5
- package/lib/module/SceneView.js.map +1 -1
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/StaticContainer.js +1 -6
- package/lib/module/StaticContainer.js.map +1 -1
- package/lib/module/UnhandledActionContext.js.map +1 -1
- package/lib/module/checkDuplicateRouteNames.js +0 -4
- package/lib/module/checkDuplicateRouteNames.js.map +1 -1
- package/lib/module/checkSerializable.js +0 -8
- package/lib/module/checkSerializable.js.map +1 -1
- package/lib/module/createNavigationContainerRef.js +0 -10
- package/lib/module/createNavigationContainerRef.js.map +1 -1
- package/lib/module/createNavigatorFactory.js +0 -2
- package/lib/module/createNavigatorFactory.js.map +1 -1
- package/lib/module/findFocusedRoute.js +5 -9
- package/lib/module/findFocusedRoute.js.map +1 -1
- package/lib/module/fromEntries.js +0 -2
- package/lib/module/fromEntries.js.map +1 -1
- package/lib/module/getActionFromState.js +11 -21
- package/lib/module/getActionFromState.js.map +1 -1
- package/lib/module/getFocusedRouteNameFromRoute.js +7 -6
- package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/module/getPathFromState.js +25 -49
- package/lib/module/getPathFromState.js.map +1 -1
- package/lib/module/getStateFromPath.js +48 -98
- package/lib/module/getStateFromPath.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/isArrayEqual.js +0 -2
- package/lib/module/isArrayEqual.js.map +1 -1
- package/lib/module/isRecordEqual.js +0 -3
- package/lib/module/isRecordEqual.js.map +1 -1
- package/lib/module/types.js +3 -3
- package/lib/module/types.js.map +1 -1
- package/lib/module/useChildListeners.js +0 -2
- package/lib/module/useChildListeners.js.map +1 -1
- package/lib/module/useComponent.js +3 -6
- package/lib/module/useComponent.js.map +1 -1
- package/lib/module/useCurrentRender.js +0 -2
- package/lib/module/useCurrentRender.js.map +1 -1
- package/lib/module/useDescriptors.js +11 -11
- package/lib/module/useDescriptors.js.map +1 -1
- package/lib/module/useEventEmitter.js +2 -21
- package/lib/module/useEventEmitter.js.map +1 -1
- package/lib/module/useFocusEffect.js +2 -15
- package/lib/module/useFocusEffect.js.map +1 -1
- package/lib/module/useFocusEvents.js +9 -10
- package/lib/module/useFocusEvents.js.map +1 -1
- package/lib/module/useFocusedListenersChildrenAdapter.js +0 -3
- package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -1
- package/lib/module/useIsFocused.js +1 -3
- package/lib/module/useIsFocused.js.map +1 -1
- package/lib/module/useKeyedChildListeners.js +0 -1
- package/lib/module/useKeyedChildListeners.js.map +1 -1
- package/lib/module/useNavigation.js +3 -5
- package/lib/module/useNavigation.js.map +1 -1
- package/lib/module/useNavigationBuilder.js +37 -63
- package/lib/module/useNavigationBuilder.js.map +1 -1
- package/lib/module/useNavigationCache.js +18 -24
- package/lib/module/useNavigationCache.js.map +1 -1
- package/lib/module/useNavigationContainerRef.js +0 -2
- package/lib/module/useNavigationContainerRef.js.map +1 -1
- package/lib/module/useNavigationHelpers.js +4 -9
- package/lib/module/useNavigationHelpers.js.map +1 -1
- package/lib/module/useNavigationState.js +5 -4
- package/lib/module/useNavigationState.js.map +1 -1
- package/lib/module/useOnAction.js +8 -19
- package/lib/module/useOnAction.js.map +1 -1
- package/lib/module/useOnGetState.js +6 -8
- package/lib/module/useOnGetState.js.map +1 -1
- package/lib/module/useOnPreventRemove.js +9 -14
- package/lib/module/useOnPreventRemove.js.map +1 -1
- package/lib/module/useOnRouteFocus.js +0 -3
- package/lib/module/useOnRouteFocus.js.map +1 -1
- package/lib/module/useOptionsGetters.js +5 -17
- package/lib/module/useOptionsGetters.js.map +1 -1
- package/lib/module/usePreventRemove.js +1 -2
- package/lib/module/usePreventRemove.js.map +1 -1
- package/lib/module/usePreventRemoveContext.js +0 -2
- package/lib/module/usePreventRemoveContext.js.map +1 -1
- package/lib/module/useRegisterNavigator.js +1 -3
- package/lib/module/useRegisterNavigator.js.map +1 -1
- package/lib/module/useRoute.js +0 -3
- package/lib/module/useRoute.js.map +1 -1
- package/lib/module/useRouteCache.js +1 -6
- package/lib/module/useRouteCache.js.map +1 -1
- package/lib/module/useScheduleUpdate.js +1 -3
- package/lib/module/useScheduleUpdate.js.map +1 -1
- package/lib/module/useSyncState.js +9 -13
- package/lib/module/useSyncState.js.map +1 -1
- package/lib/module/validatePathConfig.js +0 -6
- package/lib/module/validatePathConfig.js.map +1 -1
- package/lib/typescript/src/BaseNavigationContainer.d.ts +1 -0
- package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -0
- package/lib/typescript/src/CurrentRenderContext.d.ts +1 -0
- package/lib/typescript/src/CurrentRenderContext.d.ts.map +1 -0
- package/lib/typescript/src/EnsureSingleNavigator.d.ts +1 -0
- package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -0
- package/lib/typescript/src/Group.d.ts +1 -0
- package/lib/typescript/src/Group.d.ts.map +1 -0
- package/lib/typescript/src/NavigationBuilderContext.d.ts +1 -0
- package/lib/typescript/src/NavigationBuilderContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationContainerRefContext.d.ts +1 -0
- package/lib/typescript/src/NavigationContainerRefContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationContext.d.ts +1 -0
- package/lib/typescript/src/NavigationContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationHelpersContext.d.ts +1 -0
- package/lib/typescript/src/NavigationHelpersContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationRouteContext.d.ts +1 -0
- package/lib/typescript/src/NavigationRouteContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationStateContext.d.ts +1 -0
- package/lib/typescript/src/NavigationStateContext.d.ts.map +1 -0
- package/lib/typescript/src/PreventRemoveContext.d.ts +1 -0
- package/lib/typescript/src/PreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/src/PreventRemoveProvider.d.ts +1 -0
- package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -0
- package/lib/typescript/src/SceneView.d.ts +1 -0
- package/lib/typescript/src/SceneView.d.ts.map +1 -0
- package/lib/typescript/src/Screen.d.ts +1 -0
- package/lib/typescript/src/Screen.d.ts.map +1 -0
- package/lib/typescript/src/StaticContainer.d.ts +1 -0
- package/lib/typescript/src/StaticContainer.d.ts.map +1 -0
- package/lib/typescript/src/UnhandledActionContext.d.ts +1 -0
- package/lib/typescript/src/UnhandledActionContext.d.ts.map +1 -0
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts +1 -0
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts.map +1 -0
- package/lib/typescript/src/checkSerializable.d.ts +1 -0
- package/lib/typescript/src/checkSerializable.d.ts.map +1 -0
- package/lib/typescript/src/createNavigationContainerRef.d.ts +1 -0
- package/lib/typescript/src/createNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/src/createNavigatorFactory.d.ts +1 -0
- package/lib/typescript/src/createNavigatorFactory.d.ts.map +1 -0
- package/lib/typescript/src/findFocusedRoute.d.ts +1 -0
- package/lib/typescript/src/findFocusedRoute.d.ts.map +1 -0
- package/lib/typescript/src/fromEntries.d.ts +1 -0
- package/lib/typescript/src/fromEntries.d.ts.map +1 -0
- package/lib/typescript/src/getActionFromState.d.ts +1 -0
- package/lib/typescript/src/getActionFromState.d.ts.map +1 -0
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts +1 -0
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts.map +1 -0
- package/lib/typescript/src/getPathFromState.d.ts +1 -0
- package/lib/typescript/src/getPathFromState.d.ts.map +1 -0
- package/lib/typescript/src/getStateFromPath.d.ts +1 -0
- package/lib/typescript/src/getStateFromPath.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/isArrayEqual.d.ts +1 -0
- package/lib/typescript/src/isArrayEqual.d.ts.map +1 -0
- package/lib/typescript/src/isRecordEqual.d.ts +1 -0
- package/lib/typescript/src/isRecordEqual.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +1 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/useChildListeners.d.ts +1 -0
- package/lib/typescript/src/useChildListeners.d.ts.map +1 -0
- package/lib/typescript/src/useComponent.d.ts +1 -0
- package/lib/typescript/src/useComponent.d.ts.map +1 -0
- package/lib/typescript/src/useCurrentRender.d.ts +1 -0
- package/lib/typescript/src/useCurrentRender.d.ts.map +1 -0
- package/lib/typescript/src/useDescriptors.d.ts +1 -0
- package/lib/typescript/src/useDescriptors.d.ts.map +1 -0
- package/lib/typescript/src/useEventEmitter.d.ts +1 -0
- package/lib/typescript/src/useEventEmitter.d.ts.map +1 -0
- package/lib/typescript/src/useFocusEffect.d.ts +1 -0
- package/lib/typescript/src/useFocusEffect.d.ts.map +1 -0
- package/lib/typescript/src/useFocusEvents.d.ts +1 -0
- package/lib/typescript/src/useFocusEvents.d.ts.map +1 -0
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +1 -0
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -0
- package/lib/typescript/src/useIsFocused.d.ts +1 -0
- package/lib/typescript/src/useIsFocused.d.ts.map +1 -0
- package/lib/typescript/src/useKeyedChildListeners.d.ts +1 -0
- package/lib/typescript/src/useKeyedChildListeners.d.ts.map +1 -0
- package/lib/typescript/src/useNavigation.d.ts +1 -0
- package/lib/typescript/src/useNavigation.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationBuilder.d.ts +1 -0
- package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationCache.d.ts +1 -0
- package/lib/typescript/src/useNavigationCache.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationContainerRef.d.ts +1 -0
- package/lib/typescript/src/useNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationHelpers.d.ts +1 -0
- package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationState.d.ts +1 -0
- package/lib/typescript/src/useNavigationState.d.ts.map +1 -0
- package/lib/typescript/src/useOnAction.d.ts +1 -0
- package/lib/typescript/src/useOnAction.d.ts.map +1 -0
- package/lib/typescript/src/useOnGetState.d.ts +1 -0
- package/lib/typescript/src/useOnGetState.d.ts.map +1 -0
- package/lib/typescript/src/useOnPreventRemove.d.ts +1 -0
- package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -0
- package/lib/typescript/src/useOnRouteFocus.d.ts +1 -0
- package/lib/typescript/src/useOnRouteFocus.d.ts.map +1 -0
- package/lib/typescript/src/useOptionsGetters.d.ts +1 -0
- package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -0
- package/lib/typescript/src/usePreventRemove.d.ts +1 -0
- package/lib/typescript/src/usePreventRemove.d.ts.map +1 -0
- package/lib/typescript/src/usePreventRemoveContext.d.ts +1 -0
- package/lib/typescript/src/usePreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/src/useRegisterNavigator.d.ts +1 -0
- package/lib/typescript/src/useRegisterNavigator.d.ts.map +1 -0
- package/lib/typescript/src/useRoute.d.ts +1 -0
- package/lib/typescript/src/useRoute.d.ts.map +1 -0
- package/lib/typescript/src/useRouteCache.d.ts +1 -0
- package/lib/typescript/src/useRouteCache.d.ts.map +1 -0
- package/lib/typescript/src/useScheduleUpdate.d.ts +1 -0
- package/lib/typescript/src/useScheduleUpdate.d.ts.map +1 -0
- package/lib/typescript/src/useSyncState.d.ts +1 -0
- package/lib/typescript/src/useSyncState.d.ts.map +1 -0
- package/lib/typescript/src/validatePathConfig.d.ts +1 -0
- package/lib/typescript/src/validatePathConfig.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useFocusEffect;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _useNavigation = _interopRequireDefault(require("./useNavigation"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Hook to run an effect in a focused screen, similar to `React.useEffect`.
|
|
20
14
|
* This can be used to perform side-effects such as fetching data or subscribing to events.
|
|
@@ -24,26 +18,20 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
24
18
|
*/
|
|
25
19
|
function useFocusEffect(effect) {
|
|
26
20
|
const navigation = (0, _useNavigation.default)();
|
|
27
|
-
|
|
28
21
|
if (arguments[1] !== undefined) {
|
|
29
22
|
const message = "You passed a second argument to 'useFocusEffect', but it only accepts one argument. " + "If you want to pass a dependency array, you can use 'React.useCallback':\n\n" + 'useFocusEffect(\n' + ' React.useCallback(() => {\n' + ' // Your code here\n' + ' }, [depA, depB])\n' + ');\n\n' + 'See usage guide: https://reactnavigation.org/docs/use-focus-effect';
|
|
30
23
|
console.error(message);
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
React.useEffect(() => {
|
|
34
26
|
let isFocused = false;
|
|
35
27
|
let cleanup;
|
|
36
|
-
|
|
37
28
|
const callback = () => {
|
|
38
29
|
const destroy = effect();
|
|
39
|
-
|
|
40
30
|
if (destroy === undefined || typeof destroy === 'function') {
|
|
41
31
|
return destroy;
|
|
42
32
|
}
|
|
43
|
-
|
|
44
33
|
if (process.env.NODE_ENV !== 'production') {
|
|
45
34
|
let message = 'An effect function must not return anything besides a function, which is used for clean-up.';
|
|
46
|
-
|
|
47
35
|
if (destroy === null) {
|
|
48
36
|
message += " You returned 'null'. If your effect does not require clean-up, return 'undefined' (or nothing).";
|
|
49
37
|
} else if (typeof destroy.then === 'function') {
|
|
@@ -51,28 +39,24 @@ function useFocusEffect(effect) {
|
|
|
51
39
|
} else {
|
|
52
40
|
message += ` You returned '${JSON.stringify(destroy)}'.`;
|
|
53
41
|
}
|
|
54
|
-
|
|
55
42
|
console.error(message);
|
|
56
43
|
}
|
|
57
|
-
};
|
|
58
|
-
|
|
44
|
+
};
|
|
59
45
|
|
|
46
|
+
// We need to run the effect on intial render/dep changes if the screen is focused
|
|
60
47
|
if (navigation.isFocused()) {
|
|
61
48
|
cleanup = callback();
|
|
62
49
|
isFocused = true;
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
const unsubscribeFocus = navigation.addListener('focus', () => {
|
|
66
52
|
// If callback was already called for focus, avoid calling it again
|
|
67
53
|
// The focus event may also fire on intial render, so we guard against runing the effect twice
|
|
68
54
|
if (isFocused) {
|
|
69
55
|
return;
|
|
70
56
|
}
|
|
71
|
-
|
|
72
57
|
if (cleanup !== undefined) {
|
|
73
58
|
cleanup();
|
|
74
59
|
}
|
|
75
|
-
|
|
76
60
|
cleanup = callback();
|
|
77
61
|
isFocused = true;
|
|
78
62
|
});
|
|
@@ -80,7 +64,6 @@ function useFocusEffect(effect) {
|
|
|
80
64
|
if (cleanup !== undefined) {
|
|
81
65
|
cleanup();
|
|
82
66
|
}
|
|
83
|
-
|
|
84
67
|
cleanup = undefined;
|
|
85
68
|
isFocused = false;
|
|
86
69
|
});
|
|
@@ -88,7 +71,6 @@ function useFocusEffect(effect) {
|
|
|
88
71
|
if (cleanup !== undefined) {
|
|
89
72
|
cleanup();
|
|
90
73
|
}
|
|
91
|
-
|
|
92
74
|
unsubscribeFocus();
|
|
93
75
|
unsubscribeBlur();
|
|
94
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useFocusEffect","effect","navigation","useNavigation","arguments","undefined","message","console","error","React","useEffect","isFocused","cleanup","callback","destroy","process","env","NODE_ENV","then","JSON","stringify","unsubscribeFocus","addListener","unsubscribeBlur"],"
|
|
1
|
+
{"version":3,"names":["useFocusEffect","effect","navigation","useNavigation","arguments","undefined","message","console","error","React","useEffect","isFocused","cleanup","callback","destroy","process","env","NODE_ENV","then","JSON","stringify","unsubscribeFocus","addListener","unsubscribeBlur"],"sourceRoot":"../../src","sources":["useFocusEffect.tsx"],"mappings":";;;;;;AAAA;AAEA;AAA4C;AAAA;AAAA;AAI5C;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAc,CAACC,MAAsB,EAAE;EAC7D,MAAMC,UAAU,GAAG,IAAAC,sBAAa,GAAE;EAElC,IAAIC,SAAS,CAAC,CAAC,CAAC,KAAKC,SAAS,EAAE;IAC9B,MAAMC,OAAO,GACX,sFAAsF,GACtF,8EAA8E,GAC9E,mBAAmB,GACnB,+BAA+B,GAC/B,yBAAyB,GACzB,sBAAsB,GACtB,QAAQ,GACR,oEAAoE;IAEtEC,OAAO,CAACC,KAAK,CAACF,OAAO,CAAC;EACxB;EAEAG,KAAK,CAACC,SAAS,CAAC,MAAM;IACpB,IAAIC,SAAS,GAAG,KAAK;IACrB,IAAIC,OAAwC;IAE5C,MAAMC,QAAQ,GAAG,MAAM;MACrB,MAAMC,OAAO,GAAGb,MAAM,EAAE;MAExB,IAAIa,OAAO,KAAKT,SAAS,IAAI,OAAOS,OAAO,KAAK,UAAU,EAAE;QAC1D,OAAOA,OAAO;MAChB;MAEA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAIX,OAAO,GACT,6FAA6F;QAE/F,IAAIQ,OAAO,KAAK,IAAI,EAAE;UACpBR,OAAO,IACL,kGAAkG;QACtG,CAAC,MAAM,IAAI,OAAQQ,OAAO,CAASI,IAAI,KAAK,UAAU,EAAE;UACtDZ,OAAO,IACL,uFAAuF,GACvF,uDAAuD,GACvD,8BAA8B,GAC9B,mBAAmB,GACnB,+BAA+B,GAC/B,oCAAoC,GACpC,+BAA+B,GAC/B,uDAAuD,GACvD,gBAAgB,GAChB,WAAW,GACX,oBAAoB,GACpB,kBAAkB,GAClB,QAAQ,GACR,oEAAoE;QACxE,CAAC,MAAM;UACLA,OAAO,IAAK,kBAAiBa,IAAI,CAACC,SAAS,CAACN,OAAO,CAAE,IAAG;QAC1D;QAEAP,OAAO,CAACC,KAAK,CAACF,OAAO,CAAC;MACxB;IACF,CAAC;;IAED;IACA,IAAIJ,UAAU,CAACS,SAAS,EAAE,EAAE;MAC1BC,OAAO,GAAGC,QAAQ,EAAE;MACpBF,SAAS,GAAG,IAAI;IAClB;IAEA,MAAMU,gBAAgB,GAAGnB,UAAU,CAACoB,WAAW,CAAC,OAAO,EAAE,MAAM;MAC7D;MACA;MACA,IAAIX,SAAS,EAAE;QACb;MACF;MAEA,IAAIC,OAAO,KAAKP,SAAS,EAAE;QACzBO,OAAO,EAAE;MACX;MAEAA,OAAO,GAAGC,QAAQ,EAAE;MACpBF,SAAS,GAAG,IAAI;IAClB,CAAC,CAAC;IAEF,MAAMY,eAAe,GAAGrB,UAAU,CAACoB,WAAW,CAAC,MAAM,EAAE,MAAM;MAC3D,IAAIV,OAAO,KAAKP,SAAS,EAAE;QACzBO,OAAO,EAAE;MACX;MAEAA,OAAO,GAAGP,SAAS;MACnBM,SAAS,GAAG,KAAK;IACnB,CAAC,CAAC;IAEF,OAAO,MAAM;MACX,IAAIC,OAAO,KAAKP,SAAS,EAAE;QACzBO,OAAO,EAAE;MACX;MAEAS,gBAAgB,EAAE;MAClBE,eAAe,EAAE;IACnB,CAAC;EACH,CAAC,EAAE,CAACtB,MAAM,EAAEC,UAAU,CAAC,CAAC;AAC1B"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useFocusEvents;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _NavigationContext = _interopRequireDefault(require("./NavigationContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Hook to take care of emitting `focus` and `blur` events.
|
|
20
14
|
*/
|
|
@@ -25,9 +19,10 @@ function useFocusEvents(_ref) {
|
|
|
25
19
|
} = _ref;
|
|
26
20
|
const navigation = React.useContext(_NavigationContext.default);
|
|
27
21
|
const lastFocusedKeyRef = React.useRef();
|
|
28
|
-
const currentFocusedKey = state.routes[state.index].key;
|
|
29
|
-
// Coz the child screen can't be focused if the parent screen is out of focus
|
|
22
|
+
const currentFocusedKey = state.routes[state.index].key;
|
|
30
23
|
|
|
24
|
+
// When the parent screen changes its focus state, we also need to change child's focus
|
|
25
|
+
// Coz the child screen can't be focused if the parent screen is out of focus
|
|
31
26
|
React.useEffect(() => navigation === null || navigation === void 0 ? void 0 : navigation.addListener('focus', () => {
|
|
32
27
|
lastFocusedKeyRef.current = currentFocusedKey;
|
|
33
28
|
emitter.emit({
|
|
@@ -44,27 +39,26 @@ function useFocusEvents(_ref) {
|
|
|
44
39
|
}), [currentFocusedKey, emitter, navigation]);
|
|
45
40
|
React.useEffect(() => {
|
|
46
41
|
const lastFocusedKey = lastFocusedKeyRef.current;
|
|
47
|
-
lastFocusedKeyRef.current = currentFocusedKey;
|
|
48
|
-
// Fire focus event for the current route on mount if there's no parent navigator
|
|
42
|
+
lastFocusedKeyRef.current = currentFocusedKey;
|
|
49
43
|
|
|
44
|
+
// We wouldn't have `lastFocusedKey` on initial mount
|
|
45
|
+
// Fire focus event for the current route on mount if there's no parent navigator
|
|
50
46
|
if (lastFocusedKey === undefined && !navigation) {
|
|
51
47
|
emitter.emit({
|
|
52
48
|
type: 'focus',
|
|
53
49
|
target: currentFocusedKey
|
|
54
50
|
});
|
|
55
|
-
}
|
|
56
|
-
// When navigator is not focused, screens inside shouldn't receive focused status either
|
|
57
|
-
|
|
51
|
+
}
|
|
58
52
|
|
|
53
|
+
// We should only emit events when the focused key changed and navigator is focused
|
|
54
|
+
// When navigator is not focused, screens inside shouldn't receive focused status either
|
|
59
55
|
if (lastFocusedKey === currentFocusedKey || !(navigation ? navigation.isFocused() : true)) {
|
|
60
56
|
return;
|
|
61
57
|
}
|
|
62
|
-
|
|
63
58
|
if (lastFocusedKey === undefined) {
|
|
64
59
|
// Only fire events after initial mount
|
|
65
60
|
return;
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
emitter.emit({
|
|
69
63
|
type: 'blur',
|
|
70
64
|
target: lastFocusedKey
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useFocusEvents","state","emitter","navigation","React","useContext","NavigationContext","lastFocusedKeyRef","useRef","currentFocusedKey","routes","index","key","useEffect","addListener","current","emit","type","target","undefined","lastFocusedKey","isFocused"],"
|
|
1
|
+
{"version":3,"names":["useFocusEvents","state","emitter","navigation","React","useContext","NavigationContext","lastFocusedKeyRef","useRef","currentFocusedKey","routes","index","key","useEffect","addListener","current","emit","type","target","undefined","lastFocusedKey","isFocused"],"sourceRoot":"../../src","sources":["useFocusEvents.tsx"],"mappings":";;;;;;AACA;AAEA;AAAoD;AAAA;AAAA;AASpD;AACA;AACA;AACe,SAASA,cAAc,OAGnB;EAAA,IAHmD;IACpEC,KAAK;IACLC;EACc,CAAC;EACf,MAAMC,UAAU,GAAGC,KAAK,CAACC,UAAU,CAACC,0BAAiB,CAAC;EACtD,MAAMC,iBAAiB,GAAGH,KAAK,CAACI,MAAM,EAAsB;EAE5D,MAAMC,iBAAiB,GAAGR,KAAK,CAACS,MAAM,CAACT,KAAK,CAACU,KAAK,CAAC,CAACC,GAAG;;EAEvD;EACA;EACAR,KAAK,CAACS,SAAS,CACb,MACEV,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEW,WAAW,CAAC,OAAO,EAAE,MAAM;IACrCP,iBAAiB,CAACQ,OAAO,GAAGN,iBAAiB;IAC7CP,OAAO,CAACc,IAAI,CAAC;MAAEC,IAAI,EAAE,OAAO;MAAEC,MAAM,EAAET;IAAkB,CAAC,CAAC;EAC5D,CAAC,CAAC,EACJ,CAACA,iBAAiB,EAAEP,OAAO,EAAEC,UAAU,CAAC,CACzC;EAEDC,KAAK,CAACS,SAAS,CACb,MACEV,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEW,WAAW,CAAC,MAAM,EAAE,MAAM;IACpCP,iBAAiB,CAACQ,OAAO,GAAGI,SAAS;IACrCjB,OAAO,CAACc,IAAI,CAAC;MAAEC,IAAI,EAAE,MAAM;MAAEC,MAAM,EAAET;IAAkB,CAAC,CAAC;EAC3D,CAAC,CAAC,EACJ,CAACA,iBAAiB,EAAEP,OAAO,EAAEC,UAAU,CAAC,CACzC;EAEDC,KAAK,CAACS,SAAS,CAAC,MAAM;IACpB,MAAMO,cAAc,GAAGb,iBAAiB,CAACQ,OAAO;IAEhDR,iBAAiB,CAACQ,OAAO,GAAGN,iBAAiB;;IAE7C;IACA;IACA,IAAIW,cAAc,KAAKD,SAAS,IAAI,CAAChB,UAAU,EAAE;MAC/CD,OAAO,CAACc,IAAI,CAAC;QAAEC,IAAI,EAAE,OAAO;QAAEC,MAAM,EAAET;MAAkB,CAAC,CAAC;IAC5D;;IAEA;IACA;IACA,IACEW,cAAc,KAAKX,iBAAiB,IACpC,EAAEN,UAAU,GAAGA,UAAU,CAACkB,SAAS,EAAE,GAAG,IAAI,CAAC,EAC7C;MACA;IACF;IAEA,IAAID,cAAc,KAAKD,SAAS,EAAE;MAChC;MACA;IACF;IAEAjB,OAAO,CAACc,IAAI,CAAC;MAAEC,IAAI,EAAE,MAAM;MAAEC,MAAM,EAAEE;IAAe,CAAC,CAAC;IACtDlB,OAAO,CAACc,IAAI,CAAC;MAAEC,IAAI,EAAE,OAAO;MAAEC,MAAM,EAAET;IAAkB,CAAC,CAAC;EAC5D,CAAC,EAAE,CAACA,iBAAiB,EAAEP,OAAO,EAAEC,UAAU,CAAC,CAAC;AAC9C"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useFocusedListenersChildrenAdapter;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _NavigationBuilderContext = _interopRequireDefault(require("./NavigationBuilderContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Hook for passing focus callback to children
|
|
20
14
|
*/
|
|
@@ -33,7 +27,6 @@ function useFocusedListenersChildrenAdapter(_ref) {
|
|
|
33
27
|
handled,
|
|
34
28
|
result
|
|
35
29
|
} = listener(callback);
|
|
36
|
-
|
|
37
30
|
if (handled) {
|
|
38
31
|
return {
|
|
39
32
|
handled,
|
|
@@ -41,7 +34,6 @@ function useFocusedListenersChildrenAdapter(_ref) {
|
|
|
41
34
|
};
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
return {
|
|
46
38
|
handled: true,
|
|
47
39
|
result: callback(navigation)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useFocusedListenersChildrenAdapter","navigation","focusedListeners","addListener","React","useContext","NavigationBuilderContext","listener","useCallback","callback","isFocused","handled","result","useEffect"],"
|
|
1
|
+
{"version":3,"names":["useFocusedListenersChildrenAdapter","navigation","focusedListeners","addListener","React","useContext","NavigationBuilderContext","listener","useCallback","callback","isFocused","handled","result","useEffect"],"sourceRoot":"../../src","sources":["useFocusedListenersChildrenAdapter.tsx"],"mappings":";;;;;;AACA;AAEA;AAGoC;AAAA;AAAA;AAQpC;AACA;AACA;AACe,SAASA,kCAAkC,OAG9C;EAAA,IAH+C;IACzDC,UAAU;IACVC;EACO,CAAC;EACR,MAAM;IAAEC;EAAY,CAAC,GAAGC,KAAK,CAACC,UAAU,CAACC,iCAAwB,CAAC;EAElE,MAAMC,QAAQ,GAAGH,KAAK,CAACI,WAAW,CAC/BC,QAAwC,IAAK;IAC5C,IAAIR,UAAU,CAACS,SAAS,EAAE,EAAE;MAC1B,KAAK,MAAMH,QAAQ,IAAIL,gBAAgB,EAAE;QACvC,MAAM;UAAES,OAAO;UAAEC;QAAO,CAAC,GAAGL,QAAQ,CAACE,QAAQ,CAAC;QAE9C,IAAIE,OAAO,EAAE;UACX,OAAO;YAAEA,OAAO;YAAEC;UAAO,CAAC;QAC5B;MACF;MAEA,OAAO;QAAED,OAAO,EAAE,IAAI;QAAEC,MAAM,EAAEH,QAAQ,CAACR,UAAU;MAAE,CAAC;IACxD,CAAC,MAAM;MACL,OAAO;QAAEU,OAAO,EAAE,KAAK;QAAEC,MAAM,EAAE;MAAK,CAAC;IACzC;EACF,CAAC,EACD,CAACV,gBAAgB,EAAED,UAAU,CAAC,CAC/B;EAEDG,KAAK,CAACS,SAAS,CACb,MAAMV,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAG,OAAO,EAAEI,QAAQ,CAAC,EACtC,CAACJ,WAAW,EAAEI,QAAQ,CAAC,CACxB;AACH"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useIsFocused;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _useNavigation = _interopRequireDefault(require("./useNavigation"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Hook to get the current focus state of the screen. Returns a `true` if screen is focused, otherwise `false`.
|
|
20
14
|
* This can be used if a component needs to render something based on the focus state.
|
|
@@ -23,7 +17,6 @@ function useIsFocused() {
|
|
|
23
17
|
const navigation = (0, _useNavigation.default)();
|
|
24
18
|
const [isFocused, setIsFocused] = (0, React.useState)(navigation.isFocused);
|
|
25
19
|
const valueToReturn = navigation.isFocused();
|
|
26
|
-
|
|
27
20
|
if (isFocused !== valueToReturn) {
|
|
28
21
|
// If the value has changed since the last render, we need to update it.
|
|
29
22
|
// This could happen if we missed an update from the event listeners during re-render.
|
|
@@ -32,7 +25,6 @@ function useIsFocused() {
|
|
|
32
25
|
// This is the same logic as in https://github.com/facebook/react/tree/master/packages/use-subscription
|
|
33
26
|
setIsFocused(valueToReturn);
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
React.useEffect(() => {
|
|
37
29
|
const unsubscribeFocus = navigation.addListener('focus', () => setIsFocused(true));
|
|
38
30
|
const unsubscribeBlur = navigation.addListener('blur', () => setIsFocused(false));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useIsFocused","navigation","useNavigation","isFocused","setIsFocused","useState","valueToReturn","React","useEffect","unsubscribeFocus","addListener","unsubscribeBlur","useDebugValue"],"
|
|
1
|
+
{"version":3,"names":["useIsFocused","navigation","useNavigation","isFocused","setIsFocused","useState","valueToReturn","React","useEffect","unsubscribeFocus","addListener","unsubscribeBlur","useDebugValue"],"sourceRoot":"../../src","sources":["useIsFocused.tsx"],"mappings":";;;;;;AAAA;AAGA;AAA4C;AAAA;AAAA;AAE5C;AACA;AACA;AACA;AACe,SAASA,YAAY,GAAY;EAC9C,MAAMC,UAAU,GAAG,IAAAC,sBAAa,GAAE;EAClC,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAG,IAAAC,cAAQ,EAACJ,UAAU,CAACE,SAAS,CAAC;EAEhE,MAAMG,aAAa,GAAGL,UAAU,CAACE,SAAS,EAAE;EAE5C,IAAIA,SAAS,KAAKG,aAAa,EAAE;IAC/B;IACA;IACA;IACA;IACA;IACAF,YAAY,CAACE,aAAa,CAAC;EAC7B;EAEAC,KAAK,CAACC,SAAS,CAAC,MAAM;IACpB,MAAMC,gBAAgB,GAAGR,UAAU,CAACS,WAAW,CAAC,OAAO,EAAE,MACvDN,YAAY,CAAC,IAAI,CAAC,CACnB;IAED,MAAMO,eAAe,GAAGV,UAAU,CAACS,WAAW,CAAC,MAAM,EAAE,MACrDN,YAAY,CAAC,KAAK,CAAC,CACpB;IAED,OAAO,MAAM;MACXK,gBAAgB,EAAE;MAClBE,eAAe,EAAE;IACnB,CAAC;EACH,CAAC,EAAE,CAACV,UAAU,CAAC,CAAC;EAEhBM,KAAK,CAACK,aAAa,CAACN,aAAa,CAAC;EAElC,OAAOA,aAAa;AACtB"}
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useKeyedChildListeners;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
|
|
12
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* Hook which lets child navigators add getters to be called for obtaining rehydrated state.
|
|
16
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useKeyedChildListeners","current","keyedListeners","React","useRef","Object","assign","create","getState","beforeRemove","addKeyedListener","useCallback","type","key","listener","undefined"],"
|
|
1
|
+
{"version":3,"names":["useKeyedChildListeners","current","keyedListeners","React","useRef","Object","assign","create","getState","beforeRemove","addKeyedListener","useCallback","type","key","listener","undefined"],"sourceRoot":"../../src","sources":["useKeyedChildListeners.tsx"],"mappings":";;;;;;AAAA;AAA+B;AAAA;AAI/B;AACA;AACA;AACe,SAASA,sBAAsB,GAAG;EAC/C,MAAM;IAAEC,OAAO,EAAEC;EAAe,CAAC,GAAGC,KAAK,CAACC,MAAM,CAM9CC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAAC,IAAI,CAAC,EAAE;IACjCC,QAAQ,EAAE,CAAC,CAAC;IACZC,YAAY,EAAE,CAAC;EACjB,CAAC,CAAC,CACH;EAED,MAAMC,gBAAgB,GAAGP,KAAK,CAACQ,WAAW,CACxC,CACEC,IAAO,EACPC,GAAW,EACXC,QAA6B,KAC1B;IACH;IACAZ,cAAc,CAACU,IAAI,CAAC,CAACC,GAAG,CAAC,GAAGC,QAAQ;IAEpC,OAAO,MAAM;MACX;MACAZ,cAAc,CAACU,IAAI,CAAC,CAACC,GAAG,CAAC,GAAGE,SAAS;IACvC,CAAC;EACH,CAAC,EACD,CAACb,cAAc,CAAC,CACjB;EAED,OAAO;IACLA,cAAc;IACdQ;EACF,CAAC;AACH"}
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useNavigation;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _NavigationContainerRefContext = _interopRequireDefault(require("./NavigationContainerRefContext"));
|
|
11
|
-
|
|
12
9
|
var _NavigationContext = _interopRequireDefault(require("./NavigationContext"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
13
|
/**
|
|
21
14
|
* Hook to access the navigation prop of the parent screen anywhere.
|
|
22
15
|
*
|
|
@@ -25,12 +18,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
25
18
|
function useNavigation() {
|
|
26
19
|
const root = React.useContext(_NavigationContainerRefContext.default);
|
|
27
20
|
const navigation = React.useContext(_NavigationContext.default);
|
|
28
|
-
|
|
29
21
|
if (navigation === undefined && root === undefined) {
|
|
30
22
|
throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");
|
|
31
|
-
}
|
|
32
|
-
|
|
23
|
+
}
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
// FIXME: Figure out a better way to do this
|
|
26
|
+
return navigation ?? root;
|
|
35
27
|
}
|
|
36
28
|
//# sourceMappingURL=useNavigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useNavigation","root","React","useContext","NavigationContainerRefContext","navigation","NavigationContext","undefined","Error"],"
|
|
1
|
+
{"version":3,"names":["useNavigation","root","React","useContext","NavigationContainerRefContext","navigation","NavigationContext","undefined","Error"],"sourceRoot":"../../src","sources":["useNavigation.tsx"],"mappings":";;;;;;AAAA;AAEA;AACA;AAAoD;AAAA;AAAA;AAGpD;AACA;AACA;AACA;AACA;AACe,SAASA,aAAa,GAE9B;EACL,MAAMC,IAAI,GAAGC,KAAK,CAACC,UAAU,CAACC,sCAA6B,CAAC;EAC5D,MAAMC,UAAU,GAAGH,KAAK,CAACC,UAAU,CAACG,0BAAiB,CAAC;EAEtD,IAAID,UAAU,KAAKE,SAAS,IAAIN,IAAI,KAAKM,SAAS,EAAE;IAClD,MAAM,IAAIC,KAAK,CACb,kFAAkF,CACnF;EACH;;EAEA;EACA,OAAQH,UAAU,IAAIJ,IAAI;AAC5B"}
|