react-native-screen-transitions 2.4.1 → 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/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/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/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/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/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/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/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/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/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/lib/module/types/navigator.js +0 -4
- package/lib/typescript/types/navigator.d.ts.map +0 -1
|
@@ -1,312 +1,312 @@
|
|
|
1
|
-
import type { ScaledSize } from "react-native";
|
|
2
1
|
import type { GestureStateManagerType } from "react-native-gesture-handler/lib/typescript/handlers/gestures/gestureStateManager";
|
|
3
2
|
import type { SharedValue } from "react-native-reanimated";
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
DEFAULT_ACTIVATION_AREA,
|
|
5
|
+
DEFAULT_EDGE_DISTANCE_HORIZONTAL,
|
|
6
|
+
DEFAULT_EDGE_DISTANCE_VERTICAL,
|
|
7
|
+
GESTURE_ACTIVATION_THRESHOLD_X,
|
|
8
|
+
GESTURE_ACTIVATION_THRESHOLD_Y,
|
|
9
|
+
GESTURE_FAIL_TOLERANCE_X,
|
|
10
|
+
GESTURE_FAIL_TOLERANCE_Y,
|
|
12
11
|
} from "../../constants";
|
|
13
12
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type ActivationArea,
|
|
14
|
+
type GestureActivationArea,
|
|
15
|
+
GestureOffsetState,
|
|
16
|
+
type SideActivation,
|
|
18
17
|
} from "../../types/gesture";
|
|
18
|
+
import type { Layout } from "../../types/native-stack.navigator";
|
|
19
19
|
|
|
20
20
|
type Directions = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
vertical: boolean;
|
|
22
|
+
verticalInverted: boolean;
|
|
23
|
+
horizontal: boolean;
|
|
24
|
+
horizontalInverted: boolean;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
interface CheckGestureActivationProps {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
initialTouch: { x: number; y: number };
|
|
29
|
+
touch: { x: number; y: number };
|
|
30
|
+
directions: Directions;
|
|
31
|
+
manager?: GestureStateManagerType;
|
|
32
|
+
gestureOffsetState: SharedValue<GestureOffsetState>;
|
|
33
|
+
activationArea?: GestureActivationArea;
|
|
34
|
+
dimensions: Layout;
|
|
35
|
+
responseDistance?: number;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
type NormalizedSides = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
left: ActivationArea;
|
|
40
|
+
right: ActivationArea;
|
|
41
|
+
top: ActivationArea;
|
|
42
|
+
bottom: ActivationArea;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
interface ShouldActivateOrFailProps {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
deltaX: number;
|
|
47
|
+
deltaY: number;
|
|
48
|
+
hasHorizontal: boolean;
|
|
49
|
+
hasVertical: boolean;
|
|
50
|
+
isHorizontalSwipe: boolean;
|
|
51
|
+
isVerticalSwipe: boolean;
|
|
52
|
+
allowedRight: boolean;
|
|
53
|
+
allowedLeft: boolean;
|
|
54
|
+
allowedUp: boolean;
|
|
55
|
+
allowedDown: boolean;
|
|
56
|
+
horizontalGateRight: boolean;
|
|
57
|
+
horizontalGateLeft: boolean;
|
|
58
|
+
verticalGateUp: boolean;
|
|
59
|
+
verticalGateDown: boolean;
|
|
60
|
+
isSwipingRight: boolean;
|
|
61
|
+
isSwipingLeft: boolean;
|
|
62
|
+
isSwipingUp: boolean;
|
|
63
|
+
isSwipingDown: boolean;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
interface ReturnValues {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
isSwipingDown: boolean;
|
|
68
|
+
isSwipingUp: boolean;
|
|
69
|
+
isSwipingRight: boolean;
|
|
70
|
+
isSwipingLeft: boolean;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function normalizeSides(area?: GestureActivationArea): NormalizedSides {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
"worklet";
|
|
75
|
+
if (!area || typeof area === "string") {
|
|
76
|
+
const mode: ActivationArea = area ?? DEFAULT_ACTIVATION_AREA;
|
|
77
|
+
return { left: mode, right: mode, top: mode, bottom: mode };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const s: SideActivation = area as SideActivation;
|
|
81
|
+
return {
|
|
82
|
+
left: s.left ?? DEFAULT_ACTIVATION_AREA,
|
|
83
|
+
right: s.right ?? DEFAULT_ACTIVATION_AREA,
|
|
84
|
+
top: s.top ?? DEFAULT_ACTIVATION_AREA,
|
|
85
|
+
bottom: s.bottom ?? DEFAULT_ACTIVATION_AREA,
|
|
86
|
+
};
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
function computeEdgeConstraints(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
initialTouch: { x: number; y: number },
|
|
91
|
+
dimensions: Layout,
|
|
92
|
+
sides: NormalizedSides,
|
|
93
|
+
responseDistance?: number
|
|
94
94
|
) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
"worklet";
|
|
96
|
+
const xDist = responseDistance ?? DEFAULT_EDGE_DISTANCE_HORIZONTAL;
|
|
97
|
+
const yDist = responseDistance ?? DEFAULT_EDGE_DISTANCE_VERTICAL;
|
|
98
|
+
|
|
99
|
+
const horizontalRight = sides.left === "screen" || initialTouch.x <= xDist; // right swipe checks left edge
|
|
100
|
+
const horizontalLeft =
|
|
101
|
+
sides.right === "screen" || initialTouch.x >= dimensions.width - xDist; // left swipe checks right edge
|
|
102
|
+
const verticalDown = sides.top === "screen" || initialTouch.y <= yDist; // down swipe checks top edge
|
|
103
|
+
const verticalUp =
|
|
104
|
+
sides.bottom === "screen" || initialTouch.y >= dimensions.height - yDist; // up swipe checks bottom edge
|
|
105
|
+
|
|
106
|
+
return { horizontalRight, horizontalLeft, verticalDown, verticalUp } as const;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
function calculateSwipeDirs(deltaX: number, deltaY: number) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
110
|
+
"worklet";
|
|
111
|
+
|
|
112
|
+
const isVerticalSwipe = Math.abs(deltaY) > Math.abs(deltaX);
|
|
113
|
+
const isHorizontalSwipe = Math.abs(deltaX) > Math.abs(deltaY);
|
|
114
|
+
|
|
115
|
+
const isSwipingDown = isVerticalSwipe && deltaY > 0;
|
|
116
|
+
const isSwipingUp = isVerticalSwipe && deltaY < 0;
|
|
117
|
+
const isSwipingRight = isHorizontalSwipe && deltaX > 0;
|
|
118
|
+
const isSwipingLeft = isHorizontalSwipe && deltaX < 0;
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
isSwipingDown,
|
|
122
|
+
isSwipingUp,
|
|
123
|
+
isSwipingRight,
|
|
124
|
+
isSwipingLeft,
|
|
125
|
+
isVerticalSwipe,
|
|
126
|
+
isHorizontalSwipe,
|
|
127
|
+
};
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
function shouldActivateOrFail(params: ShouldActivateOrFailProps) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
131
|
+
"worklet";
|
|
132
|
+
|
|
133
|
+
const {
|
|
134
|
+
deltaX,
|
|
135
|
+
deltaY,
|
|
136
|
+
hasHorizontal,
|
|
137
|
+
hasVertical,
|
|
138
|
+
isHorizontalSwipe,
|
|
139
|
+
isVerticalSwipe,
|
|
140
|
+
allowedRight,
|
|
141
|
+
allowedLeft,
|
|
142
|
+
allowedUp,
|
|
143
|
+
allowedDown,
|
|
144
|
+
horizontalGateRight,
|
|
145
|
+
horizontalGateLeft,
|
|
146
|
+
verticalGateUp,
|
|
147
|
+
verticalGateDown,
|
|
148
|
+
isSwipingRight,
|
|
149
|
+
isSwipingLeft,
|
|
150
|
+
isSwipingUp,
|
|
151
|
+
isSwipingDown,
|
|
152
|
+
} = params;
|
|
153
|
+
|
|
154
|
+
let shouldActivate = false;
|
|
155
|
+
let shouldFail = false;
|
|
156
|
+
|
|
157
|
+
if (hasHorizontal && isHorizontalSwipe) {
|
|
158
|
+
const hasEnoughHorizontalMovement =
|
|
159
|
+
Math.abs(deltaX) >= GESTURE_ACTIVATION_THRESHOLD_X;
|
|
160
|
+
|
|
161
|
+
const hasAcceptableVerticalDeviation =
|
|
162
|
+
Math.abs(deltaY) <= GESTURE_FAIL_TOLERANCE_X;
|
|
163
|
+
|
|
164
|
+
if (hasEnoughHorizontalMovement && hasAcceptableVerticalDeviation) {
|
|
165
|
+
const rightOk = isSwipingRight && allowedRight && horizontalGateRight;
|
|
166
|
+
const leftOk = isSwipingLeft && allowedLeft && horizontalGateLeft;
|
|
167
|
+
if (rightOk || leftOk) {
|
|
168
|
+
shouldActivate = true;
|
|
169
|
+
}
|
|
170
|
+
} else if (!hasAcceptableVerticalDeviation) {
|
|
171
|
+
shouldFail = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (hasVertical && isVerticalSwipe) {
|
|
176
|
+
const hasEnoughVerticalMovement =
|
|
177
|
+
Math.abs(deltaY) >= GESTURE_ACTIVATION_THRESHOLD_Y;
|
|
178
|
+
const hasAcceptableHorizontalDeviation =
|
|
179
|
+
Math.abs(deltaX) <= GESTURE_FAIL_TOLERANCE_Y;
|
|
180
|
+
|
|
181
|
+
if (hasEnoughVerticalMovement && hasAcceptableHorizontalDeviation) {
|
|
182
|
+
const upOk = isSwipingUp && allowedUp && verticalGateUp;
|
|
183
|
+
const downOk = isSwipingDown && allowedDown && verticalGateDown;
|
|
184
|
+
if (upOk || downOk) {
|
|
185
|
+
shouldActivate = true;
|
|
186
|
+
}
|
|
187
|
+
} else if (!hasAcceptableHorizontalDeviation) {
|
|
188
|
+
shouldFail = true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (hasHorizontal && isHorizontalSwipe) {
|
|
193
|
+
if ((isSwipingLeft && !allowedLeft) || (isSwipingRight && !allowedRight)) {
|
|
194
|
+
shouldFail = true;
|
|
195
|
+
}
|
|
196
|
+
// If gating prohibits the dominant horizontal swipe, fail early
|
|
197
|
+
if (
|
|
198
|
+
(isSwipingRight && allowedRight && !horizontalGateRight) ||
|
|
199
|
+
(isSwipingLeft && allowedLeft && !horizontalGateLeft)
|
|
200
|
+
) {
|
|
201
|
+
shouldFail = true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (hasVertical && isVerticalSwipe) {
|
|
206
|
+
if ((isSwipingUp && !allowedUp) || (isSwipingDown && !allowedDown)) {
|
|
207
|
+
shouldFail = true;
|
|
208
|
+
}
|
|
209
|
+
// If gating prohibits the dominant vertical swipe, fail early
|
|
210
|
+
if (
|
|
211
|
+
(isSwipingUp && allowedUp && !verticalGateUp) ||
|
|
212
|
+
(isSwipingDown && allowedDown && !verticalGateDown)
|
|
213
|
+
) {
|
|
214
|
+
shouldFail = true;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return { shouldActivate, shouldFail };
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
222
|
* Since we're using onTouchesMove to activate our pan, faillOffset and activateOffset don't actually work. In that case we'll create this function to use in onTouchesMove which acts simarly to the original functionality.
|
|
223
223
|
*/
|
|
224
224
|
export const applyOffsetRules = ({
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
initialTouch,
|
|
226
|
+
touch,
|
|
227
|
+
directions,
|
|
228
|
+
manager,
|
|
229
|
+
gestureOffsetState,
|
|
230
|
+
activationArea,
|
|
231
|
+
dimensions,
|
|
232
|
+
responseDistance,
|
|
233
233
|
}: CheckGestureActivationProps): ReturnValues => {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
234
|
+
"worklet";
|
|
235
|
+
|
|
236
|
+
const deltaX = touch.x - initialTouch.x;
|
|
237
|
+
const deltaY = touch.y - initialTouch.y;
|
|
238
|
+
|
|
239
|
+
const allowedDown = directions.vertical;
|
|
240
|
+
const allowedUp = directions.verticalInverted;
|
|
241
|
+
const allowedRight = directions.horizontal;
|
|
242
|
+
const allowedLeft = directions.horizontalInverted;
|
|
243
|
+
|
|
244
|
+
const hasHorizontal = allowedLeft || allowedRight;
|
|
245
|
+
const hasVertical = allowedUp || allowedDown;
|
|
246
|
+
|
|
247
|
+
const {
|
|
248
|
+
isSwipingDown,
|
|
249
|
+
isSwipingUp,
|
|
250
|
+
isSwipingRight,
|
|
251
|
+
isSwipingLeft,
|
|
252
|
+
isVerticalSwipe,
|
|
253
|
+
isHorizontalSwipe,
|
|
254
|
+
} = calculateSwipeDirs(deltaX, deltaY);
|
|
255
|
+
|
|
256
|
+
// avoid re-running the function if the activation state is already set
|
|
257
|
+
if (
|
|
258
|
+
gestureOffsetState.value === GestureOffsetState.PASSED ||
|
|
259
|
+
gestureOffsetState.value === GestureOffsetState.FAILED
|
|
260
|
+
) {
|
|
261
|
+
return {
|
|
262
|
+
isSwipingDown,
|
|
263
|
+
isSwipingUp,
|
|
264
|
+
isSwipingRight,
|
|
265
|
+
isSwipingLeft,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const sides = normalizeSides(activationArea);
|
|
270
|
+
|
|
271
|
+
const {
|
|
272
|
+
horizontalRight: horizontalGateRight,
|
|
273
|
+
horizontalLeft: horizontalGateLeft,
|
|
274
|
+
verticalDown: verticalGateDown,
|
|
275
|
+
verticalUp: verticalGateUp,
|
|
276
|
+
} = computeEdgeConstraints(initialTouch, dimensions, sides, responseDistance);
|
|
277
|
+
|
|
278
|
+
const { shouldActivate, shouldFail } = shouldActivateOrFail({
|
|
279
|
+
deltaX,
|
|
280
|
+
deltaY,
|
|
281
|
+
hasHorizontal,
|
|
282
|
+
hasVertical,
|
|
283
|
+
isHorizontalSwipe,
|
|
284
|
+
isVerticalSwipe,
|
|
285
|
+
allowedRight,
|
|
286
|
+
allowedLeft,
|
|
287
|
+
allowedUp,
|
|
288
|
+
allowedDown,
|
|
289
|
+
horizontalGateRight,
|
|
290
|
+
horizontalGateLeft,
|
|
291
|
+
verticalGateUp,
|
|
292
|
+
verticalGateDown,
|
|
293
|
+
isSwipingRight,
|
|
294
|
+
isSwipingLeft,
|
|
295
|
+
isSwipingUp,
|
|
296
|
+
isSwipingDown,
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
if (shouldActivate) {
|
|
300
|
+
gestureOffsetState.value = GestureOffsetState.PASSED;
|
|
301
|
+
} else if (shouldFail) {
|
|
302
|
+
gestureOffsetState.value = GestureOffsetState.FAILED;
|
|
303
|
+
manager?.fail();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
isSwipingDown,
|
|
308
|
+
isSwipingUp,
|
|
309
|
+
isSwipingRight,
|
|
310
|
+
isSwipingLeft,
|
|
311
|
+
};
|
|
312
312
|
};
|