react-native-screen-transitions 2.0.2 → 2.0.4
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/utils/bounds/constants.js +3 -3
- package/lib/commonjs/utils/bounds/constants.js.map +1 -1
- package/lib/commonjs/utils/bounds/get-bounds.js +3 -3
- package/lib/commonjs/utils/bounds/get-bounds.js.map +1 -1
- package/lib/module/utils/bounds/constants.js +3 -3
- package/lib/module/utils/bounds/constants.js.map +1 -1
- package/lib/module/utils/bounds/get-bounds.js +3 -3
- package/lib/module/utils/bounds/get-bounds.js.map +1 -1
- package/lib/typescript/utils/bounds/_types/get-bounds.d.ts +2 -2
- package/lib/typescript/utils/bounds/_types/get-bounds.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/constants.d.ts +4 -4
- package/lib/typescript/utils/bounds/constants.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/get-bounds.d.ts +2 -2
- package/lib/typescript/utils/bounds/get-bounds.d.ts.map +1 -1
- package/lib/typescript/utils/bounds/index.d.ts +1 -1
- package/lib/typescript/utils/bounds/index.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/__tests__/geometry.test.ts +127 -0
- package/src/components/bounds-activator.tsx +29 -0
- package/src/components/controllers/screen-lifecycle.tsx +72 -0
- package/src/components/create-transition-aware-component.tsx +99 -0
- package/src/components/root-transition-aware.tsx +56 -0
- package/src/configs/index.ts +2 -0
- package/src/configs/presets.ts +227 -0
- package/src/configs/specs.ts +9 -0
- package/src/hooks/animation/use-associated-style.tsx +28 -0
- package/src/hooks/animation/use-screen-animation.tsx +142 -0
- package/src/hooks/bounds/use-bound-measurer.tsx +71 -0
- package/src/hooks/gestures/use-build-gestures.tsx +369 -0
- package/src/hooks/gestures/use-scroll-progress.tsx +60 -0
- package/src/hooks/use-stable-callback.tsx +15 -0
- package/src/index.ts +32 -0
- package/src/integrations/native-stack/navigators/createNativeStackNavigator.tsx +112 -0
- package/src/integrations/native-stack/utils/debounce.tsx +14 -0
- package/src/integrations/native-stack/utils/getModalRoutesKeys.ts +21 -0
- package/src/integrations/native-stack/utils/useAnimatedHeaderHeight.tsx +18 -0
- package/src/integrations/native-stack/utils/useDismissedRouteError.tsx +30 -0
- package/src/integrations/native-stack/utils/useInvalidPreventRemoveError.tsx +31 -0
- package/src/integrations/native-stack/views/FontProcessor.native.tsx +12 -0
- package/src/integrations/native-stack/views/FontProcessor.tsx +5 -0
- package/src/integrations/native-stack/views/FooterComponent.tsx +10 -0
- package/src/integrations/native-stack/views/NativeStackView.native.tsx +657 -0
- package/src/integrations/native-stack/views/NativeStackView.tsx +214 -0
- package/src/integrations/native-stack/views/useHeaderConfigProps.tsx +295 -0
- package/src/providers/gestures.tsx +89 -0
- package/src/providers/keys.tsx +38 -0
- package/src/stores/animations.ts +45 -0
- package/src/stores/bounds.ts +71 -0
- package/src/stores/gestures.ts +55 -0
- package/src/stores/navigator-dismiss-state.ts +17 -0
- package/src/stores/utils/reset-stores-for-screen.ts +14 -0
- package/src/types/animation.ts +76 -0
- package/src/types/bounds.ts +82 -0
- package/src/types/core.ts +50 -0
- package/src/types/gesture.ts +33 -0
- package/src/types/navigator.ts +744 -0
- package/src/types/utils.ts +3 -0
- package/src/utils/animation/animate.ts +28 -0
- package/src/utils/animation/run-transition.ts +49 -0
- package/src/utils/bounds/_types/builder.ts +35 -0
- package/src/utils/bounds/_types/geometry.ts +17 -0
- package/src/utils/bounds/_types/get-bounds.ts +10 -0
- package/src/utils/bounds/build-bound-styles.ts +184 -0
- package/src/utils/bounds/constants.ts +25 -0
- package/src/utils/bounds/flatten-styles.ts +21 -0
- package/src/utils/bounds/geometry.ts +113 -0
- package/src/utils/bounds/get-bounds.ts +56 -0
- package/src/utils/bounds/index.ts +46 -0
- package/src/utils/bounds/style-composers.ts +172 -0
- package/src/utils/gesture/apply-gesture-activation-criteria.ts +109 -0
- package/src/utils/gesture/map-gesture-to-progress.ts +11 -0
- package/src/utils/gesture/normalize-gesture-translation.ts +20 -0
- package/src/utils/index.ts +1 -0
- package/lib/commonjs/__tests__ /geometry.test.js +0 -178
- package/lib/commonjs/__tests__ /geometry.test.js.map +0 -1
- package/lib/module/__tests__ /geometry.test.js +0 -178
- package/lib/module/__tests__ /geometry.test.js.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { usePreventRemoveContext } from "@react-navigation/native";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import type { NativeStackDescriptorMap } from "../../../types/navigator";
|
|
5
|
+
|
|
6
|
+
export function useInvalidPreventRemoveError(
|
|
7
|
+
descriptors: NativeStackDescriptorMap,
|
|
8
|
+
) {
|
|
9
|
+
const { preventedRoutes } = usePreventRemoveContext();
|
|
10
|
+
const preventedRouteKey = Object.keys(preventedRoutes)[0];
|
|
11
|
+
const preventedDescriptor = descriptors[preventedRouteKey];
|
|
12
|
+
const isHeaderBackButtonMenuEnabledOnPreventedScreen =
|
|
13
|
+
preventedDescriptor?.options?.headerBackButtonMenuEnabled;
|
|
14
|
+
const preventedRouteName = preventedDescriptor?.route?.name;
|
|
15
|
+
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (
|
|
18
|
+
preventedRouteKey != null &&
|
|
19
|
+
isHeaderBackButtonMenuEnabledOnPreventedScreen
|
|
20
|
+
) {
|
|
21
|
+
const message =
|
|
22
|
+
`The screen ${preventedRouteName} uses 'usePreventRemove' hook alongside 'headerBackButtonMenuEnabled: true', which is not supported. \n\n` +
|
|
23
|
+
`Consider removing 'headerBackButtonMenuEnabled: true' from ${preventedRouteName} screen to get rid of this error.`;
|
|
24
|
+
console.error(message);
|
|
25
|
+
}
|
|
26
|
+
}, [
|
|
27
|
+
preventedRouteKey,
|
|
28
|
+
isHeaderBackButtonMenuEnabledOnPreventedScreen,
|
|
29
|
+
preventedRouteName,
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @ts-expect-error importing private module
|
|
2
|
+
import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';
|
|
3
|
+
|
|
4
|
+
export function processFonts(
|
|
5
|
+
fontFamilies: (string | undefined)[]
|
|
6
|
+
): (string | undefined)[] {
|
|
7
|
+
const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;
|
|
8
|
+
if (typeof fontFamilyProcessor === 'function') {
|
|
9
|
+
return fontFamilies.map(fontFamilyProcessor);
|
|
10
|
+
}
|
|
11
|
+
return fontFamilies;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { ScreenFooter } from "react-native-screens";
|
|
3
|
+
|
|
4
|
+
type FooterProps = {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function FooterComponent({ children }: FooterProps) {
|
|
9
|
+
return <ScreenFooter collapsable={false}>{children}</ScreenFooter>;
|
|
10
|
+
}
|