react-native-screen-transitions 2.4.0 → 2.4.2-beta.0
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/__configs__/presets.js.map +1 -1
- package/lib/commonjs/components/root-transition-aware.js.map +1 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/hooks/animation/use-screen-animation.js +9 -5
- package/lib/commonjs/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/integrations/blank-stack/components/Header.js +142 -0
- package/lib/commonjs/integrations/blank-stack/components/Header.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/components/Screens.js +64 -0
- package/lib/commonjs/integrations/blank-stack/components/Screens.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/components/StackView.js +94 -0
- package/lib/commonjs/integrations/blank-stack/components/StackView.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js +74 -0
- package/lib/commonjs/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +66 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +16 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +208 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
- package/lib/commonjs/{types/navigator.js → integrations/blank-stack/utils/with-stack-navigation/_types.js} +1 -1
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +15 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js +23 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +15 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +14 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +13 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js +71 -0
- package/lib/commonjs/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
- package/lib/commonjs/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/commonjs/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
- package/lib/commonjs/providers/keys.js.map +1 -1
- package/lib/commonjs/providers/screen-transition-provider.js.map +1 -1
- package/lib/commonjs/providers/transition-styles.js +18 -4
- package/lib/commonjs/providers/transition-styles.js.map +1 -1
- package/lib/commonjs/stores/animations.js.map +1 -1
- package/lib/commonjs/stores/bounds/index.js.map +1 -1
- package/lib/commonjs/stores/gestures.js.map +1 -1
- package/lib/commonjs/stores/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/commonjs/types/blank-stack.navigator.js +6 -0
- package/lib/commonjs/types/{navigator.js.map → blank-stack.navigator.js.map} +1 -1
- package/lib/commonjs/types/native-stack.navigator.js +6 -0
- package/lib/commonjs/types/native-stack.navigator.js.map +1 -0
- package/lib/commonjs/utils/animation/derivations.js +1 -14
- package/lib/commonjs/utils/animation/derivations.js.map +1 -1
- package/lib/commonjs/utils/bounds/_utils/styles.js.map +1 -1
- package/lib/commonjs/utils/bounds/constants.js.map +1 -1
- package/lib/commonjs/utils/bounds/index.js +23 -90
- package/lib/commonjs/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/utils/gesture/apply-offset-rules.js.map +1 -1
- package/lib/commonjs/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/commonjs/utils/gesture/reset-gesture-values.js.map +1 -1
- package/lib/commonjs/utils/gesture/velocity.js +2 -2
- package/lib/commonjs/utils/gesture/velocity.js.map +1 -1
- package/lib/module/__configs__/presets.js.map +1 -1
- package/lib/module/components/root-transition-aware.js.map +1 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/hooks/animation/use-screen-animation.js +9 -5
- package/lib/module/hooks/animation/use-screen-animation.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/integrations/blank-stack/components/Header.js +138 -0
- package/lib/module/integrations/blank-stack/components/Header.js.map +1 -0
- package/lib/module/integrations/blank-stack/components/Screens.js +58 -0
- package/lib/module/integrations/blank-stack/components/Screens.js.map +1 -0
- package/lib/module/integrations/blank-stack/components/StackView.js +90 -0
- package/lib/module/integrations/blank-stack/components/StackView.js.map +1 -0
- package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js +68 -0
- package/lib/module/integrations/blank-stack/navigators/createBlankStackNavigator.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js +60 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js +11 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js +202 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js +4 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_types.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js +10 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js +19 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js +10 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js +9 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js +8 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.js.map +1 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js +65 -0
- package/lib/module/integrations/blank-stack/utils/with-stack-navigation/index.js.map +1 -0
- package/lib/module/integrations/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/module/integrations/native-stack/utils/getModalRoutesKeys.js.map +1 -1
- package/lib/module/integrations/native-stack/utils/useInvalidPreventRemoveError.js.map +1 -1
- package/lib/module/integrations/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/module/integrations/native-stack/views/NativeStackView.native.js.map +1 -1
- package/lib/module/integrations/native-stack/views/useHeaderConfigProps.js.map +1 -1
- package/lib/module/providers/keys.js.map +1 -1
- package/lib/module/providers/screen-transition-provider.js.map +1 -1
- package/lib/module/providers/transition-styles.js +19 -5
- package/lib/module/providers/transition-styles.js.map +1 -1
- package/lib/module/stores/animations.js.map +1 -1
- package/lib/module/stores/bounds/index.js.map +1 -1
- package/lib/module/stores/gestures.js.map +1 -1
- package/lib/module/stores/utils/reset-stores-for-screen.js.map +1 -1
- package/lib/module/types/blank-stack.navigator.js +4 -0
- package/lib/module/types/{navigator.js.map → blank-stack.navigator.js.map} +1 -1
- package/lib/module/types/native-stack.navigator.js +4 -0
- package/lib/module/types/native-stack.navigator.js.map +1 -0
- package/lib/module/utils/animation/derivations.js +1 -14
- package/lib/module/utils/animation/derivations.js.map +1 -1
- package/lib/module/utils/bounds/_utils/styles.js.map +1 -1
- package/lib/module/utils/bounds/constants.js.map +1 -1
- package/lib/module/utils/bounds/index.js +24 -91
- package/lib/module/utils/bounds/index.js.map +1 -1
- package/lib/module/utils/gesture/apply-offset-rules.js.map +1 -1
- package/lib/module/utils/gesture/check-gesture-activation.js.map +1 -1
- package/lib/module/utils/gesture/reset-gesture-values.js.map +1 -1
- package/lib/module/utils/gesture/velocity.js +2 -2
- package/lib/module/utils/gesture/velocity.js.map +1 -1
- package/lib/typescript/__configs__/index.d.ts +9 -9
- package/lib/typescript/__configs__/index.d.ts.map +1 -1
- package/lib/typescript/__configs__/presets.d.ts +1 -1
- package/lib/typescript/__configs__/presets.d.ts.map +1 -1
- package/lib/typescript/components/root-transition-aware.d.ts.map +1 -1
- package/lib/typescript/constants.d.ts +2 -2
- package/lib/typescript/constants.d.ts.map +1 -1
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts +1 -1
- package/lib/typescript/hooks/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +20 -18
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/integrations/blank-stack/components/Header.d.ts +5 -0
- package/lib/typescript/integrations/blank-stack/components/Header.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/components/Screens.d.ts +15 -0
- package/lib/typescript/integrations/blank-stack/components/Screens.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/components/StackView.d.ts +2 -0
- package/lib/typescript/integrations/blank-stack/components/StackView.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts +109 -0
- package/lib/typescript/integrations/blank-stack/navigators/createBlankStackNavigator.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts +8 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts +2 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts +20 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts +23 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_types.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts +3 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.d.ts +4 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts +4 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts +3 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts +3 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.d.ts.map +1 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts +6 -0
- package/lib/typescript/integrations/blank-stack/utils/with-stack-navigation/index.d.ts.map +1 -0
- package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts +1 -1
- package/lib/typescript/integrations/native-stack/navigators/createNativeStackNavigator.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts +1 -1
- package/lib/typescript/integrations/native-stack/utils/getModalRoutesKeys.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts +1 -1
- package/lib/typescript/integrations/native-stack/utils/useInvalidPreventRemoveError.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts +1 -1
- package/lib/typescript/integrations/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts +1 -1
- package/lib/typescript/integrations/native-stack/views/NativeStackView.native.d.ts.map +1 -1
- package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts +1 -1
- package/lib/typescript/integrations/native-stack/views/useHeaderConfigProps.d.ts.map +1 -1
- package/lib/typescript/providers/keys.d.ts +1 -1
- package/lib/typescript/providers/keys.d.ts.map +1 -1
- package/lib/typescript/providers/screen-transition-provider.d.ts +1 -1
- package/lib/typescript/providers/screen-transition-provider.d.ts.map +1 -1
- package/lib/typescript/providers/transition-styles.d.ts.map +1 -1
- package/lib/typescript/stores/animations.d.ts +1 -1
- package/lib/typescript/stores/animations.d.ts.map +1 -1
- package/lib/typescript/stores/bounds/index.d.ts +1 -1
- package/lib/typescript/stores/bounds/index.d.ts.map +1 -1
- package/lib/typescript/stores/gestures.d.ts +1 -1
- package/lib/typescript/stores/gestures.d.ts.map +1 -1
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts +1 -1
- package/lib/typescript/stores/utils/reset-stores-for-screen.d.ts.map +1 -1
- package/lib/typescript/types/animation.d.ts +2 -4
- package/lib/typescript/types/animation.d.ts.map +1 -1
- package/lib/typescript/types/blank-stack.navigator.d.ts +219 -0
- package/lib/typescript/types/blank-stack.navigator.d.ts.map +1 -0
- package/lib/typescript/types/bounds.d.ts +0 -57
- package/lib/typescript/types/bounds.d.ts.map +1 -1
- package/lib/typescript/types/{navigator.d.ts → native-stack.navigator.d.ts} +5 -1
- package/lib/typescript/types/native-stack.navigator.d.ts.map +1 -0
- package/lib/typescript/types/utils.d.ts.map +1 -1
- package/lib/typescript/utils/animation/derivations.d.ts +1 -4
- package/lib/typescript/utils/animation/derivations.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_types/builder.d.ts +2 -2
- package/lib/typescript/utils/bounds/_types/builder.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_utils/geometry.d.ts +2 -2
- package/lib/typescript/utils/bounds/_utils/geometry.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/_utils/styles.d.ts +2 -1
- package/lib/typescript/utils/bounds/_utils/styles.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/constants.d.ts +2 -2
- package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/index.d.ts +4 -4
- package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/apply-offset-rules.d.ts +2 -2
- package/lib/typescript/utils/gesture/apply-offset-rules.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/check-gesture-activation.d.ts +2 -2
- package/lib/typescript/utils/gesture/check-gesture-activation.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/reset-gesture-values.d.ts.map +1 -1
- package/lib/typescript/utils/gesture/velocity.d.ts +1 -1
- package/lib/typescript/utils/gesture/velocity.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__configs__/presets.ts +590 -590
- package/src/components/root-transition-aware.tsx +27 -27
- package/src/constants.ts +47 -47
- package/src/hooks/animation/use-screen-animation.tsx +52 -47
- package/src/index.ts +33 -22
- package/src/integrations/blank-stack/components/Header.tsx +143 -0
- package/src/integrations/blank-stack/components/Screens.tsx +96 -0
- package/src/integrations/blank-stack/components/StackView.tsx +106 -0
- package/src/integrations/blank-stack/navigators/createBlankStackNavigator.tsx +122 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-closing-route-keys.tsx +62 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-previous.tsx +11 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_hooks/use-stack-navigation-state.tsx +280 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_types.ts +36 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/are-descriptors-equal.ts +15 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/calculateActiveScreensLimit.ts +29 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/compose-descriptors.ts +17 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/have-same-route-keys.ts +12 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/_utils/routes-are-identical.ts +11 -0
- package/src/integrations/blank-stack/utils/with-stack-navigation/index.tsx +93 -0
- package/src/integrations/native-stack/navigators/createNativeStackNavigator.tsx +95 -95
- package/src/integrations/native-stack/utils/getModalRoutesKeys.ts +14 -14
- package/src/integrations/native-stack/utils/useInvalidPreventRemoveError.tsx +23 -23
- package/src/integrations/native-stack/views/NativeStackView.native.tsx +608 -608
- package/src/integrations/native-stack/views/NativeStackView.tsx +188 -188
- package/src/integrations/native-stack/views/useHeaderConfigProps.tsx +260 -260
- package/src/providers/keys.tsx +22 -22
- package/src/providers/screen-transition-provider.tsx +20 -20
- package/src/providers/transition-styles.tsx +24 -11
- package/src/stores/animations.ts +23 -23
- package/src/stores/bounds/index.ts +82 -82
- package/src/stores/gestures.ts +36 -36
- package/src/stores/utils/reset-stores-for-screen.ts +4 -4
- package/src/types/animation.ts +2 -4
- package/src/types/blank-stack.navigator.ts +271 -0
- package/src/types/bounds.ts +0 -64
- package/src/types/{navigator.ts → native-stack.navigator.ts} +5 -0
- package/src/types/utils.ts +1 -0
- package/src/utils/animation/derivations.ts +3 -20
- package/src/utils/bounds/_types/builder.ts +111 -111
- package/src/utils/bounds/_utils/geometry.ts +2 -2
- package/src/utils/bounds/_utils/styles.ts +2 -1
- package/src/utils/bounds/constants.ts +29 -29
- package/src/utils/bounds/index.ts +35 -105
- package/src/utils/gesture/apply-offset-rules.ts +271 -271
- package/src/utils/gesture/check-gesture-activation.ts +260 -260
- package/src/utils/gesture/reset-gesture-values.ts +1 -0
- package/src/utils/gesture/velocity.ts +1 -2
- package/lib/module/types/navigator.js +0 -4
- package/lib/typescript/types/navigator.d.ts.map +0 -1
|
@@ -2,294 +2,294 @@ import { getHeaderTitle, HeaderTitle } from "@react-navigation/elements";
|
|
|
2
2
|
import { type Route, useLocale, useTheme } from "@react-navigation/native";
|
|
3
3
|
import { Platform, StyleSheet, type TextStyle, View } from "react-native";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
isSearchBarAvailableForCurrentPlatform,
|
|
6
|
+
ScreenStackHeaderBackButtonImage,
|
|
7
|
+
ScreenStackHeaderCenterView,
|
|
8
|
+
ScreenStackHeaderLeftView,
|
|
9
|
+
ScreenStackHeaderRightView,
|
|
10
|
+
ScreenStackHeaderSearchBarView,
|
|
11
|
+
SearchBar,
|
|
12
12
|
} from "react-native-screens";
|
|
13
13
|
|
|
14
|
-
import type { NativeStackNavigationOptions } from "../../../types/navigator";
|
|
14
|
+
import type { NativeStackNavigationOptions } from "../../../types/native-stack.navigator";
|
|
15
15
|
import { processFonts } from "./FontProcessor";
|
|
16
16
|
|
|
17
17
|
type Props = NativeStackNavigationOptions & {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
headerTopInsetEnabled: boolean;
|
|
19
|
+
headerHeight: number;
|
|
20
|
+
headerBack: { title?: string | undefined; href: undefined } | undefined;
|
|
21
|
+
route: Route<string>;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export function useHeaderConfigProps({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
25
|
+
headerBackImageSource,
|
|
26
|
+
headerBackButtonDisplayMode,
|
|
27
|
+
headerBackButtonMenuEnabled,
|
|
28
|
+
headerBackTitle,
|
|
29
|
+
headerBackTitleStyle,
|
|
30
|
+
headerBackVisible,
|
|
31
|
+
headerShadowVisible,
|
|
32
|
+
headerLargeStyle,
|
|
33
|
+
headerLargeTitle,
|
|
34
|
+
headerLargeTitleShadowVisible,
|
|
35
|
+
headerLargeTitleStyle,
|
|
36
|
+
headerBackground,
|
|
37
|
+
headerLeft,
|
|
38
|
+
headerRight,
|
|
39
|
+
headerShown,
|
|
40
|
+
headerStyle,
|
|
41
|
+
headerBlurEffect,
|
|
42
|
+
headerTintColor,
|
|
43
|
+
headerTitle,
|
|
44
|
+
headerTitleAlign,
|
|
45
|
+
headerTitleStyle,
|
|
46
|
+
headerTransparent,
|
|
47
|
+
headerSearchBarOptions,
|
|
48
|
+
headerTopInsetEnabled,
|
|
49
|
+
headerBack,
|
|
50
|
+
route,
|
|
51
|
+
title,
|
|
52
52
|
}: Props) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
const { direction } = useLocale();
|
|
54
|
+
const { colors, fonts } = useTheme();
|
|
55
|
+
const tintColor =
|
|
56
|
+
headerTintColor ?? (Platform.OS === "ios" ? colors.primary : colors.text);
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
58
|
+
const headerBackTitleStyleFlattened =
|
|
59
|
+
StyleSheet.flatten([fonts.regular, headerBackTitleStyle]) || {};
|
|
60
|
+
const headerLargeTitleStyleFlattened =
|
|
61
|
+
StyleSheet.flatten([
|
|
62
|
+
Platform.select({ ios: fonts.heavy, default: fonts.medium }),
|
|
63
|
+
headerLargeTitleStyle,
|
|
64
|
+
]) || {};
|
|
65
|
+
const headerTitleStyleFlattened =
|
|
66
|
+
StyleSheet.flatten([
|
|
67
|
+
Platform.select({ ios: fonts.bold, default: fonts.medium }),
|
|
68
|
+
headerTitleStyle,
|
|
69
|
+
]) || {};
|
|
70
|
+
const headerStyleFlattened = StyleSheet.flatten(headerStyle) || {};
|
|
71
|
+
const headerLargeStyleFlattened = StyleSheet.flatten(headerLargeStyle) || {};
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] =
|
|
74
|
+
processFonts([
|
|
75
|
+
headerBackTitleStyleFlattened.fontFamily,
|
|
76
|
+
headerLargeTitleStyleFlattened.fontFamily,
|
|
77
|
+
headerTitleStyleFlattened.fontFamily,
|
|
78
|
+
]);
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
const backTitleFontSize =
|
|
81
|
+
"fontSize" in headerBackTitleStyleFlattened
|
|
82
|
+
? headerBackTitleStyleFlattened.fontSize
|
|
83
|
+
: undefined;
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
const titleText = getHeaderTitle({ title, headerTitle }, route.name);
|
|
86
|
+
const titleColor =
|
|
87
|
+
"color" in headerTitleStyleFlattened
|
|
88
|
+
? headerTitleStyleFlattened.color
|
|
89
|
+
: headerTintColor ?? colors.text;
|
|
90
|
+
const titleFontSize =
|
|
91
|
+
"fontSize" in headerTitleStyleFlattened
|
|
92
|
+
? headerTitleStyleFlattened.fontSize
|
|
93
|
+
: undefined;
|
|
94
|
+
const titleFontWeight = headerTitleStyleFlattened.fontWeight;
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
const largeTitleBackgroundColor = headerLargeStyleFlattened.backgroundColor;
|
|
97
|
+
const largeTitleColor =
|
|
98
|
+
"color" in headerLargeTitleStyleFlattened
|
|
99
|
+
? headerLargeTitleStyleFlattened.color
|
|
100
|
+
: undefined;
|
|
101
|
+
const largeTitleFontSize =
|
|
102
|
+
"fontSize" in headerLargeTitleStyleFlattened
|
|
103
|
+
? headerLargeTitleStyleFlattened.fontSize
|
|
104
|
+
: undefined;
|
|
105
|
+
const largeTitleFontWeight = headerLargeTitleStyleFlattened.fontWeight;
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
const headerTitleStyleSupported: TextStyle = { color: titleColor };
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
if (headerTitleStyleFlattened.fontFamily != null) {
|
|
110
|
+
headerTitleStyleSupported.fontFamily = headerTitleStyleFlattened.fontFamily;
|
|
111
|
+
}
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
if (titleFontSize != null) {
|
|
114
|
+
headerTitleStyleSupported.fontSize = titleFontSize;
|
|
115
|
+
}
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
if (titleFontWeight != null) {
|
|
118
|
+
headerTitleStyleSupported.fontWeight = titleFontWeight;
|
|
119
|
+
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
const headerBackgroundColor =
|
|
122
|
+
headerStyleFlattened.backgroundColor ??
|
|
123
|
+
(headerBackground != null || headerTransparent
|
|
124
|
+
? "transparent"
|
|
125
|
+
: colors.card);
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
const canGoBack = headerBack != null;
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
const headerLeftElement = headerLeft?.({
|
|
130
|
+
tintColor,
|
|
131
|
+
canGoBack,
|
|
132
|
+
label: headerBackTitle ?? headerBack?.title,
|
|
133
|
+
// `href` is only applicable to web
|
|
134
|
+
href: undefined,
|
|
135
|
+
});
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
const headerRightElement = headerRight?.({
|
|
138
|
+
tintColor,
|
|
139
|
+
canGoBack,
|
|
140
|
+
});
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
const headerTitleElement =
|
|
143
|
+
typeof headerTitle === "function"
|
|
144
|
+
? headerTitle({
|
|
145
|
+
tintColor,
|
|
146
|
+
children: titleText,
|
|
147
|
+
})
|
|
148
|
+
: null;
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
const hasHeaderSearchBar =
|
|
151
|
+
isSearchBarAvailableForCurrentPlatform && headerSearchBarOptions != null;
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
153
|
+
/**
|
|
154
|
+
* We need to set this in if:
|
|
155
|
+
* - Back button should stay visible when `headerLeft` is specified
|
|
156
|
+
* - If `headerTitle` for Android is specified, so we only need to remove the title and keep the back button
|
|
157
|
+
*/
|
|
158
|
+
const backButtonInCustomView =
|
|
159
|
+
headerBackVisible ||
|
|
160
|
+
(Platform.OS === "android" &&
|
|
161
|
+
headerTitleElement != null &&
|
|
162
|
+
headerLeftElement == null);
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
const translucent =
|
|
165
|
+
headerBackground != null ||
|
|
166
|
+
headerTransparent ||
|
|
167
|
+
// When using a SearchBar or large title, the header needs to be translucent for it to work on iOS
|
|
168
|
+
((hasHeaderSearchBar || headerLargeTitle) &&
|
|
169
|
+
Platform.OS === "ios" &&
|
|
170
|
+
headerTransparent !== false);
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
const isBackButtonDisplayModeAvailable =
|
|
173
|
+
// On iOS 14+
|
|
174
|
+
Platform.OS === "ios" &&
|
|
175
|
+
parseInt(Platform.Version, 10) >= 14 &&
|
|
176
|
+
// Doesn't have custom styling, by default System, see: https://github.com/software-mansion/react-native-screens/pull/2105#discussion_r1565222738
|
|
177
|
+
(backTitleFontFamily == null || backTitleFontFamily === "System") &&
|
|
178
|
+
backTitleFontSize == null &&
|
|
179
|
+
// Back button menu is not disabled
|
|
180
|
+
headerBackButtonMenuEnabled !== false;
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
const isCenterViewRenderedAndroid = headerTitleAlign === "center";
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
184
|
+
const children = (
|
|
185
|
+
<>
|
|
186
|
+
{Platform.OS === "ios" ? (
|
|
187
|
+
<>
|
|
188
|
+
{headerLeftElement != null ? (
|
|
189
|
+
<ScreenStackHeaderLeftView>
|
|
190
|
+
{headerLeftElement}
|
|
191
|
+
</ScreenStackHeaderLeftView>
|
|
192
|
+
) : null}
|
|
193
|
+
{headerTitleElement != null ? (
|
|
194
|
+
<ScreenStackHeaderCenterView>
|
|
195
|
+
{headerTitleElement}
|
|
196
|
+
</ScreenStackHeaderCenterView>
|
|
197
|
+
) : null}
|
|
198
|
+
</>
|
|
199
|
+
) : (
|
|
200
|
+
<>
|
|
201
|
+
{headerLeftElement != null || typeof headerTitle === "function" ? (
|
|
202
|
+
// The style passed to header left, together with title element being wrapped
|
|
203
|
+
// in flex view is reqruied for proper header layout, in particular,
|
|
204
|
+
// for the text truncation to work.
|
|
205
|
+
<ScreenStackHeaderLeftView
|
|
206
|
+
style={!isCenterViewRenderedAndroid ? { flex: 1 } : null}
|
|
207
|
+
>
|
|
208
|
+
{headerLeftElement}
|
|
209
|
+
{headerTitleAlign !== "center" ? (
|
|
210
|
+
typeof headerTitle === "function" ? (
|
|
211
|
+
<View style={{ flex: 1 }}>{headerTitleElement}</View>
|
|
212
|
+
) : (
|
|
213
|
+
<View style={{ flex: 1 }}>
|
|
214
|
+
<HeaderTitle
|
|
215
|
+
tintColor={tintColor}
|
|
216
|
+
style={headerTitleStyleSupported}
|
|
217
|
+
>
|
|
218
|
+
{titleText}
|
|
219
|
+
</HeaderTitle>
|
|
220
|
+
</View>
|
|
221
|
+
)
|
|
222
|
+
) : null}
|
|
223
|
+
</ScreenStackHeaderLeftView>
|
|
224
|
+
) : null}
|
|
225
|
+
{isCenterViewRenderedAndroid ? (
|
|
226
|
+
<ScreenStackHeaderCenterView>
|
|
227
|
+
{typeof headerTitle === "function" ? (
|
|
228
|
+
headerTitleElement
|
|
229
|
+
) : (
|
|
230
|
+
<HeaderTitle
|
|
231
|
+
tintColor={tintColor}
|
|
232
|
+
style={headerTitleStyleSupported}
|
|
233
|
+
>
|
|
234
|
+
{titleText}
|
|
235
|
+
</HeaderTitle>
|
|
236
|
+
)}
|
|
237
|
+
</ScreenStackHeaderCenterView>
|
|
238
|
+
) : null}
|
|
239
|
+
</>
|
|
240
|
+
)}
|
|
241
|
+
{headerBackImageSource !== undefined ? (
|
|
242
|
+
<ScreenStackHeaderBackButtonImage source={headerBackImageSource} />
|
|
243
|
+
) : null}
|
|
244
|
+
{headerRightElement != null ? (
|
|
245
|
+
<ScreenStackHeaderRightView>
|
|
246
|
+
{headerRightElement}
|
|
247
|
+
</ScreenStackHeaderRightView>
|
|
248
|
+
) : null}
|
|
249
|
+
{hasHeaderSearchBar ? (
|
|
250
|
+
<ScreenStackHeaderSearchBarView>
|
|
251
|
+
<SearchBar {...headerSearchBarOptions} />
|
|
252
|
+
</ScreenStackHeaderSearchBarView>
|
|
253
|
+
) : null}
|
|
254
|
+
</>
|
|
255
|
+
);
|
|
256
256
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
257
|
+
return {
|
|
258
|
+
backButtonInCustomView,
|
|
259
|
+
backgroundColor: headerBackgroundColor,
|
|
260
|
+
backTitle: headerBackTitle,
|
|
261
|
+
backTitleVisible: isBackButtonDisplayModeAvailable
|
|
262
|
+
? undefined
|
|
263
|
+
: headerBackButtonDisplayMode !== "minimal",
|
|
264
|
+
backButtonDisplayMode: isBackButtonDisplayModeAvailable
|
|
265
|
+
? headerBackButtonDisplayMode
|
|
266
|
+
: undefined,
|
|
267
|
+
backTitleFontFamily,
|
|
268
|
+
backTitleFontSize,
|
|
269
|
+
blurEffect: headerBlurEffect,
|
|
270
|
+
color: tintColor,
|
|
271
|
+
direction,
|
|
272
|
+
disableBackButtonMenu: headerBackButtonMenuEnabled === false,
|
|
273
|
+
hidden: headerShown === false,
|
|
274
|
+
hideBackButton: headerBackVisible === false,
|
|
275
|
+
hideShadow:
|
|
276
|
+
headerShadowVisible === false ||
|
|
277
|
+
headerBackground != null ||
|
|
278
|
+
(headerTransparent && headerShadowVisible !== true),
|
|
279
|
+
largeTitle: headerLargeTitle,
|
|
280
|
+
largeTitleBackgroundColor,
|
|
281
|
+
largeTitleColor,
|
|
282
|
+
largeTitleFontFamily,
|
|
283
|
+
largeTitleFontSize,
|
|
284
|
+
largeTitleFontWeight,
|
|
285
|
+
largeTitleHideShadow: headerLargeTitleShadowVisible === false,
|
|
286
|
+
title: titleText,
|
|
287
|
+
titleColor,
|
|
288
|
+
titleFontFamily,
|
|
289
|
+
titleFontSize,
|
|
290
|
+
titleFontWeight: String(titleFontWeight),
|
|
291
|
+
topInsetEnabled: headerTopInsetEnabled,
|
|
292
|
+
translucent: translucent === true,
|
|
293
|
+
children,
|
|
294
|
+
} as const;
|
|
295
295
|
}
|
package/src/providers/keys.tsx
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { createContext, useContext, useMemo } from "react";
|
|
2
|
-
import type { NativeStackDescriptor } from "../types/navigator";
|
|
2
|
+
import type { NativeStackDescriptor } from "../types/native-stack.navigator";
|
|
3
3
|
|
|
4
4
|
interface KeysContextType {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
previous?: NativeStackDescriptor;
|
|
6
|
+
current: NativeStackDescriptor;
|
|
7
|
+
next?: NativeStackDescriptor;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const KeysContext = createContext<KeysContextType | undefined>(undefined);
|
|
11
11
|
|
|
12
12
|
interface KeysProviderProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
previous?: NativeStackDescriptor;
|
|
15
|
+
current: NativeStackDescriptor;
|
|
16
|
+
next?: NativeStackDescriptor;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const KeysProvider = ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
children,
|
|
21
|
+
previous,
|
|
22
|
+
current,
|
|
23
|
+
next,
|
|
24
24
|
}: KeysProviderProps) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const value = useMemo(
|
|
26
|
+
() => ({ previous, current, next }),
|
|
27
|
+
[previous, current, next]
|
|
28
|
+
);
|
|
29
|
+
return <KeysContext.Provider value={value}>{children}</KeysContext.Provider>;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const useKeys = (): KeysContextType => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
const context = useContext(KeysContext);
|
|
34
|
+
if (context === undefined) {
|
|
35
|
+
throw new Error("useKeys must be used within a KeysProvider");
|
|
36
|
+
}
|
|
37
|
+
return context;
|
|
38
38
|
};
|