react-native-screen-transitions 3.3.0-beta.1 → 3.3.0-beta.3
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/shared/animation/snap-to.js +67 -0
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -0
- package/lib/commonjs/shared/components/screen-container.js +10 -4
- package/lib/commonjs/shared/components/screen-container.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js +4 -2
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-screen-state.js +2 -33
- package/lib/commonjs/shared/hooks/navigation/use-screen-state.js.map +1 -1
- package/lib/commonjs/shared/index.js +7 -0
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures.provider.js +1 -20
- package/lib/commonjs/shared/providers/gestures.provider.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +2 -1
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +3 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +64 -0
- package/lib/module/shared/animation/snap-to.js.map +1 -0
- package/lib/module/shared/components/screen-container.js +10 -4
- package/lib/module/shared/components/screen-container.js.map +1 -1
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js +4 -2
- package/lib/module/shared/hooks/gestures/use-screen-gesture-handlers.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-screen-state.js +4 -35
- package/lib/module/shared/hooks/navigation/use-screen-state.js.map +1 -1
- package/lib/module/shared/index.js +1 -0
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/gestures.provider.js +1 -20
- package/lib/module/shared/providers/gestures.provider.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +2 -1
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +3 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/typescript/shared/animation/snap-to.d.ts +18 -0
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -0
- package/lib/typescript/shared/components/screen-container.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts +0 -7
- package/lib/typescript/shared/hooks/navigation/use-screen-state.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +1 -0
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures.provider.d.ts +1 -1
- package/lib/typescript/shared/providers/gestures.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +1 -0
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/animation/snap-to.ts +67 -0
- package/src/shared/components/screen-container.tsx +11 -6
- package/src/shared/hooks/gestures/use-screen-gesture-handlers.ts +6 -2
- package/src/shared/hooks/navigation/use-screen-state.tsx +2 -59
- package/src/shared/index.ts +1 -0
- package/src/shared/providers/gestures.provider.tsx +2 -20
- package/src/shared/stores/animation.store.ts +2 -0
- package/src/shared/utils/animation/animate-to-progress.ts +3 -1
package/src/shared/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export default {
|
|
|
18
18
|
Specs,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
export { snapTo } from "./animation/snap-to";
|
|
21
22
|
export { useScreenAnimation } from "./hooks/animation/use-screen-animation";
|
|
22
23
|
export { useScreenGesture } from "./hooks/gestures/use-screen-gesture";
|
|
23
24
|
export { useHistory } from "./hooks/navigation/use-history";
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
GestureDetector,
|
|
4
|
-
type GestureType,
|
|
5
|
-
} from "react-native-gesture-handler";
|
|
1
|
+
import type { GestureType } from "react-native-gesture-handler";
|
|
6
2
|
import type { SharedValue } from "react-native-reanimated";
|
|
7
3
|
import { useSharedValue } from "react-native-reanimated";
|
|
8
4
|
import { useBuildGestures } from "../hooks/gestures/use-build-gestures";
|
|
9
|
-
import { useBackdropPointerEvents } from "../hooks/use-backdrop-pointer-events";
|
|
10
5
|
import type { GestureStoreMap } from "../stores/gesture.store";
|
|
11
6
|
import createProvider from "../utils/create-provider";
|
|
12
7
|
import { useKeys } from "./screen/keys.provider";
|
|
@@ -45,7 +40,6 @@ export const {
|
|
|
45
40
|
const { current } = useKeys();
|
|
46
41
|
const ancestorContext = useGestureContext();
|
|
47
42
|
const scrollConfig = useSharedValue<ScrollConfig | null>(null);
|
|
48
|
-
const { pointerEvents } = useBackdropPointerEvents();
|
|
49
43
|
|
|
50
44
|
const hasGestures = current.options.gestureEnabled === true;
|
|
51
45
|
|
|
@@ -67,18 +61,6 @@ export const {
|
|
|
67
61
|
|
|
68
62
|
return {
|
|
69
63
|
value,
|
|
70
|
-
children
|
|
71
|
-
<GestureDetector gesture={panGesture}>
|
|
72
|
-
<View style={styles.container} pointerEvents={pointerEvents}>
|
|
73
|
-
{children}
|
|
74
|
-
</View>
|
|
75
|
-
</GestureDetector>
|
|
76
|
-
),
|
|
64
|
+
children,
|
|
77
65
|
};
|
|
78
66
|
});
|
|
79
|
-
|
|
80
|
-
const styles = StyleSheet.create({
|
|
81
|
-
container: {
|
|
82
|
-
flex: 1,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
@@ -6,6 +6,7 @@ export type AnimationStoreMap = {
|
|
|
6
6
|
animating: SharedValue<number>;
|
|
7
7
|
closing: SharedValue<number>;
|
|
8
8
|
entering: SharedValue<number>;
|
|
9
|
+
targetProgress: SharedValue<number>;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
const store: Record<ScreenKey, AnimationStoreMap> = {};
|
|
@@ -18,6 +19,7 @@ const ensure = (key: ScreenKey) => {
|
|
|
18
19
|
closing: makeMutable(0),
|
|
19
20
|
animating: makeMutable(0),
|
|
20
21
|
entering: makeMutable(1),
|
|
22
|
+
targetProgress: makeMutable(1),
|
|
21
23
|
} satisfies AnimationStoreMap;
|
|
22
24
|
store[key] = bag;
|
|
23
25
|
}
|
|
@@ -44,7 +44,9 @@ export const animateToProgress = ({
|
|
|
44
44
|
? { ...config, velocity: initialVelocity }
|
|
45
45
|
: config;
|
|
46
46
|
|
|
47
|
-
const { progress, animating, closing, entering } = animations;
|
|
47
|
+
const { progress, animating, closing, entering, targetProgress } = animations;
|
|
48
|
+
|
|
49
|
+
targetProgress.set(value);
|
|
48
50
|
|
|
49
51
|
if (isClosing) {
|
|
50
52
|
closing.set(TRUE);
|