expo-router 6.0.0-beta.2 → 6.0.0-beta.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/build/fork/getPathFromState.d.ts.map +1 -1
- package/build/fork/getPathFromState.js +2 -0
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +12 -3
- package/build/global-state/routing.js.map +1 -1
- package/build/layouts/StackClient.d.ts +7 -7
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +27 -25
- package/build/layouts/StackClient.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +4 -1
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +16 -19
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +1 -1
- package/build/link/elements.js +1 -1
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/utils.d.ts.map +1 -1
- package/build/link/preview/utils.js +5 -2
- package/build/link/preview/utils.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +42 -6
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js +6 -27
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +22 -22
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/types.d.ts +92 -15
- package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/types.js +37 -0
- package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
- package/build/native-tabs/index.d.ts +1 -1
- package/build/native-tabs/index.d.ts.map +1 -1
- package/build/native-tabs/index.js.map +1 -1
- package/build/navigationParams.d.ts +9 -0
- package/build/navigationParams.d.ts.map +1 -0
- package/build/navigationParams.js +67 -0
- package/build/navigationParams.js.map +1 -0
- package/build/ui/Slot.d.ts +5 -1
- package/build/ui/Slot.d.ts.map +1 -1
- package/build/ui/Slot.js.map +1 -1
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js +1 -1
- package/build/ui/Tabs.js.map +1 -1
- package/build/ui/common.d.ts +2 -3
- package/build/ui/common.d.ts.map +1 -1
- package/build/ui/common.js +1 -3
- package/build/ui/common.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NativeBottomTabsRouter = NativeBottomTabsRouter;
|
|
4
4
|
const native_1 = require("@react-navigation/native");
|
|
5
|
+
const navigationParams_1 = require("../../navigationParams");
|
|
5
6
|
function NativeBottomTabsRouter(options) {
|
|
6
7
|
const tabRouter = (0, native_1.TabRouter)({ ...options });
|
|
7
8
|
const nativeTabRouter = {
|
|
@@ -21,33 +22,11 @@ function NativeBottomTabsRouter(options) {
|
|
|
21
22
|
if (route.name !== action.payload.name) {
|
|
22
23
|
return route;
|
|
23
24
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
: {};
|
|
30
|
-
const isPreviewNavigation = action.payload.params &&
|
|
31
|
-
'__internal__expoRouterIsPreviewNavigation' in action.payload.params
|
|
32
|
-
? action.payload.params.__internal__expoRouterIsPreviewNavigation
|
|
33
|
-
: undefined;
|
|
34
|
-
const previewKeyParams = isPreviewNavigation
|
|
35
|
-
? {
|
|
36
|
-
__internal__expoRouterIsPreviewNavigation: isPreviewNavigation,
|
|
37
|
-
}
|
|
38
|
-
: {};
|
|
39
|
-
const params = {
|
|
40
|
-
...(route.params || {}),
|
|
41
|
-
...previewKeyParams,
|
|
42
|
-
// This is a workaround for the issue with the preview key not being passed to the params
|
|
43
|
-
// https://github.com/Ubax/react-navigation/blob/main/packages/core/src/useNavigationBuilder.tsx#L573
|
|
44
|
-
// Another solution would be to propagate the preview key in the useNavigationBuilder,
|
|
45
|
-
// but that would require us to fork the @react-navigation/core package.
|
|
46
|
-
params: {
|
|
47
|
-
...nestedParams,
|
|
48
|
-
...previewKeyParams,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
25
|
+
const expoParams = (0, navigationParams_1.getInternalExpoRouterParams)(action.payload.params);
|
|
26
|
+
if (route.params && 'screen' in route.params) {
|
|
27
|
+
expoParams['__internal_expo_router_no_animation'] = true;
|
|
28
|
+
}
|
|
29
|
+
const params = (0, navigationParams_1.appendInternalExpoRouterParams)(route.params, expoParams);
|
|
51
30
|
return {
|
|
52
31
|
...route,
|
|
53
32
|
params,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeBottomTabsRouter.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"NativeBottomTabsRouter.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.tsx"],"names":[],"mappings":";;AAgBA,wDAiDC;AAjED,qDAQkC;AAElC,6DAIgC;AAEhC,SAAgB,sBAAsB,CAAC,OAAyB;IAC9D,MAAM,SAAS,GAAG,IAAA,kBAAS,EAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAE5C,MAAM,eAAe,GAGjB;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B,CAAC;YACH,CAAC;YACD,OAAO,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import {\n CommonNavigationAction,\n ParamListBase,\n Router,\n TabActionType,\n TabNavigationState,\n TabRouter,\n type TabRouterOptions,\n} from '@react-navigation/native';\n\nimport {\n appendInternalExpoRouterParams,\n getInternalExpoRouterParams,\n type InternalExpoRouterParams,\n} from '../../navigationParams';\n\nexport function NativeBottomTabsRouter(options: TabRouterOptions) {\n const tabRouter = TabRouter({ ...options });\n\n const nativeTabRouter: Router<\n TabNavigationState<ParamListBase>,\n TabActionType | CommonNavigationAction\n > = {\n ...tabRouter,\n // @ts-expect-error TODO: For some reason this is not typed correctly\n getStateForAction: (state, action: TabActionType | CommonNavigationAction, options) => {\n switch (action.type) {\n case 'NAVIGATE': {\n const newStateFromNavigation = tabRouter.getStateForAction(state, action, options);\n const index = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (index === -1 || !newStateFromNavigation) {\n return newStateFromNavigation;\n }\n\n const newState = {\n ...newStateFromNavigation,\n routes: newStateFromNavigation.routes.map((route) => {\n if (route.name !== action.payload.name) {\n return route;\n }\n\n const expoParams: InternalExpoRouterParams = getInternalExpoRouterParams(\n action.payload.params\n );\n\n if (route.params && 'screen' in route.params) {\n expoParams['__internal_expo_router_no_animation'] = true;\n }\n\n const params = appendInternalExpoRouterParams(route.params, expoParams);\n return {\n ...route,\n params,\n };\n }),\n };\n return newState;\n }\n }\n return tabRouter.getStateForAction(state, action, options);\n },\n };\n\n return nativeTabRouter;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"NativeTabsView.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAShD,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,SAAS,CAAC;AAOjB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAyExD"}
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.NativeTabsView = NativeTabsView;
|
|
37
37
|
const react_1 = __importStar(require("react"));
|
|
38
38
|
const react_native_screens_1 = require("react-native-screens");
|
|
39
|
+
const types_1 = require("./types");
|
|
39
40
|
const utils_1 = require("./utils");
|
|
40
41
|
// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.
|
|
41
42
|
// Otherwise user may see glitches when switching between tabs.
|
|
@@ -44,36 +45,19 @@ function NativeTabsView(props) {
|
|
|
44
45
|
const { builder, style, minimizeBehavior, disableIndicator, focusedIndex } = props;
|
|
45
46
|
const { state, descriptors, navigation } = builder;
|
|
46
47
|
const { routes } = state;
|
|
47
|
-
|
|
48
|
-
// In this case we don't need to change the isFocused of the screens, because the transition will happen on native side
|
|
49
|
-
const isDuringNativeTransition = (0, react_1.useRef)(false);
|
|
50
|
-
// This is the last index that was not part of a native transition, e.g navigation from link
|
|
51
|
-
const lastNotNativeTransitionIndex = (0, react_1.useRef)(focusedIndex);
|
|
52
|
-
// If the flag was set in the onNativeFocusChange handler, it will be still true here
|
|
53
|
-
// It is set to false, later in this function
|
|
54
|
-
// Thus if it is false, we know that the transition was not triggered by a native tab change
|
|
55
|
-
// and we need to reset the lastNotNativeTransitionIndex
|
|
56
|
-
if (!isDuringNativeTransition.current) {
|
|
57
|
-
lastNotNativeTransitionIndex.current = focusedIndex;
|
|
58
|
-
}
|
|
48
|
+
const deferredFocusedIndex = (0, react_1.useDeferredValue)(focusedIndex);
|
|
59
49
|
const children = routes
|
|
60
50
|
.map((route, index) => ({ route, index }))
|
|
61
51
|
.filter(({ route: { key } }) => (0, utils_1.shouldTabBeVisible)(descriptors[key].options))
|
|
62
52
|
.map(({ route, index }) => {
|
|
63
53
|
const descriptor = descriptors[route.key];
|
|
64
|
-
|
|
65
|
-
// Otherwise the lastNotNativeTransitionIndex is set to focusedIndex in the if above this statement
|
|
66
|
-
const isFocused = index === focusedIndex;
|
|
67
|
-
// TODO: Find a proper fix, that allows for proper JS navigation
|
|
68
|
-
//lastNotNativeTransitionIndex.current;
|
|
54
|
+
const isFocused = index === deferredFocusedIndex;
|
|
69
55
|
const title = descriptor.options.title ?? route.name;
|
|
70
56
|
return (<react_native_screens_1.BottomTabsScreen key={route.key} {...descriptor.options} tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor} tabBarItemBadgeTextColor={style?.badgeTextColor} tabBarItemTitlePositionAdjustment={style?.titlePositionAdjustment} iconResourceName={descriptor.options.icon?.drawable} icon={convertOptionsIconToPropsIcon(descriptor.options.icon)} selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)} title={title} freezeContents={false} tabKey={route.key} isFocused={isFocused}>
|
|
71
57
|
{descriptor.render()}
|
|
72
58
|
</react_native_screens_1.BottomTabsScreen>);
|
|
73
59
|
});
|
|
74
|
-
|
|
75
|
-
isDuringNativeTransition.current = false;
|
|
76
|
-
return (<react_native_screens_1.BottomTabs tabBarItemTitleFontColor={style?.color} tabBarItemTitleFontFamily={style?.fontFamily} tabBarItemTitleFontSize={style?.fontSize}
|
|
60
|
+
return (<BottomTabsWrapper tabBarItemTitleFontColor={style?.color} tabBarItemTitleFontFamily={style?.fontFamily} tabBarItemTitleFontSize={style?.fontSize}
|
|
77
61
|
// Only string values are accepted by screens
|
|
78
62
|
tabBarItemTitleFontWeight={style?.fontWeight
|
|
79
63
|
? String(style.fontWeight)
|
|
@@ -87,10 +71,9 @@ function NativeTabsView(props) {
|
|
|
87
71
|
name: route.name,
|
|
88
72
|
},
|
|
89
73
|
});
|
|
90
|
-
isDuringNativeTransition.current = true;
|
|
91
74
|
}}>
|
|
92
75
|
{children}
|
|
93
|
-
</
|
|
76
|
+
</BottomTabsWrapper>);
|
|
94
77
|
}
|
|
95
78
|
function convertOptionsIconToPropsIcon(icon) {
|
|
96
79
|
if (!icon) {
|
|
@@ -104,4 +87,21 @@ function convertOptionsIconToPropsIcon(icon) {
|
|
|
104
87
|
}
|
|
105
88
|
return undefined;
|
|
106
89
|
}
|
|
90
|
+
const supportedTabBarMinimizeBehaviorsSet = new Set(types_1.SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);
|
|
91
|
+
const supportedTabBarItemLabelVisibilityModesSet = new Set(types_1.SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES);
|
|
92
|
+
const supportedBlurEffectsSet = new Set(types_1.SUPPORTED_BLUR_EFFECTS);
|
|
93
|
+
function BottomTabsWrapper(props) {
|
|
94
|
+
const { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, tabBarBlurEffect, ...rest } = props;
|
|
95
|
+
if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {
|
|
96
|
+
throw new Error(`Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${types_1.SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `"${behavior}"`).join(', ')}`);
|
|
97
|
+
}
|
|
98
|
+
if (tabBarItemLabelVisibilityMode &&
|
|
99
|
+
!supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)) {
|
|
100
|
+
throw new Error(`Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${types_1.SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `"${mode}"`).join(', ')}`);
|
|
101
|
+
}
|
|
102
|
+
if (tabBarBlurEffect && !supportedBlurEffectsSet.has(tabBarBlurEffect)) {
|
|
103
|
+
throw new Error(`Unsupported blurEffect: ${tabBarBlurEffect}. Supported values are: ${types_1.SUPPORTED_BLUR_EFFECTS.map((effect) => `"${effect}"`).join(', ')}`);
|
|
104
|
+
}
|
|
105
|
+
return (<react_native_screens_1.BottomTabs tabBarBlurEffect={tabBarBlurEffect} tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode} tabBarMinimizeBehavior={tabBarMinimizeBehavior} {...rest}/>);
|
|
106
|
+
}
|
|
107
107
|
//# sourceMappingURL=NativeTabsView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,wCA6FC;AA5GD,+CAAsC;AACtC,+DAK8B;AAG9B,mCAA6C;AAE7C,8FAA8F;AAC9F,+DAA+D;AAC/D,mCAAY,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC;AAErD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACnF,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEzB,yFAAyF;IACzF,uHAAuH;IACvH,MAAM,wBAAwB,GAAG,IAAA,cAAM,EAAU,KAAK,CAAC,CAAC;IACxD,4FAA4F;IAC5F,MAAM,4BAA4B,GAAG,IAAA,cAAM,EAAS,YAAY,CAAC,CAAC;IAElE,qFAAqF;IACrF,6CAA6C;IAC7C,4FAA4F;IAC5F,wDAAwD;IACxD,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC;QACtC,4BAA4B,CAAC,OAAO,GAAG,YAAY,CAAC;IACtD,CAAC;IAED,MAAM,QAAQ,GAAG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,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,CACpE,gCAAgC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CACpD,sBAAsB,CAAC,CAAC,gBAAgB,CAAC,CACzC,mBAAmB,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE;YACnD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;YACvC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;YAC/B,UAAU,CAAC,QAAQ,CAAC;gBAClB,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,KAAK,CAAC,GAAG;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB;aACF,CAAC,CAAC;YACH,wBAAwB,CAAC,OAAO,GAAG,IAAI,CAAC;QAC1C,CAAC,CAAC,CACF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,iCAAU,CAAC,CACd,CAAC;AACJ,CAAC;AAED,SAAS,6BAA6B,CACpC,IAA8B;IAE9B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;QAC5B,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IACnC,CAAC;SAAM,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACrC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import React, { useRef } from 'react';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsScreenProps,\n} from 'react-native-screens';\n\nimport type { NativeTabOptions, NativeTabsViewProps } from './types';\nimport { shouldTabBeVisible } from './utils';\n\n// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.\n// Otherwise user may see glitches when switching between tabs.\nfeatureFlags.experiment.controlledBottomTabs = false;\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, style, minimizeBehavior, disableIndicator, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n\n // This is flag that is set to true, when the transition is executed by native tab change\n // In this case we don't need to change the isFocused of the screens, because the transition will happen on native side\n const isDuringNativeTransition = useRef<boolean>(false);\n // This is the last index that was not part of a native transition, e.g navigation from link\n const lastNotNativeTransitionIndex = useRef<number>(focusedIndex);\n\n // If the flag was set in the onNativeFocusChange handler, it will be still true here\n // It is set to false, later in this function\n // Thus if it is false, we know that the transition was not triggered by a native tab change\n // and we need to reset the lastNotNativeTransitionIndex\n if (!isDuringNativeTransition.current) {\n lastNotNativeTransitionIndex.current = focusedIndex;\n }\n\n const children = routes\n .map((route, index) => ({ route, index }))\n .filter(({ route: { key } }) => shouldTabBeVisible(descriptors[key].options))\n .map(({ route, index }) => {\n const descriptor = descriptors[route.key];\n // In case of native transition we want to keep the last focused index\n // Otherwise the lastNotNativeTransitionIndex is set to focusedIndex in the if above this statement\n const isFocused = index === focusedIndex;\n // TODO: Find a proper fix, that allows for proper JS navigation\n //lastNotNativeTransitionIndex.current;\n const title = descriptor.options.title ?? route.name;\n\n return (\n <BottomTabsScreen\n key={route.key}\n {...descriptor.options}\n tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor}\n tabBarItemBadgeTextColor={style?.badgeTextColor}\n tabBarItemTitlePositionAdjustment={style?.titlePositionAdjustment}\n iconResourceName={descriptor.options.icon?.drawable}\n icon={convertOptionsIconToPropsIcon(descriptor.options.icon)}\n selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)}\n title={title}\n freezeContents={false}\n tabKey={route.key}\n isFocused={isFocused}>\n {descriptor.render()}\n </BottomTabsScreen>\n );\n });\n\n // The native render is over, we can reset the flag\n isDuringNativeTransition.current = false;\n\n return (\n <BottomTabs\n tabBarItemTitleFontColor={style?.color}\n tabBarItemTitleFontFamily={style?.fontFamily}\n tabBarItemTitleFontSize={style?.fontSize}\n // Only string values are accepted by screens\n tabBarItemTitleFontWeight={\n style?.fontWeight\n ? (String(style.fontWeight) as `${NonNullable<(typeof style)['fontWeight']>}`)\n : undefined\n }\n tabBarItemTitleFontStyle={style?.fontStyle}\n tabBarBackgroundColor={style?.backgroundColor}\n tabBarBlurEffect={style?.blurEffect}\n tabBarTintColor={style?.tintColor}\n tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor}\n tabBarItemRippleColor={style?.rippleColor}\n tabBarItemLabelVisibilityMode={style?.labelVisibilityMode}\n tabBarItemIconColor={style?.iconColor}\n tabBarItemIconColorActive={style?.['&:active']?.iconColor ?? style?.tintColor}\n tabBarItemTitleFontColorActive={style?.['&:active']?.color ?? style?.tintColor}\n tabBarItemTitleFontSizeActive={style?.['&:active']?.fontSize}\n tabBarItemActiveIndicatorColor={style?.['&:active']?.indicatorColor}\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n tabBarMinimizeBehavior={minimizeBehavior}\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n const descriptor = descriptors[tabKey];\n const route = descriptor.route;\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: route.name,\n },\n });\n isDuringNativeTransition.current = true;\n }}>\n {children}\n </BottomTabs>\n );\n}\n\nfunction convertOptionsIconToPropsIcon(\n icon: NativeTabOptions['icon']\n): BottomTabsScreenProps['icon'] {\n if (!icon) {\n return undefined;\n }\n if ('sf' in icon && icon.sf) {\n return { sfSymbolName: icon.sf };\n } else if ('src' in icon && icon.src) {\n return { templateSource: icon.src };\n }\n return undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzI,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,iCAAU,CACT,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,6BAA6B,CAAC,CAAC,6BAA6B,CAAC,CAC7D,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAC/C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useDeferredValue } from 'react';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenProps,\n} from 'react-native-screens';\n\nimport {\n SUPPORTED_BLUR_EFFECTS,\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport { shouldTabBeVisible } from './utils';\n\n// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.\n// Otherwise user may see glitches when switching between tabs.\nfeatureFlags.experiment.controlledBottomTabs = false;\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, style, minimizeBehavior, disableIndicator, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n\n const children = routes\n .map((route, index) => ({ route, index }))\n .filter(({ route: { key } }) => shouldTabBeVisible(descriptors[key].options))\n .map(({ route, index }) => {\n const descriptor = descriptors[route.key];\n const isFocused = index === deferredFocusedIndex;\n const title = descriptor.options.title ?? route.name;\n\n return (\n <BottomTabsScreen\n key={route.key}\n {...descriptor.options}\n tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor}\n tabBarItemBadgeTextColor={style?.badgeTextColor}\n tabBarItemTitlePositionAdjustment={style?.titlePositionAdjustment}\n iconResourceName={descriptor.options.icon?.drawable}\n icon={convertOptionsIconToPropsIcon(descriptor.options.icon)}\n selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)}\n title={title}\n freezeContents={false}\n tabKey={route.key}\n isFocused={isFocused}>\n {descriptor.render()}\n </BottomTabsScreen>\n );\n });\n\n return (\n <BottomTabsWrapper\n tabBarItemTitleFontColor={style?.color}\n tabBarItemTitleFontFamily={style?.fontFamily}\n tabBarItemTitleFontSize={style?.fontSize}\n // Only string values are accepted by screens\n tabBarItemTitleFontWeight={\n style?.fontWeight\n ? (String(style.fontWeight) as `${NonNullable<(typeof style)['fontWeight']>}`)\n : undefined\n }\n tabBarItemTitleFontStyle={style?.fontStyle}\n tabBarBackgroundColor={style?.backgroundColor}\n tabBarBlurEffect={style?.blurEffect}\n tabBarTintColor={style?.tintColor}\n tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor}\n tabBarItemRippleColor={style?.rippleColor}\n tabBarItemLabelVisibilityMode={style?.labelVisibilityMode}\n tabBarItemIconColor={style?.iconColor}\n tabBarItemIconColorActive={style?.['&:active']?.iconColor ?? style?.tintColor}\n tabBarItemTitleFontColorActive={style?.['&:active']?.color ?? style?.tintColor}\n tabBarItemTitleFontSizeActive={style?.['&:active']?.fontSize}\n tabBarItemActiveIndicatorColor={style?.['&:active']?.indicatorColor}\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n tabBarMinimizeBehavior={minimizeBehavior}\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n const descriptor = descriptors[tabKey];\n const route = descriptor.route;\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: route.name,\n },\n });\n }}>\n {children}\n </BottomTabsWrapper>\n );\n}\n\nfunction convertOptionsIconToPropsIcon(\n icon: NativeTabOptions['icon']\n): BottomTabsScreenProps['icon'] {\n if (!icon) {\n return undefined;\n }\n if ('sf' in icon && icon.sf) {\n return { sfSymbolName: icon.sf };\n } else if ('src' in icon && icon.src) {\n return { templateSource: icon.src };\n }\n return undefined;\n}\n\nconst supportedTabBarMinimizeBehaviorsSet = new Set<string>(SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);\nconst supportedTabBarItemLabelVisibilityModesSet = new Set<string>(\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES\n);\nconst supportedBlurEffectsSet = new Set<string>(SUPPORTED_BLUR_EFFECTS);\n\nfunction BottomTabsWrapper(props: BottomTabsProps) {\n const { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, tabBarBlurEffect, ...rest } =\n props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n throw new Error(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n throw new Error(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n }\n if (tabBarBlurEffect && !supportedBlurEffectsSet.has(tabBarBlurEffect)) {\n throw new Error(\n `Unsupported blurEffect: ${tabBarBlurEffect}. Supported values are: ${SUPPORTED_BLUR_EFFECTS.map((effect) => `\"${effect}\"`).join(', ')}`\n );\n }\n\n return (\n <BottomTabs\n tabBarBlurEffect={tabBarBlurEffect}\n tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode}\n tabBarMinimizeBehavior={tabBarMinimizeBehavior}\n {...rest}\n />\n );\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DefaultRouterOptions, ParamListBase, TabNavigationState, TabRouterOptions, useNavigationBuilder } from '@react-navigation/native';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';
|
|
4
|
-
import type {
|
|
4
|
+
import type { BottomTabsScreenProps } from 'react-native-screens';
|
|
5
5
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
6
|
-
export
|
|
6
|
+
export interface NativeTabOptions extends DefaultRouterOptions {
|
|
7
7
|
/**
|
|
8
8
|
* The icon to display in the tab bar.
|
|
9
9
|
* @platform android
|
|
@@ -21,7 +21,26 @@ export type NativeTabOptions = Omit<BottomTabsScreenProps, 'children' | 'placeho
|
|
|
21
21
|
* @platform iOS
|
|
22
22
|
*/
|
|
23
23
|
selectedIcon?: SfSymbolOrImageSource;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* @summary Title of the tab screen, displayed in the tab bar item.
|
|
26
|
+
*
|
|
27
|
+
* @platform android, ios
|
|
28
|
+
*/
|
|
29
|
+
title?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @summary Specifies content of tab bar item badge.
|
|
32
|
+
*
|
|
33
|
+
* On iOS, badge is displayed as regular string.
|
|
34
|
+
*
|
|
35
|
+
* On Android, the value is interpreted in the following order:
|
|
36
|
+
* - if the string can be parsed to integer, displays the value as a number;
|
|
37
|
+
* - otherwise if the string is empty, displays "small dot" badge;
|
|
38
|
+
* - otherwise, displays the value as a text.
|
|
39
|
+
*
|
|
40
|
+
* @platform android, ios
|
|
41
|
+
*/
|
|
42
|
+
badgeValue?: string;
|
|
43
|
+
}
|
|
25
44
|
export type SfSymbolOrImageSource = {
|
|
26
45
|
/**
|
|
27
46
|
* The name of the SF Symbol to use as an icon.
|
|
@@ -66,9 +85,26 @@ export interface NativeTabsStyleType {
|
|
|
66
85
|
vertical?: number;
|
|
67
86
|
};
|
|
68
87
|
/**
|
|
69
|
-
* @
|
|
88
|
+
* @summary Specifies the blur effect applied to the tab bar.
|
|
89
|
+
*
|
|
90
|
+
* Works with backgroundColor's alpha < 1.
|
|
91
|
+
*
|
|
92
|
+
* This property does not affect the tab bar starting from iOS 26.
|
|
93
|
+
*
|
|
94
|
+
* The following values are currently supported:
|
|
95
|
+
*
|
|
96
|
+
* - `none` - disables blur effect
|
|
97
|
+
* - `systemDefault` - uses UIKit's default tab bar blur effect
|
|
98
|
+
* - one of styles mapped from UIKit's UIBlurEffectStyle, e.g. `systemUltraThinMaterial`
|
|
99
|
+
*
|
|
100
|
+
* Complete list of possible blur effect styles is available in the official UIKit documentation:
|
|
101
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uiblureffect/style|UIBlurEffect.Style}
|
|
102
|
+
*
|
|
103
|
+
* @default systemDefault
|
|
104
|
+
*
|
|
105
|
+
* @platform iOS ≤ 18
|
|
70
106
|
*/
|
|
71
|
-
blurEffect?:
|
|
107
|
+
blurEffect?: NativeTabsBlurEffect;
|
|
72
108
|
/**
|
|
73
109
|
* @platform android
|
|
74
110
|
* @platform iOS
|
|
@@ -86,15 +122,34 @@ export interface NativeTabsStyleType {
|
|
|
86
122
|
*/
|
|
87
123
|
rippleColor?: ColorValue;
|
|
88
124
|
/**
|
|
125
|
+
* @summary Specifies the label visibility mode.
|
|
126
|
+
*
|
|
127
|
+
* The label visibility mode defines when the labels of each item bar should be displayed.
|
|
128
|
+
*
|
|
129
|
+
* The following values are available:
|
|
130
|
+
* - `auto` - the label behaves as in “labeled” mode when there are 3 items or less, or as in “selected” mode when there are 4 items or more
|
|
131
|
+
* - `selected` - the label is only shown on the selected navigation item
|
|
132
|
+
* - `labeled` - the label is shown on all navigation items
|
|
133
|
+
* - `unlabeled` - the label is hidden for all navigation items
|
|
134
|
+
*
|
|
135
|
+
* The supported values correspond to the official Material Components documentation:
|
|
136
|
+
* @see {@link https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible|Material Components documentation}
|
|
137
|
+
*
|
|
138
|
+
* @default auto
|
|
89
139
|
* @platform android
|
|
90
140
|
*/
|
|
91
|
-
labelVisibilityMode?:
|
|
141
|
+
labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;
|
|
92
142
|
/**
|
|
93
143
|
* @platform android
|
|
94
144
|
* @platform web
|
|
95
145
|
*/
|
|
96
146
|
'&:active'?: NativeTabsActiveStyleType;
|
|
97
147
|
}
|
|
148
|
+
export declare const SUPPORTED_BLUR_EFFECTS: readonly ["none", "systemDefault", "extraLight", "light", "dark", "regular", "prominent", "systemUltraThinMaterial", "systemThinMaterial", "systemMaterial", "systemThickMaterial", "systemChromeMaterial", "systemUltraThinMaterialLight", "systemThinMaterialLight", "systemMaterialLight", "systemThickMaterialLight", "systemChromeMaterialLight", "systemUltraThinMaterialDark", "systemThinMaterialDark", "systemMaterialDark", "systemThickMaterialDark", "systemChromeMaterialDark"];
|
|
149
|
+
/**
|
|
150
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uiblureffect/style|UIBlurEffect.Style}
|
|
151
|
+
*/
|
|
152
|
+
export type NativeTabsBlurEffect = (typeof SUPPORTED_BLUR_EFFECTS)[number];
|
|
98
153
|
export interface NativeTabsActiveStyleType {
|
|
99
154
|
/**
|
|
100
155
|
* @platform android
|
|
@@ -119,19 +174,27 @@ export interface NativeTabsActiveStyleType {
|
|
|
119
174
|
export interface NativeTabsProps extends PropsWithChildren {
|
|
120
175
|
style?: NativeTabsStyleType;
|
|
121
176
|
/**
|
|
122
|
-
*
|
|
177
|
+
* @summary Specifies the minimize behavior for the tab bar.
|
|
178
|
+
*
|
|
179
|
+
* Available starting from iOS 26.
|
|
180
|
+
*
|
|
181
|
+
* The following values are currently supported:
|
|
182
|
+
*
|
|
183
|
+
* - `automatic` - resolves to the system default minimize behavior
|
|
184
|
+
* - `never` - the tab bar does not minimize
|
|
185
|
+
* - `onScrollDown` - the tab bar minimizes when scrolling down and
|
|
186
|
+
* expands when scrolling back up
|
|
187
|
+
* - `onScrollUp` - the tab bar minimizes when scrolling up and expands
|
|
188
|
+
* when scrolling back down
|
|
123
189
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* - `onScrollUp` - The tab bar minimizes when scrolling up, and expands when scrolling back down. Recommended if the scroll view content is aligned to the bottom.
|
|
127
|
-
* - `onScrollDown` - The tab bar minimizes when scrolling down, and expands when scrolling back up.
|
|
128
|
-
* - `automatic` - Resolves to the system default minimize behavior.
|
|
190
|
+
* The supported values correspond to the official UIKit documentation:
|
|
191
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior|UITabBarController.MinimizeBehavior}
|
|
129
192
|
*
|
|
130
|
-
* @default automatic
|
|
193
|
+
* @default Defaults to `automatic`.
|
|
131
194
|
*
|
|
132
|
-
* @platform iOS 26
|
|
195
|
+
* @platform iOS 26+
|
|
133
196
|
*/
|
|
134
|
-
minimizeBehavior?:
|
|
197
|
+
minimizeBehavior?: NativeTabsTabBarMinimizeBehavior;
|
|
135
198
|
/**
|
|
136
199
|
* Disables the active indicator for the tab bar.
|
|
137
200
|
*
|
|
@@ -149,6 +212,20 @@ export interface NativeTabsViewProps extends NativeTabsProps {
|
|
|
149
212
|
focusedIndex: number;
|
|
150
213
|
builder: ReturnType<typeof useNavigationBuilder<TabNavigationState<ParamListBase>, TabRouterOptions, Record<string, (...args: any) => void>, NativeTabOptions, Record<string, any>>>;
|
|
151
214
|
}
|
|
215
|
+
export declare const SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES: readonly ["auto", "selected", "labeled", "unlabeled"];
|
|
216
|
+
/**
|
|
217
|
+
* @see {@link https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible|Material Components documentation}
|
|
218
|
+
*
|
|
219
|
+
* @platform android
|
|
220
|
+
*/
|
|
221
|
+
export type NativeTabsTabBarItemLabelVisibilityMode = (typeof SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES)[number];
|
|
222
|
+
export declare const SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS: readonly ["automatic", "never", "onScrollDown", "onScrollUp"];
|
|
223
|
+
/**
|
|
224
|
+
* @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior|UITabBarController.MinimizeBehavior}
|
|
225
|
+
*
|
|
226
|
+
* @platform iOS 26
|
|
227
|
+
*/
|
|
228
|
+
export type NativeTabsTabBarMinimizeBehavior = (typeof SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS)[number];
|
|
152
229
|
export interface NativeTabTriggerProps {
|
|
153
230
|
/**
|
|
154
231
|
* The name of the route.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D;;;;OAIG;IACH,IAAI,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CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC,EACtC,gBAAgB,EAChB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACpB,CACF,CAAC;CACH;AAED,eAAO,MAAM,6CAA6C,uDAKhD,CAAC;AAEX;;;;GAIG;AACH,MAAM,MAAM,uCAAuC,GACjD,CAAC,OAAO,6CAA6C,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,eAAO,MAAM,oCAAoC,+DAKvC,CAAC;AAEX;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAC1C,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B"}
|
|
@@ -1,3 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = exports.SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = exports.SUPPORTED_BLUR_EFFECTS = void 0;
|
|
4
|
+
exports.SUPPORTED_BLUR_EFFECTS = [
|
|
5
|
+
'none',
|
|
6
|
+
'systemDefault',
|
|
7
|
+
'extraLight',
|
|
8
|
+
'light',
|
|
9
|
+
'dark',
|
|
10
|
+
'regular',
|
|
11
|
+
'prominent',
|
|
12
|
+
'systemUltraThinMaterial',
|
|
13
|
+
'systemThinMaterial',
|
|
14
|
+
'systemMaterial',
|
|
15
|
+
'systemThickMaterial',
|
|
16
|
+
'systemChromeMaterial',
|
|
17
|
+
'systemUltraThinMaterialLight',
|
|
18
|
+
'systemThinMaterialLight',
|
|
19
|
+
'systemMaterialLight',
|
|
20
|
+
'systemThickMaterialLight',
|
|
21
|
+
'systemChromeMaterialLight',
|
|
22
|
+
'systemUltraThinMaterialDark',
|
|
23
|
+
'systemThinMaterialDark',
|
|
24
|
+
'systemMaterialDark',
|
|
25
|
+
'systemThickMaterialDark',
|
|
26
|
+
'systemChromeMaterialDark',
|
|
27
|
+
];
|
|
28
|
+
exports.SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = [
|
|
29
|
+
'auto',
|
|
30
|
+
'selected',
|
|
31
|
+
'labeled',
|
|
32
|
+
'unlabeled',
|
|
33
|
+
];
|
|
34
|
+
exports.SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = [
|
|
35
|
+
'automatic',
|
|
36
|
+
'never',
|
|
37
|
+
'onScrollDown',
|
|
38
|
+
'onScrollUp',
|
|
39
|
+
];
|
|
3
40
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DefaultRouterOptions,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport type { PropsWithChildren } from 'react';\nimport type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';\nimport type {\n BottomTabsProps,\n BottomTabsScreenProps,\n TabBarItemLabelVisibilityMode,\n} from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nexport type NativeTabOptions = Omit<\n BottomTabsScreenProps,\n | 'children'\n | 'placeholder'\n | 'onWillAppear'\n | 'onDidAppear'\n | 'onWillDisappear'\n | 'onDidDisappear'\n | 'isFocused'\n | 'tabKey'\n | 'icon'\n | 'selectedIcon'\n | 'iconResourceName'\n | 'specialEffects'\n> &\n DefaultRouterOptions & {\n /**\n * The icon to display in the tab bar.\n * @platform android\n * @platform iOS\n */\n icon?: SfSymbolOrImageSource & {\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n };\n /**\n * The icon to display when the tab is selected.\n * @platform iOS\n */\n selectedIcon?: SfSymbolOrImageSource;\n };\n\nexport type SfSymbolOrImageSource =\n | {\n /**\n * The name of the SF Symbol to use as an icon.\n * @platform iOS\n */\n sf?: SFSymbol;\n }\n | {\n /**\n * The image source to use as an icon.\n * @platform iOS\n */\n src?: ImageSourcePropType;\n };\n\nexport interface ExtendedNativeTabOptions extends NativeTabOptions {\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n specialEffects?: BottomTabsScreenProps['specialEffects'];\n}\n\ntype NumericFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n\nexport interface NativeTabsStyleType {\n fontFamily?: TextStyle['fontFamily'];\n fontSize?: TextStyle['fontSize'];\n fontWeight?: NumericFontWeight | `${NumericFontWeight}`;\n fontStyle?: TextStyle['fontStyle'];\n color?: TextStyle['color'];\n /**\n * @platform android\n * @platform iOS\n * @platform tvOS\n */\n iconColor?: ColorValue;\n backgroundColor?: ColorValue;\n /**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/titlepositionadjustment)\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * @platform iOS\n */\n blurEffect?: BottomTabsScreenProps['tabBarBlurEffect'];\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n tintColor?: ColorValue;\n badgeBackgroundColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * @platform android\n */\n labelVisibilityMode?: TabBarItemLabelVisibilityMode;\n /**\n * @platform android\n * @platform web\n */\n '&:active'?: NativeTabsActiveStyleType;\n}\n\nexport interface NativeTabsActiveStyleType {\n /**\n * @platform android\n * @platform web\n */\n color?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * @platform android\n */\n iconColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport interface NativeTabsProps extends PropsWithChildren {\n style?: NativeTabsStyleType;\n /**\n * https://developer.apple.com/documentation/uikit/uitabbarcontroller/tabbarminimizebehavior\n *\n * Supported values:\n * - `none` - The tab bar does not minimize.\n * - `onScrollUp` - The tab bar minimizes when scrolling up, and expands when scrolling back down. Recommended if the scroll view content is aligned to the bottom.\n * - `onScrollDown` - The tab bar minimizes when scrolling down, and expands when scrolling back up.\n * - `automatic` - Resolves to the system default minimize behavior.\n *\n * @default automatic\n *\n * @platform iOS 26\n */\n minimizeBehavior?: BottomTabsProps['tabBarMinimizeBehavior'];\n /**\n * Disables the active indicator for the tab bar.\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n}\n\nexport interface NativeTabsViewProps extends NativeTabsProps {\n focusedIndex: number;\n builder: ReturnType<\n typeof useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n NativeTabOptions,\n Record<string, any>\n >\n >;\n}\n\nexport interface NativeTabTriggerProps {\n /**\n * The name of the route.\n *\n * This is required when used inside a Layout component.\n *\n * When used in a route it has no effect.\n */\n name?: string;\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n /**\n * The options for the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components as children to customize the tab, rather then raw options.\n */\n options?: NativeTabOptions;\n /**\n * If true, the tab will not pop stack to the root when selected again.\n * @default false\n *\n * @platform ios\n */\n disablePopToTop?: boolean;\n /**\n * If true, the tab will not scroll to the top when selected again.\n * @default false\n *\n * @platform ios\n */\n disableScrollToTop?: boolean;\n /**\n * The children of the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components to customize the tab.\n */\n children?: React.ReactNode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":";;;AAiKa,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,eAAe;IACf,YAAY;IACZ,OAAO;IACP,MAAM;IACN,SAAS;IACT,WAAW;IACX,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,8BAA8B;IAC9B,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;CAClB,CAAC;AA+EE,QAAA,6CAA6C,GAAG;IAC3D,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;CACH,CAAC;AAUE,QAAA,oCAAoC,GAAG;IAClD,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC","sourcesContent":["import type {\n DefaultRouterOptions,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport type { PropsWithChildren } from 'react';\nimport type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';\nimport type { BottomTabsScreenProps } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nexport interface NativeTabOptions extends DefaultRouterOptions {\n /**\n * The icon to display in the tab bar.\n * @platform android\n * @platform iOS\n */\n icon?: SfSymbolOrImageSource & {\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n };\n /**\n * The icon to display when the tab is selected.\n * @platform iOS\n */\n selectedIcon?: SfSymbolOrImageSource;\n /**\n * @summary Title of the tab screen, displayed in the tab bar item.\n *\n * @platform android, ios\n */\n title?: string;\n /**\n * @summary Specifies content of tab bar item badge.\n *\n * On iOS, badge is displayed as regular string.\n *\n * On Android, the value is interpreted in the following order:\n * - if the string can be parsed to integer, displays the value as a number;\n * - otherwise if the string is empty, displays \"small dot\" badge;\n * - otherwise, displays the value as a text.\n *\n * @platform android, ios\n */\n badgeValue?: string;\n}\n\nexport type SfSymbolOrImageSource =\n | {\n /**\n * The name of the SF Symbol to use as an icon.\n * @platform iOS\n */\n sf?: SFSymbol;\n }\n | {\n /**\n * The image source to use as an icon.\n * @platform iOS\n */\n src?: ImageSourcePropType;\n };\n\nexport interface ExtendedNativeTabOptions extends NativeTabOptions {\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n specialEffects?: BottomTabsScreenProps['specialEffects'];\n}\n\ntype NumericFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n\nexport interface NativeTabsStyleType {\n fontFamily?: TextStyle['fontFamily'];\n fontSize?: TextStyle['fontSize'];\n fontWeight?: NumericFontWeight | `${NumericFontWeight}`;\n fontStyle?: TextStyle['fontStyle'];\n color?: TextStyle['color'];\n /**\n * @platform android\n * @platform iOS\n * @platform tvOS\n */\n iconColor?: ColorValue;\n backgroundColor?: ColorValue;\n /**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/titlepositionadjustment)\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * @summary Specifies the blur effect applied to the tab bar.\n *\n * Works with backgroundColor's alpha < 1.\n *\n * This property does not affect the tab bar starting from iOS 26.\n *\n * The following values are currently supported:\n *\n * - `none` - disables blur effect\n * - `systemDefault` - uses UIKit's default tab bar blur effect\n * - one of styles mapped from UIKit's UIBlurEffectStyle, e.g. `systemUltraThinMaterial`\n *\n * Complete list of possible blur effect styles is available in the official UIKit documentation:\n * @see {@link https://developer.apple.com/documentation/uikit/uiblureffect/style|UIBlurEffect.Style}\n *\n * @default systemDefault\n *\n * @platform iOS ≤ 18\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n tintColor?: ColorValue;\n badgeBackgroundColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * @summary Specifies the label visibility mode.\n *\n * The label visibility mode defines when the labels of each item bar should be displayed.\n *\n * The following values are available:\n * - `auto` - the label behaves as in “labeled” mode when there are 3 items or less, or as in “selected” mode when there are 4 items or more\n * - `selected` - the label is only shown on the selected navigation item\n * - `labeled` - the label is shown on all navigation items\n * - `unlabeled` - the label is hidden for all navigation items\n *\n * The supported values correspond to the official Material Components documentation:\n * @see {@link https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible|Material Components documentation}\n *\n * @default auto\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * @platform android\n * @platform web\n */\n '&:active'?: NativeTabsActiveStyleType;\n}\n\nexport const SUPPORTED_BLUR_EFFECTS = [\n 'none',\n 'systemDefault',\n 'extraLight',\n 'light',\n 'dark',\n 'regular',\n 'prominent',\n 'systemUltraThinMaterial',\n 'systemThinMaterial',\n 'systemMaterial',\n 'systemThickMaterial',\n 'systemChromeMaterial',\n 'systemUltraThinMaterialLight',\n 'systemThinMaterialLight',\n 'systemMaterialLight',\n 'systemThickMaterialLight',\n 'systemChromeMaterialLight',\n 'systemUltraThinMaterialDark',\n 'systemThinMaterialDark',\n 'systemMaterialDark',\n 'systemThickMaterialDark',\n 'systemChromeMaterialDark',\n] as const;\n\n/**\n * @see {@link https://developer.apple.com/documentation/uikit/uiblureffect/style|UIBlurEffect.Style}\n */\nexport type NativeTabsBlurEffect = (typeof SUPPORTED_BLUR_EFFECTS)[number];\n\nexport interface NativeTabsActiveStyleType {\n /**\n * @platform android\n * @platform web\n */\n color?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * @platform android\n */\n iconColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport interface NativeTabsProps extends PropsWithChildren {\n style?: NativeTabsStyleType;\n /**\n * @summary Specifies the minimize behavior for the tab bar.\n *\n * Available starting from iOS 26.\n *\n * The following values are currently supported:\n *\n * - `automatic` - resolves to the system default minimize behavior\n * - `never` - the tab bar does not minimize\n * - `onScrollDown` - the tab bar minimizes when scrolling down and\n * expands when scrolling back up\n * - `onScrollUp` - the tab bar minimizes when scrolling up and expands\n * when scrolling back down\n *\n * The supported values correspond to the official UIKit documentation:\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior|UITabBarController.MinimizeBehavior}\n *\n * @default Defaults to `automatic`.\n *\n * @platform iOS 26+\n */\n minimizeBehavior?: NativeTabsTabBarMinimizeBehavior;\n /**\n * Disables the active indicator for the tab bar.\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n}\nexport interface NativeTabsViewProps extends NativeTabsProps {\n focusedIndex: number;\n builder: ReturnType<\n typeof useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n NativeTabOptions,\n Record<string, any>\n >\n >;\n}\n\nexport const SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = [\n 'auto',\n 'selected',\n 'labeled',\n 'unlabeled',\n] as const;\n\n/**\n * @see {@link https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible|Material Components documentation}\n *\n * @platform android\n */\nexport type NativeTabsTabBarItemLabelVisibilityMode =\n (typeof SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES)[number];\n\nexport const SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\n\n/**\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior|UITabBarController.MinimizeBehavior}\n *\n * @platform iOS 26\n */\nexport type NativeTabsTabBarMinimizeBehavior =\n (typeof SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS)[number];\n\nexport interface NativeTabTriggerProps {\n /**\n * The name of the route.\n *\n * This is required when used inside a Layout component.\n *\n * When used in a route it has no effect.\n */\n name?: string;\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n /**\n * The options for the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components as children to customize the tab, rather then raw options.\n */\n options?: NativeTabOptions;\n /**\n * If true, the tab will not pop stack to the root when selected again.\n * @default false\n *\n * @platform ios\n */\n disablePopToTop?: boolean;\n /**\n * If true, the tab will not scroll to the top when selected again.\n * @default false\n *\n * @platform ios\n */\n disableScrollToTop?: boolean;\n /**\n * The children of the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components to customize the tab.\n */\n children?: React.ReactNode;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './common/elements';
|
|
2
|
-
export type { NativeTabsProps, NativeTabTriggerProps, NativeTabsStyleType, NativeTabsActiveStyleType, NativeTabOptions, SfSymbolOrImageSource, } from './NativeBottomTabs/types';
|
|
2
|
+
export type { NativeTabsProps, NativeTabTriggerProps, NativeTabsStyleType, NativeTabsActiveStyleType, NativeTabOptions, SfSymbolOrImageSource, NativeTabsTabBarItemLabelVisibilityMode, NativeTabsBlurEffect, NativeTabsTabBarMinimizeBehavior, } from './NativeBottomTabs/types';
|
|
3
3
|
export { NativeTabTrigger } from './NativeBottomTabs/NativeTabTrigger';
|
|
4
4
|
export { NativeTabs } from './NativeBottomTabs/NativeTabs';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,uCAAuC,EACvC,oBAAoB,EACpB,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAYlC,wEAAuE;AAA9D,oHAAA,gBAAgB,OAAA;AACzB,4DAA2D;AAAlD,wGAAA,UAAU,OAAA","sourcesContent":["export * from './common/elements';\nexport type {\n NativeTabsProps,\n NativeTabTriggerProps,\n NativeTabsStyleType,\n NativeTabsActiveStyleType,\n NativeTabOptions,\n SfSymbolOrImageSource,\n NativeTabsTabBarItemLabelVisibilityMode,\n NativeTabsBlurEffect,\n NativeTabsTabBarMinimizeBehavior,\n} from './NativeBottomTabs/types';\nexport { NativeTabTrigger } from './NativeBottomTabs/NativeTabTrigger';\nexport { NativeTabs } from './NativeBottomTabs/NativeTabs';\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const internalExpoRouterParamNames: readonly ["__internal_expo_router_no_animation", "__internal__expo_router_is_preview_navigation"];
|
|
2
|
+
export type InternalExpoRouterParamName = (typeof internalExpoRouterParamNames)[number];
|
|
3
|
+
export type InternalExpoRouterParams = Partial<Record<InternalExpoRouterParamName, unknown>>;
|
|
4
|
+
export declare function appendInternalExpoRouterParams(params: Record<string, unknown> | object | undefined, expoParams: InternalExpoRouterParams): Record<string, unknown> | undefined;
|
|
5
|
+
export declare function getInternalExpoRouterParams(_params: Record<string, unknown> | object | undefined): InternalExpoRouterParams;
|
|
6
|
+
export declare function removeInternalExpoRouterParams(params: Record<string, unknown> | object): Record<string, unknown> | object;
|
|
7
|
+
export declare function removeInternalExpoRouterParams(params: Record<string, unknown> | object | undefined): Record<string, unknown> | object | undefined;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=navigationParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigationParams.d.ts","sourceRoot":"","sources":["../src/navigationParams.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,4BAA4B,mGAGxB,CAAC;AAEX,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AACxF,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7F,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,EACpD,UAAU,EAAE,wBAAwB,uCAyBrC;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,GACpD,wBAAwB,CAiB1B;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GACvC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;AACpC,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,GACnD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appendInternalExpoRouterParams = appendInternalExpoRouterParams;
|
|
4
|
+
exports.getInternalExpoRouterParams = getInternalExpoRouterParams;
|
|
5
|
+
exports.removeInternalExpoRouterParams = removeInternalExpoRouterParams;
|
|
6
|
+
const INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME = '__internal_expo_router_no_animation';
|
|
7
|
+
const INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME = '__internal__expo_router_is_preview_navigation';
|
|
8
|
+
const internalExpoRouterParamNames = [
|
|
9
|
+
INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,
|
|
10
|
+
INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,
|
|
11
|
+
];
|
|
12
|
+
function appendInternalExpoRouterParams(params, expoParams) {
|
|
13
|
+
let newParams = {};
|
|
14
|
+
// Using nested params is a workaround for the issue with the preview key not being passed to the params
|
|
15
|
+
// https://github.com/Ubax/react-navigation/blob/main/packages/core/src/useNavigationBuilder.tsx#L573
|
|
16
|
+
// Another solution would be to propagate the preview key in the useNavigationBuilder,
|
|
17
|
+
// but that would require us to fork the @react-navigation/core package.
|
|
18
|
+
let nestedParams = {};
|
|
19
|
+
if (params) {
|
|
20
|
+
newParams = { ...params };
|
|
21
|
+
if ('params' in params) {
|
|
22
|
+
if (typeof params.params === 'object' && params.params) {
|
|
23
|
+
nestedParams = params.params;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
nestedParams = { ...nestedParams, ...expoParams };
|
|
28
|
+
newParams = { ...newParams, ...expoParams };
|
|
29
|
+
if (Object.keys(nestedParams).length > 0) {
|
|
30
|
+
newParams.params = nestedParams;
|
|
31
|
+
}
|
|
32
|
+
if (Object.keys(newParams).length === 0 && params === undefined) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return newParams;
|
|
36
|
+
}
|
|
37
|
+
function getInternalExpoRouterParams(_params) {
|
|
38
|
+
const expoParams = {};
|
|
39
|
+
const params = _params ? _params : {};
|
|
40
|
+
const nestedParams = 'params' in params && typeof params.params === 'object' && params.params
|
|
41
|
+
? params.params
|
|
42
|
+
: {};
|
|
43
|
+
for (const key of internalExpoRouterParamNames) {
|
|
44
|
+
if (key in params) {
|
|
45
|
+
expoParams[key] = params[key];
|
|
46
|
+
}
|
|
47
|
+
else if (key in nestedParams) {
|
|
48
|
+
expoParams[key] = nestedParams[key];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return expoParams;
|
|
52
|
+
}
|
|
53
|
+
function removeInternalExpoRouterParams(params) {
|
|
54
|
+
if (!params) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const newNestedParams = 'params' in params && typeof params.params === 'object' && params.params
|
|
58
|
+
? Object.fromEntries(Object.entries(params.params).filter(([key]) => !internalExpoRouterParamNames.includes(key)))
|
|
59
|
+
: {};
|
|
60
|
+
const newParams = Object.fromEntries(Object.entries(params).filter(([key]) => !internalExpoRouterParamNames.includes(key) &&
|
|
61
|
+
key !== 'params'));
|
|
62
|
+
if (Object.keys(newNestedParams).length > 0) {
|
|
63
|
+
return { ...newParams, params: newNestedParams };
|
|
64
|
+
}
|
|
65
|
+
return newParams;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=navigationParams.js.map
|
|
@@ -0,0 +1 @@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EAAE,CACR,CAAC,4BAA4B,CAAC,QAAQ,CAAC,GAAkC,CAAC;QAC1E,GAAG,KAAK,QAAQ,CACnB,CACF,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACnD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["const INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME = '__internal_expo_router_no_animation';\nconst INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME =\n '__internal__expo_router_is_preview_navigation';\n\nconst internalExpoRouterParamNames = [\n INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,\n] as const;\n\nexport type InternalExpoRouterParamName = (typeof internalExpoRouterParamNames)[number];\nexport type InternalExpoRouterParams = Partial<Record<InternalExpoRouterParamName, unknown>>;\n\nexport function appendInternalExpoRouterParams(\n params: Record<string, unknown> | object | undefined,\n expoParams: InternalExpoRouterParams\n) {\n let newParams: Record<string, unknown> = {};\n // Using nested params is a workaround for the issue with the preview key not being passed to the params\n // https://github.com/Ubax/react-navigation/blob/main/packages/core/src/useNavigationBuilder.tsx#L573\n // Another solution would be to propagate the preview key in the useNavigationBuilder,\n // but that would require us to fork the @react-navigation/core package.\n let nestedParams: Record<string, unknown> = {};\n if (params) {\n newParams = { ...params };\n if ('params' in params) {\n if (typeof params.params === 'object' && params.params) {\n nestedParams = params.params as Record<string, unknown>;\n }\n }\n }\n nestedParams = { ...nestedParams, ...expoParams };\n newParams = { ...newParams, ...expoParams };\n if (Object.keys(nestedParams).length > 0) {\n newParams.params = nestedParams;\n }\n if (Object.keys(newParams).length === 0 && params === undefined) {\n return undefined;\n }\n return newParams;\n}\n\nexport function getInternalExpoRouterParams(\n _params: Record<string, unknown> | object | undefined\n): InternalExpoRouterParams {\n const expoParams: InternalExpoRouterParams = {};\n const params: Record<string, unknown> = _params ? (_params as Record<string, unknown>) : {};\n const nestedParams: Record<string, unknown> =\n 'params' in params && typeof params.params === 'object' && params.params\n ? (params.params as Record<string, unknown>)\n : {};\n\n for (const key of internalExpoRouterParamNames) {\n if (key in params) {\n expoParams[key] = params[key];\n } else if (key in nestedParams) {\n expoParams[key] = nestedParams[key];\n }\n }\n\n return expoParams;\n}\n\nexport function removeInternalExpoRouterParams(\n params: Record<string, unknown> | object\n): Record<string, unknown> | object;\nexport function removeInternalExpoRouterParams(\n params: Record<string, unknown> | object | undefined\n): Record<string, unknown> | object | undefined;\nexport function removeInternalExpoRouterParams(\n params: Record<string, unknown> | object | undefined\n): Record<string, unknown> | object | undefined {\n if (!params) {\n return undefined;\n }\n const newNestedParams =\n 'params' in params && typeof params.params === 'object' && params.params\n ? Object.fromEntries(\n Object.entries(params.params).filter(\n ([key]) => !internalExpoRouterParamNames.includes(key as InternalExpoRouterParamName)\n )\n )\n : {};\n const newParams = Object.fromEntries(\n Object.entries(params).filter(\n ([key]) =>\n !internalExpoRouterParamNames.includes(key as InternalExpoRouterParamName) &&\n key !== 'params'\n )\n );\n if (Object.keys(newNestedParams).length > 0) {\n return { ...newParams, params: newNestedParams };\n }\n return newParams;\n}\n"]}
|
package/build/ui/Slot.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ForwardRefExoticComponent, type Component, type RefAttributes } from 'react';
|
|
2
|
+
import { type ViewProps } from 'react-native';
|
|
3
|
+
export interface Slot<Props = ViewProps, Ref = Component<ViewProps>> extends ForwardRefExoticComponent<Props & RefAttributes<Ref>> {
|
|
4
|
+
}
|
|
5
|
+
export declare const Slot: Slot;
|
|
2
6
|
//# sourceMappingURL=Slot.d.ts.map
|
package/build/ui/Slot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slot.d.ts","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Slot.d.ts","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAsB1D,MAAM,WAAW,IAAI,CAAC,KAAK,GAAG,SAAS,EAAE,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CACjE,SAAQ,yBAAyB,CAAC,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;CAAG;AAElE,eAAO,MAAM,IAAI,EAAE,IAA8C,CAAC"}
|