react-native-screen-transitions 1.1.0 → 1.2.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/README.md +199 -250
- package/dist/index.d.mts +69 -29
- package/dist/index.d.ts +69 -29
- package/dist/index.js +119 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +125 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +54 -50
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { ScreenListeners, NavigationState, EventMapBase, RouteProp, ParamListBase } from '@react-navigation/native';
|
|
1
|
+
import * as _react_navigation_native from '@react-navigation/native';
|
|
2
|
+
import { ScreenListeners, NavigationState, EventMapBase, RouteProp, ParamListBase, NavigatorTypeBagBase, StackNavigationState, TypedNavigator } from '@react-navigation/native';
|
|
4
3
|
import * as react_native from 'react-native';
|
|
5
4
|
import { ScaledSize, View } from 'react-native';
|
|
6
5
|
import * as react_native_reanimated from 'react-native-reanimated';
|
|
@@ -9,6 +8,8 @@ import { EdgeInsets } from 'react-native-safe-area-context';
|
|
|
9
8
|
import * as react_native_reanimated_lib_typescript_layoutReanimation_animationBuilder_Keyframe from 'react-native-reanimated/lib/typescript/layoutReanimation/animationBuilder/Keyframe';
|
|
10
9
|
import * as react from 'react';
|
|
11
10
|
import react__default, { ComponentType } from 'react';
|
|
11
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
12
|
+
import { NativeStackNavigationOptions, NativeStackNavigationEventMap, NativeStackNavigationProp, NativeStackNavigatorProps } from '@react-navigation/native-stack';
|
|
12
13
|
|
|
13
14
|
type Any = any;
|
|
14
15
|
interface TransitionConfig {
|
|
@@ -36,6 +37,10 @@ interface TransitionConfig {
|
|
|
36
37
|
* Distance threshold for gesture recognition throughout the screen.
|
|
37
38
|
*/
|
|
38
39
|
gestureResponseDistance?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Skip the default screen options.
|
|
42
|
+
*/
|
|
43
|
+
skipDefaultScreenOptions?: boolean;
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
46
|
* The comprehensive props object passed to a `ScreenStyleInterpolator` function.
|
|
@@ -152,6 +157,30 @@ declare namespace specs {
|
|
|
152
157
|
|
|
153
158
|
declare const useScreenAnimation: () => ScreenInterpolationProps;
|
|
154
159
|
|
|
160
|
+
type TransitionStackNavigationEventMap = NativeStackNavigationEventMap;
|
|
161
|
+
interface TransitionStackNavigationOptions extends Omit<NativeStackNavigationOptions, keyof TransitionConfig>, TransitionConfig {
|
|
162
|
+
skipDefaultScreenOptions?: boolean;
|
|
163
|
+
}
|
|
164
|
+
type TransitionStackNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
165
|
+
type TransitionStackNavigatorProps = NativeStackNavigatorProps;
|
|
166
|
+
declare function TransitionableStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_router, ...rest }: TransitionStackNavigatorProps): react_jsx_runtime.JSX.Element;
|
|
167
|
+
declare function createTransitionableStackNavigator<const ParamList extends ParamListBase, const NavigatorID extends string | undefined = undefined, const TypeBag extends NavigatorTypeBagBase = {
|
|
168
|
+
ParamList: ParamList;
|
|
169
|
+
NavigatorID: NavigatorID;
|
|
170
|
+
State: StackNavigationState<ParamList>;
|
|
171
|
+
ScreenOptions: TransitionStackNavigationOptions;
|
|
172
|
+
EventMap: TransitionStackNavigationEventMap;
|
|
173
|
+
NavigationList: {
|
|
174
|
+
[RouteName in keyof ParamList]: TransitionStackNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
175
|
+
};
|
|
176
|
+
Navigator: typeof TransitionableStackNavigator;
|
|
177
|
+
}>(): TypedNavigator<TypeBag>;
|
|
178
|
+
type TransitionStackNavigatorTypeBag<ScreenOptions = TransitionStackNavigationOptions, State = StackNavigationState<ParamListBase>, EventMap = TransitionStackNavigationEventMap> = {
|
|
179
|
+
ScreenOptions: ScreenOptions;
|
|
180
|
+
State: State;
|
|
181
|
+
EventMap: EventMap;
|
|
182
|
+
};
|
|
183
|
+
|
|
155
184
|
declare const _default: {
|
|
156
185
|
View: react.MemoExoticComponent<react.ForwardRefExoticComponent<{
|
|
157
186
|
children?: react.ReactNode | react_native_reanimated.SharedValue<react.ReactNode>;
|
|
@@ -1403,71 +1432,82 @@ declare const _default: {
|
|
|
1403
1432
|
sharedTransitionStyle?: react_native_reanimated.SharedTransition;
|
|
1404
1433
|
}> | undefined;
|
|
1405
1434
|
} & react.RefAttributes<never>>>;
|
|
1435
|
+
defaultScreenOptions: () => {
|
|
1436
|
+
readonly presentation: "containedTransparentModal";
|
|
1437
|
+
readonly headerShown: false;
|
|
1438
|
+
readonly animation: "none";
|
|
1439
|
+
};
|
|
1440
|
+
presets: typeof presets;
|
|
1441
|
+
specs: typeof specs;
|
|
1442
|
+
/**
|
|
1443
|
+
* Create a transition aware component
|
|
1444
|
+
*/
|
|
1445
|
+
createTransitionAwareComponent: typeof createTransitionAwareComponent;
|
|
1446
|
+
/**
|
|
1447
|
+
* Create a transition aware scrollable component
|
|
1448
|
+
*/
|
|
1449
|
+
createTransitionAwareScrollable: typeof createTransitionAwareScrollable;
|
|
1450
|
+
/**
|
|
1451
|
+
* Create a transitionable native stack navigator.
|
|
1452
|
+
*
|
|
1453
|
+
*/
|
|
1454
|
+
createTransitionableStackNavigator: typeof createTransitionableStackNavigator;
|
|
1455
|
+
/**
|
|
1456
|
+
* @deprecated Use {@link createTransitionableStackNavigator} instead.
|
|
1457
|
+
*/
|
|
1406
1458
|
createConfig: ({ navigation: reactNavigation, route, ...config }: TransitionEventHandlersProps) => TransitionListeners;
|
|
1459
|
+
/**
|
|
1460
|
+
* @deprecated Use {@link createTransitionableStackNavigator} instead.
|
|
1461
|
+
*/
|
|
1407
1462
|
createScreenConfig: (config?: Omit<TransitionEventHandlersProps, "navigation" | "route">) => {
|
|
1408
1463
|
listeners: (l: Any) => Partial<{
|
|
1409
|
-
[x: string]:
|
|
1464
|
+
[x: string]: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1410
1465
|
key: string;
|
|
1411
1466
|
index: number;
|
|
1412
1467
|
routeNames: string[];
|
|
1413
1468
|
history?: unknown[];
|
|
1414
|
-
routes:
|
|
1469
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1415
1470
|
type: string;
|
|
1416
1471
|
stale: false;
|
|
1417
1472
|
}>>, string, boolean | undefined>;
|
|
1418
|
-
focus:
|
|
1473
|
+
focus: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1419
1474
|
key: string;
|
|
1420
1475
|
index: number;
|
|
1421
1476
|
routeNames: string[];
|
|
1422
1477
|
history?: unknown[];
|
|
1423
|
-
routes:
|
|
1478
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1424
1479
|
type: string;
|
|
1425
1480
|
stale: false;
|
|
1426
1481
|
}>>, "focus", unknown>;
|
|
1427
|
-
blur:
|
|
1482
|
+
blur: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1428
1483
|
key: string;
|
|
1429
1484
|
index: number;
|
|
1430
1485
|
routeNames: string[];
|
|
1431
1486
|
history?: unknown[];
|
|
1432
|
-
routes:
|
|
1487
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1433
1488
|
type: string;
|
|
1434
1489
|
stale: false;
|
|
1435
1490
|
}>>, "blur", unknown>;
|
|
1436
|
-
state:
|
|
1491
|
+
state: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1437
1492
|
key: string;
|
|
1438
1493
|
index: number;
|
|
1439
1494
|
routeNames: string[];
|
|
1440
1495
|
history?: unknown[];
|
|
1441
|
-
routes:
|
|
1496
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1442
1497
|
type: string;
|
|
1443
1498
|
stale: false;
|
|
1444
1499
|
}>>, "state", unknown>;
|
|
1445
|
-
beforeRemove:
|
|
1500
|
+
beforeRemove: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1446
1501
|
key: string;
|
|
1447
1502
|
index: number;
|
|
1448
1503
|
routeNames: string[];
|
|
1449
1504
|
history?: unknown[];
|
|
1450
|
-
routes:
|
|
1505
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1451
1506
|
type: string;
|
|
1452
1507
|
stale: false;
|
|
1453
1508
|
}>>, "beforeRemove", true>;
|
|
1454
1509
|
}>;
|
|
1455
1510
|
};
|
|
1456
|
-
defaultScreenOptions: () => {
|
|
1457
|
-
readonly presentation: "containedTransparentModal";
|
|
1458
|
-
readonly headerShown: false;
|
|
1459
|
-
readonly animation: "none";
|
|
1460
|
-
};
|
|
1461
|
-
presets: typeof presets;
|
|
1462
|
-
specs: typeof specs;
|
|
1463
|
-
/**
|
|
1464
|
-
* Create a transition aware component
|
|
1465
|
-
*/
|
|
1466
|
-
createTransitionAwareComponent: typeof createTransitionAwareComponent;
|
|
1467
|
-
/**
|
|
1468
|
-
* Create a transition aware scrollable component
|
|
1469
|
-
*/
|
|
1470
|
-
createTransitionAwareScrollable: typeof createTransitionAwareScrollable;
|
|
1471
1511
|
};
|
|
1472
1512
|
|
|
1473
|
-
export { _default as default, useScreenAnimation };
|
|
1513
|
+
export { type TransitionConfig, type TransitionStackNavigatorTypeBag, _default as default, useScreenAnimation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { ScreenListeners, NavigationState, EventMapBase, RouteProp, ParamListBase } from '@react-navigation/native';
|
|
1
|
+
import * as _react_navigation_native from '@react-navigation/native';
|
|
2
|
+
import { ScreenListeners, NavigationState, EventMapBase, RouteProp, ParamListBase, NavigatorTypeBagBase, StackNavigationState, TypedNavigator } from '@react-navigation/native';
|
|
4
3
|
import * as react_native from 'react-native';
|
|
5
4
|
import { ScaledSize, View } from 'react-native';
|
|
6
5
|
import * as react_native_reanimated from 'react-native-reanimated';
|
|
@@ -9,6 +8,8 @@ import { EdgeInsets } from 'react-native-safe-area-context';
|
|
|
9
8
|
import * as react_native_reanimated_lib_typescript_layoutReanimation_animationBuilder_Keyframe from 'react-native-reanimated/lib/typescript/layoutReanimation/animationBuilder/Keyframe';
|
|
10
9
|
import * as react from 'react';
|
|
11
10
|
import react__default, { ComponentType } from 'react';
|
|
11
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
12
|
+
import { NativeStackNavigationOptions, NativeStackNavigationEventMap, NativeStackNavigationProp, NativeStackNavigatorProps } from '@react-navigation/native-stack';
|
|
12
13
|
|
|
13
14
|
type Any = any;
|
|
14
15
|
interface TransitionConfig {
|
|
@@ -36,6 +37,10 @@ interface TransitionConfig {
|
|
|
36
37
|
* Distance threshold for gesture recognition throughout the screen.
|
|
37
38
|
*/
|
|
38
39
|
gestureResponseDistance?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Skip the default screen options.
|
|
42
|
+
*/
|
|
43
|
+
skipDefaultScreenOptions?: boolean;
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
46
|
* The comprehensive props object passed to a `ScreenStyleInterpolator` function.
|
|
@@ -152,6 +157,30 @@ declare namespace specs {
|
|
|
152
157
|
|
|
153
158
|
declare const useScreenAnimation: () => ScreenInterpolationProps;
|
|
154
159
|
|
|
160
|
+
type TransitionStackNavigationEventMap = NativeStackNavigationEventMap;
|
|
161
|
+
interface TransitionStackNavigationOptions extends Omit<NativeStackNavigationOptions, keyof TransitionConfig>, TransitionConfig {
|
|
162
|
+
skipDefaultScreenOptions?: boolean;
|
|
163
|
+
}
|
|
164
|
+
type TransitionStackNavigationProp<ParamList extends ParamListBase, RouteName extends keyof ParamList = string, NavigatorID extends string | undefined = undefined> = NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
165
|
+
type TransitionStackNavigatorProps = NativeStackNavigatorProps;
|
|
166
|
+
declare function TransitionableStackNavigator({ id, initialRouteName, children, layout, screenListeners, screenOptions, screenLayout, UNSTABLE_router, ...rest }: TransitionStackNavigatorProps): react_jsx_runtime.JSX.Element;
|
|
167
|
+
declare function createTransitionableStackNavigator<const ParamList extends ParamListBase, const NavigatorID extends string | undefined = undefined, const TypeBag extends NavigatorTypeBagBase = {
|
|
168
|
+
ParamList: ParamList;
|
|
169
|
+
NavigatorID: NavigatorID;
|
|
170
|
+
State: StackNavigationState<ParamList>;
|
|
171
|
+
ScreenOptions: TransitionStackNavigationOptions;
|
|
172
|
+
EventMap: TransitionStackNavigationEventMap;
|
|
173
|
+
NavigationList: {
|
|
174
|
+
[RouteName in keyof ParamList]: TransitionStackNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
175
|
+
};
|
|
176
|
+
Navigator: typeof TransitionableStackNavigator;
|
|
177
|
+
}>(): TypedNavigator<TypeBag>;
|
|
178
|
+
type TransitionStackNavigatorTypeBag<ScreenOptions = TransitionStackNavigationOptions, State = StackNavigationState<ParamListBase>, EventMap = TransitionStackNavigationEventMap> = {
|
|
179
|
+
ScreenOptions: ScreenOptions;
|
|
180
|
+
State: State;
|
|
181
|
+
EventMap: EventMap;
|
|
182
|
+
};
|
|
183
|
+
|
|
155
184
|
declare const _default: {
|
|
156
185
|
View: react.MemoExoticComponent<react.ForwardRefExoticComponent<{
|
|
157
186
|
children?: react.ReactNode | react_native_reanimated.SharedValue<react.ReactNode>;
|
|
@@ -1403,71 +1432,82 @@ declare const _default: {
|
|
|
1403
1432
|
sharedTransitionStyle?: react_native_reanimated.SharedTransition;
|
|
1404
1433
|
}> | undefined;
|
|
1405
1434
|
} & react.RefAttributes<never>>>;
|
|
1435
|
+
defaultScreenOptions: () => {
|
|
1436
|
+
readonly presentation: "containedTransparentModal";
|
|
1437
|
+
readonly headerShown: false;
|
|
1438
|
+
readonly animation: "none";
|
|
1439
|
+
};
|
|
1440
|
+
presets: typeof presets;
|
|
1441
|
+
specs: typeof specs;
|
|
1442
|
+
/**
|
|
1443
|
+
* Create a transition aware component
|
|
1444
|
+
*/
|
|
1445
|
+
createTransitionAwareComponent: typeof createTransitionAwareComponent;
|
|
1446
|
+
/**
|
|
1447
|
+
* Create a transition aware scrollable component
|
|
1448
|
+
*/
|
|
1449
|
+
createTransitionAwareScrollable: typeof createTransitionAwareScrollable;
|
|
1450
|
+
/**
|
|
1451
|
+
* Create a transitionable native stack navigator.
|
|
1452
|
+
*
|
|
1453
|
+
*/
|
|
1454
|
+
createTransitionableStackNavigator: typeof createTransitionableStackNavigator;
|
|
1455
|
+
/**
|
|
1456
|
+
* @deprecated Use {@link createTransitionableStackNavigator} instead.
|
|
1457
|
+
*/
|
|
1406
1458
|
createConfig: ({ navigation: reactNavigation, route, ...config }: TransitionEventHandlersProps) => TransitionListeners;
|
|
1459
|
+
/**
|
|
1460
|
+
* @deprecated Use {@link createTransitionableStackNavigator} instead.
|
|
1461
|
+
*/
|
|
1407
1462
|
createScreenConfig: (config?: Omit<TransitionEventHandlersProps, "navigation" | "route">) => {
|
|
1408
1463
|
listeners: (l: Any) => Partial<{
|
|
1409
|
-
[x: string]:
|
|
1464
|
+
[x: string]: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1410
1465
|
key: string;
|
|
1411
1466
|
index: number;
|
|
1412
1467
|
routeNames: string[];
|
|
1413
1468
|
history?: unknown[];
|
|
1414
|
-
routes:
|
|
1469
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1415
1470
|
type: string;
|
|
1416
1471
|
stale: false;
|
|
1417
1472
|
}>>, string, boolean | undefined>;
|
|
1418
|
-
focus:
|
|
1473
|
+
focus: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1419
1474
|
key: string;
|
|
1420
1475
|
index: number;
|
|
1421
1476
|
routeNames: string[];
|
|
1422
1477
|
history?: unknown[];
|
|
1423
|
-
routes:
|
|
1478
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1424
1479
|
type: string;
|
|
1425
1480
|
stale: false;
|
|
1426
1481
|
}>>, "focus", unknown>;
|
|
1427
|
-
blur:
|
|
1482
|
+
blur: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1428
1483
|
key: string;
|
|
1429
1484
|
index: number;
|
|
1430
1485
|
routeNames: string[];
|
|
1431
1486
|
history?: unknown[];
|
|
1432
|
-
routes:
|
|
1487
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1433
1488
|
type: string;
|
|
1434
1489
|
stale: false;
|
|
1435
1490
|
}>>, "blur", unknown>;
|
|
1436
|
-
state:
|
|
1491
|
+
state: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1437
1492
|
key: string;
|
|
1438
1493
|
index: number;
|
|
1439
1494
|
routeNames: string[];
|
|
1440
1495
|
history?: unknown[];
|
|
1441
|
-
routes:
|
|
1496
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1442
1497
|
type: string;
|
|
1443
1498
|
stale: false;
|
|
1444
1499
|
}>>, "state", unknown>;
|
|
1445
|
-
beforeRemove:
|
|
1500
|
+
beforeRemove: _react_navigation_native.EventListenerCallback<_react_navigation_native.EventMapBase & _react_navigation_native.EventMapCore<Readonly<{
|
|
1446
1501
|
key: string;
|
|
1447
1502
|
index: number;
|
|
1448
1503
|
routeNames: string[];
|
|
1449
1504
|
history?: unknown[];
|
|
1450
|
-
routes:
|
|
1505
|
+
routes: _react_navigation_native.NavigationRoute<_react_navigation_native.ParamListBase, string>[];
|
|
1451
1506
|
type: string;
|
|
1452
1507
|
stale: false;
|
|
1453
1508
|
}>>, "beforeRemove", true>;
|
|
1454
1509
|
}>;
|
|
1455
1510
|
};
|
|
1456
|
-
defaultScreenOptions: () => {
|
|
1457
|
-
readonly presentation: "containedTransparentModal";
|
|
1458
|
-
readonly headerShown: false;
|
|
1459
|
-
readonly animation: "none";
|
|
1460
|
-
};
|
|
1461
|
-
presets: typeof presets;
|
|
1462
|
-
specs: typeof specs;
|
|
1463
|
-
/**
|
|
1464
|
-
* Create a transition aware component
|
|
1465
|
-
*/
|
|
1466
|
-
createTransitionAwareComponent: typeof createTransitionAwareComponent;
|
|
1467
|
-
/**
|
|
1468
|
-
* Create a transition aware scrollable component
|
|
1469
|
-
*/
|
|
1470
|
-
createTransitionAwareScrollable: typeof createTransitionAwareScrollable;
|
|
1471
1511
|
};
|
|
1472
1512
|
|
|
1473
|
-
export { _default as default, useScreenAnimation };
|
|
1513
|
+
export { type TransitionConfig, type TransitionStackNavigatorTypeBag, _default as default, useScreenAnimation };
|
package/dist/index.js
CHANGED
|
@@ -1125,7 +1125,7 @@ var ElasticCard = (config = { elasticFactor: 0.5 }) => {
|
|
|
1125
1125
|
"clamp"
|
|
1126
1126
|
);
|
|
1127
1127
|
const overlayColor = (0, import_react_native_reanimated11.interpolateColor)(
|
|
1128
|
-
|
|
1128
|
+
current.progress.value,
|
|
1129
1129
|
[0, 1],
|
|
1130
1130
|
["rgba(0,0,0,0)", "rgba(0,0,0,0.5)"]
|
|
1131
1131
|
);
|
|
@@ -1134,7 +1134,7 @@ var ElasticCard = (config = { elasticFactor: 0.5 }) => {
|
|
|
1134
1134
|
transform: [{ scale }, { translateX }, { translateY }]
|
|
1135
1135
|
},
|
|
1136
1136
|
overlayStyle: {
|
|
1137
|
-
backgroundColor: overlayColor
|
|
1137
|
+
backgroundColor: !next ? overlayColor : "rgba(0,0,0,0)"
|
|
1138
1138
|
}
|
|
1139
1139
|
};
|
|
1140
1140
|
},
|
|
@@ -1142,14 +1142,112 @@ var ElasticCard = (config = { elasticFactor: 0.5 }) => {
|
|
|
1142
1142
|
};
|
|
1143
1143
|
};
|
|
1144
1144
|
|
|
1145
|
+
// src/navigator/create-transitionable-stack-navigator.tsx
|
|
1146
|
+
var import_native4 = require("@react-navigation/native");
|
|
1147
|
+
var import_native_stack = require("@react-navigation/native-stack");
|
|
1148
|
+
var import_react10 = __toESM(require("react"));
|
|
1149
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1150
|
+
var DEFAULT_SCREEN_OPTIONS = {
|
|
1151
|
+
presentation: "containedTransparentModal",
|
|
1152
|
+
headerShown: false,
|
|
1153
|
+
animation: "none"
|
|
1154
|
+
/**
|
|
1155
|
+
* EXPERIMENTAL:
|
|
1156
|
+
When handling forward navigation, this would be the prop we would use to prevent the underlying screen from not being interactable.
|
|
1157
|
+
- pointerEvents: "box-none",
|
|
1158
|
+
*/
|
|
1159
|
+
};
|
|
1160
|
+
var CONFLICTING_SCREEN_OPTIONS = {
|
|
1161
|
+
gestureEnabled: false,
|
|
1162
|
+
gestureDirection: "horizontal"
|
|
1163
|
+
};
|
|
1164
|
+
function TransitionableStackNavigator({
|
|
1165
|
+
id,
|
|
1166
|
+
initialRouteName,
|
|
1167
|
+
children,
|
|
1168
|
+
layout,
|
|
1169
|
+
screenListeners,
|
|
1170
|
+
screenOptions,
|
|
1171
|
+
screenLayout,
|
|
1172
|
+
UNSTABLE_router,
|
|
1173
|
+
...rest
|
|
1174
|
+
}) {
|
|
1175
|
+
const screenProcessor = (0, import_react10.useMemo)(() => {
|
|
1176
|
+
const childOptions = /* @__PURE__ */ new Map();
|
|
1177
|
+
const modifiedChildren = import_react10.Children.toArray(children).filter(import_react10.isValidElement).map((child) => {
|
|
1178
|
+
const resolvedOptions = typeof child.props.options === "function" ? child.props.options({
|
|
1179
|
+
route: child.props.route,
|
|
1180
|
+
navigation: child.props.navigation
|
|
1181
|
+
}) : child.props.options || {};
|
|
1182
|
+
childOptions.set(child.props.name, resolvedOptions);
|
|
1183
|
+
const skipDefaultScreenOptions = resolvedOptions?.skipDefaultScreenOptions === true;
|
|
1184
|
+
return import_react10.default.cloneElement(child, {
|
|
1185
|
+
...child.props,
|
|
1186
|
+
options: {
|
|
1187
|
+
...skipDefaultScreenOptions ? {} : DEFAULT_SCREEN_OPTIONS,
|
|
1188
|
+
...resolvedOptions,
|
|
1189
|
+
...CONFLICTING_SCREEN_OPTIONS
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
});
|
|
1193
|
+
return {
|
|
1194
|
+
children: modifiedChildren,
|
|
1195
|
+
childOptions
|
|
1196
|
+
};
|
|
1197
|
+
}, [children]);
|
|
1198
|
+
const screenListenersWithTransitions = (0, import_react10.useMemo)(() => {
|
|
1199
|
+
return (props) => {
|
|
1200
|
+
const resolvedNavigatorConfig = typeof screenOptions === "function" ? screenOptions({
|
|
1201
|
+
navigation: props.navigation,
|
|
1202
|
+
route: props.route,
|
|
1203
|
+
theme: {}
|
|
1204
|
+
}) : screenOptions;
|
|
1205
|
+
const resolvedChildConfig = screenProcessor.childOptions.get(props.route.name);
|
|
1206
|
+
const mergedConfig = {
|
|
1207
|
+
...resolvedNavigatorConfig,
|
|
1208
|
+
...resolvedChildConfig
|
|
1209
|
+
//Child should override navigator config
|
|
1210
|
+
};
|
|
1211
|
+
const transitionListeners = createConfig({
|
|
1212
|
+
navigation: props.navigation,
|
|
1213
|
+
route: props.route,
|
|
1214
|
+
screenStyleInterpolator: mergedConfig.screenStyleInterpolator,
|
|
1215
|
+
transitionSpec: mergedConfig.transitionSpec,
|
|
1216
|
+
gestureEnabled: mergedConfig.gestureEnabled,
|
|
1217
|
+
gestureDirection: mergedConfig.gestureDirection,
|
|
1218
|
+
gestureResponseDistance: typeof mergedConfig.gestureResponseDistance === "number" ? mergedConfig.gestureResponseDistance : void 0,
|
|
1219
|
+
gestureVelocityImpact: mergedConfig.gestureVelocityImpact
|
|
1220
|
+
});
|
|
1221
|
+
const existingListeners = typeof screenListeners === "function" ? screenListeners(props) : screenListeners || {};
|
|
1222
|
+
return {
|
|
1223
|
+
...existingListeners,
|
|
1224
|
+
...transitionListeners
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
}, [screenListeners, screenOptions, screenProcessor.childOptions]);
|
|
1228
|
+
const buildingBlocks = {
|
|
1229
|
+
id,
|
|
1230
|
+
initialRouteName,
|
|
1231
|
+
children: screenProcessor.children,
|
|
1232
|
+
layout,
|
|
1233
|
+
screenListeners: screenListenersWithTransitions,
|
|
1234
|
+
screenOptions,
|
|
1235
|
+
screenLayout,
|
|
1236
|
+
UNSTABLE_router
|
|
1237
|
+
};
|
|
1238
|
+
const { state, describe, descriptors, navigation, NavigationContent } = (0, import_native4.useNavigationBuilder)(import_native4.StackRouter, buildingBlocks);
|
|
1239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavigationContent, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_native_stack.NativeStackView, { ...rest, state, navigation, descriptors, describe }) });
|
|
1240
|
+
}
|
|
1241
|
+
function createTransitionableStackNavigator() {
|
|
1242
|
+
return (0, import_native4.createNavigatorFactory)(TransitionableStackNavigator)();
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1145
1245
|
// src/index.ts
|
|
1146
1246
|
var index_default = {
|
|
1147
1247
|
View: createTransitionAwareComponent(import_react_native5.View),
|
|
1148
1248
|
Pressable: createTransitionAwareComponent(import_react_native5.Pressable),
|
|
1149
1249
|
ScrollView: createTransitionAwareScrollable(import_react_native5.ScrollView),
|
|
1150
1250
|
FlatList: createTransitionAwareScrollable(import_react_native5.FlatList),
|
|
1151
|
-
createConfig,
|
|
1152
|
-
createScreenConfig,
|
|
1153
1251
|
defaultScreenOptions,
|
|
1154
1252
|
presets: presets_exports,
|
|
1155
1253
|
specs: specs_exports,
|
|
@@ -1160,7 +1258,23 @@ var index_default = {
|
|
|
1160
1258
|
/**
|
|
1161
1259
|
* Create a transition aware scrollable component
|
|
1162
1260
|
*/
|
|
1163
|
-
createTransitionAwareScrollable
|
|
1261
|
+
createTransitionAwareScrollable,
|
|
1262
|
+
/**
|
|
1263
|
+
* Create a transitionable native stack navigator.
|
|
1264
|
+
*
|
|
1265
|
+
*/
|
|
1266
|
+
createTransitionableStackNavigator,
|
|
1267
|
+
/**
|
|
1268
|
+
* @deprecated Use {@link createTransitionableStackNavigator} instead.
|
|
1269
|
+
*/
|
|
1270
|
+
createConfig,
|
|
1271
|
+
/**
|
|
1272
|
+
* @deprecated Use {@link createTransitionableStackNavigator} instead.
|
|
1273
|
+
*/
|
|
1274
|
+
createScreenConfig
|
|
1275
|
+
/**
|
|
1276
|
+
* @deprecated Use {@link createTransitionableStackNavigator} instead.
|
|
1277
|
+
*/
|
|
1164
1278
|
};
|
|
1165
1279
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1166
1280
|
0 && (module.exports = {
|