expo-router 6.0.0-beta.0 → 6.0.0-beta.10
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/assets/modal.module.css +15 -14
- package/assets/native-tabs.module.css +109 -0
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +0 -2
- package/build/ExpoRoot.js.map +1 -1
- package/build/fork/NavigationContainer.d.ts.map +1 -1
- package/build/fork/NavigationContainer.js +2 -0
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/extractPathFromURL.d.ts.map +1 -1
- package/build/fork/extractPathFromURL.js +4 -0
- package/build/fork/extractPathFromURL.js.map +1 -1
- 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 +6 -5
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +20 -14
- package/build/global-state/routing.js.map +1 -1
- package/build/head/ExpoHead.android.d.ts +1 -3
- package/build/imperative-api.d.ts +3 -1
- package/build/imperative-api.d.ts.map +1 -1
- package/build/imperative-api.js +4 -4
- package/build/imperative-api.js.map +1 -1
- package/build/layouts/DrawerClient.d.ts +2 -12
- package/build/layouts/DrawerClient.d.ts.map +1 -1
- package/build/layouts/StackClient.d.ts +14 -19
- 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/layouts/TabsClient.d.ts +3 -18
- package/build/layouts/TabsClient.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +5 -1
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +19 -6
- package/build/layouts/withLayoutContext.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 +19 -24
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +2 -10
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +1 -1
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +0 -2
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +1 -11
- package/build/link/preview/native.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/modal/web/ModalStackRouteDrawer.js +9 -10
- package/build/modal/web/ModalStackRouteDrawer.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 +61 -9
- 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/NativeTabTrigger.d.ts +11 -3
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +154 -62
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +3 -2
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts +24 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js +28 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js.map +1 -0
- 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 +114 -38
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts +4 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js +158 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/appearance.d.ts +20 -0
- package/build/native-tabs/NativeBottomTabs/appearance.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/appearance.js +119 -0
- package/build/native-tabs/NativeBottomTabs/appearance.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/types.d.ts +312 -46
- package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/types.js +51 -0
- package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +84 -21
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js +23 -0
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/index.d.ts +2 -1
- package/build/native-tabs/index.d.ts.map +1 -1
- package/build/native-tabs/index.js +3 -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/rsc/router/client.d.ts +1 -3
- package/build/rsc/router/client.d.ts.map +1 -1
- package/build/testing-library/index.d.ts +15 -4
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/index.js +31 -28
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mocks.js +0 -7
- package/build/testing-library/mocks.js.map +1 -1
- package/build/typed-routes/generate.d.ts +2 -1
- package/build/typed-routes/generate.d.ts.map +1 -1
- package/build/typed-routes/generate.js +3 -1
- package/build/typed-routes/generate.js.map +1 -1
- 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/TabContext.d.ts +11 -21
- package/build/ui/TabContext.d.ts.map +1 -1
- package/build/ui/TabRouter.d.ts +7 -0
- package/build/ui/TabRouter.d.ts.map +1 -1
- package/build/ui/Tabs.d.ts +14 -23
- 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/build/useFocusEffect.js +1 -1
- package/build/useFocusEffect.js.map +1 -1
- package/build/useScreens.d.ts +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +6 -4
- package/build/useScreens.js.map +1 -1
- package/ios/ExpoHead.podspec +2 -0
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +7 -9
- package/ios/LinkPreview/LinkPreviewNativeView.swift +13 -28
- package/package.json +22 -24
- package/plugin/build/index.js +1 -1
- package/plugin/src/index.ts +1 -1
- package/ios/LinkPreview/LinkPreviewNativeTriggerView.swift +0 -9
- package/plugin/tsconfig.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,wCAkGC;AAvHD,+CAAsC;AACtC,+DAM8B;AAG9B,mCAA6C;AAC7C,gDAAsD;AAEtD,8F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ACpD,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 enableFreeze,\n featureFlags,\n type BottomTabsScreenProps,\n} from 'react-native-screens';\n\nimport type { NativeTabOptions, NativeTabsViewProps } from './types';\nimport { shouldTabBeVisible } from './utils';\nimport { getPathFromState } from '../../link/linking';\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\n// TODO: ENG-16896: Enable freeze globally and disable only for NativeTabsView\nenableFreeze(false);\n\n// TODO: Add support for dynamic params inside a route\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, style, minimizeBehavior, disableIndicator } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n\n let focusedIndex = state.index;\n const isAnyRouteFocused =\n routes[focusedIndex].key &&\n descriptors[routes[focusedIndex].key] &&\n shouldTabBeVisible(descriptors[routes[focusedIndex].key].options);\n\n if (!isAnyRouteFocused) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The focused tab in NativeTabsView cannot be displayed. Make sure path is correct and the route is not hidden. Path: \"${getPathFromState(state)}\"`\n );\n }\n // Set focusedIndex to the first visible tab\n focusedIndex = routes.findIndex((route) => shouldTabBeVisible(descriptors[route.key].options));\n }\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 === lastNotNativeTransitionIndex.current;\n const title = descriptor.options.title ?? route.name;\n\n return (\n <BottomTabsScreen\n key={route.key}\n {...descriptor.options}\n iconResourceName={descriptor.options.icon?.drawable}\n icon={convertOptionsIconToPropsIcon(descriptor.options.icon)}\n selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)}\n title={title}\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 tabBarItemTitleFontWeight={style?.fontWeight}\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":["../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6C,CAC9C,CAAC;AAEF,SAAS,iBAAiB,CAAC,KAAsB;IAC/C,IAAI,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC/E,IAAI,sBAAsB,IAAI,CAAC,mCAAmC,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAC/F,OAAO,CAAC,IAAI,CACV,iCAAiC,sBAAsB,2BAA2B,4CAAoC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvK,CAAC;QACF,sBAAsB,GAAG,SAAS,CAAC;IACrC,CAAC;IACD,IACE,6BAA6B;QAC7B,CAAC,0CAA0C,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC9E,CAAC;QACD,OAAO,CAAC,IAAI,CACV,oCAAoC,6BAA6B,2BAA2B,qDAA6C,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClL,CAAC;QACF,6BAA6B,GAAG,SAAS,CAAC;IAC5C,CAAC;IAED,OAAO,CACL,CAAC,iCAAU,CACT,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, useEffect, useMemo, useState } from 'react';\nimport type { ColorValue, ImageSourcePropType } from 'react-native';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenAppearance,\n type BottomTabsScreenProps,\n} from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport {\n appendSelectedStyleToAppearance,\n convertStyleToAppearance,\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\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\nconst supportedBlurEffectsSet = new Set<string>(SUPPORTED_BLUR_EFFECTS);\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, minimizeBehavior, disableIndicator, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n\n let blurEffect = props.blurEffect;\n if (blurEffect && !supportedBlurEffectsSet.has(blurEffect)) {\n console.warn(\n `Unsupported blurEffect: ${blurEffect}. Supported values are: ${SUPPORTED_BLUR_EFFECTS.map(\n (effect) => `\"${effect}\"`\n ).join(', ')}`\n );\n blurEffect = undefined;\n }\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n let standardAppearance = convertStyleToAppearance({\n ...props.labelStyle,\n iconColor: props.iconColor,\n blurEffect,\n backgroundColor: props.backgroundColor,\n badgeBackgroundColor: props.badgeBackgroundColor,\n });\n if (props.tintColor) {\n standardAppearance = appendSelectedStyleToAppearance(\n { iconColor: props.tintColor, color: props.tintColor },\n standardAppearance\n );\n }\n const scrollEdgeAppearance = convertStyleToAppearance({\n ...props.labelStyle,\n iconColor: props.iconColor,\n blurEffect,\n backgroundColor: props.backgroundColor,\n badgeBackgroundColor: props.badgeBackgroundColor,\n });\n\n const appearances = routes.map((route) => ({\n standardAppearance: createStandardAppearanceFromOptions(\n descriptors[route.key].options,\n standardAppearance\n ),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(\n descriptors[route.key].options,\n scrollEdgeAppearance\n ),\n }));\n\n const options = routes.map((route) => descriptors[route.key].options);\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\n return (\n <Screen\n key={route.key}\n routeKey={route.key}\n name={route.name}\n descriptor={descriptor}\n isFocused={isFocused}\n standardAppearance={appearances[index].standardAppearance}\n scrollEdgeAppearance={appearances[index].scrollEdgeAppearance}\n badgeTextColor={props.badgeTextColor}\n />\n );\n });\n\n return (\n <BottomTabsWrapper\n // #region android props\n tabBarItemTitleFontColor={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontColor\n }\n tabBarItemTitleFontFamily={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontFamily\n }\n tabBarItemTitleFontSize={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontSize\n }\n tabBarItemTitleFontSizeActive={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontSize\n }\n tabBarItemTitleFontWeight={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontWeight\n }\n tabBarItemTitleFontStyle={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontStyle\n }\n tabBarItemIconColor={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal?.tabBarItemIconColor\n }\n tabBarBackgroundColor={\n appearances[deferredFocusedIndex].standardAppearance.tabBarBackgroundColor ??\n props.backgroundColor ??\n undefined\n }\n tabBarItemRippleColor={props.rippleColor}\n tabBarItemLabelVisibilityMode={props.labelVisibilityMode}\n tabBarItemIconColorActive={\n appearances[deferredFocusedIndex].standardAppearance?.stacked?.selected\n ?.tabBarItemIconColor ?? props?.tintColor\n }\n tabBarItemTitleFontColorActive={\n appearances[deferredFocusedIndex].standardAppearance?.stacked?.selected\n ?.tabBarItemTitleFontColor ?? props?.tintColor\n }\n // tabBarItemTitleFontSizeActive={activeStyle?.fontSize}\n tabBarItemActiveIndicatorColor={\n options[deferredFocusedIndex]?.indicatorColor ?? props?.indicatorColor\n }\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n // #endregion\n // #region iOS props\n tabBarTintColor={props?.tintColor}\n tabBarMinimizeBehavior={minimizeBehavior}\n // #endregion\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 Screen(props: {\n routeKey: string;\n name: string;\n descriptor: NativeTabsViewProps['builder']['descriptors'][string];\n isFocused: boolean;\n standardAppearance: BottomTabsScreenAppearance;\n scrollEdgeAppearance: BottomTabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n}) {\n const {\n routeKey,\n name,\n descriptor,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n } = props;\n const role = descriptor.options.role;\n // To align with apple documentation and prevent untested cases,\n // title and icon cannot be changed when role is defined\n const shouldResetTitleAndIcon = !!role && process.env.EXPO_OS === 'ios';\n\n const title = descriptor.options.title ?? name;\n\n const icon = useAwaitedScreensIcon(descriptor.options.icon);\n const selectedIcon = useAwaitedScreensIcon(descriptor.options.selectedIcon);\n\n return (\n <BottomTabsScreen\n {...descriptor.options}\n tabBarItemBadgeBackgroundColor={\n standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor\n }\n tabBarItemBadgeTextColor={badgeTextColor}\n standardAppearance={standardAppearance}\n scrollEdgeAppearance={scrollEdgeAppearance}\n iconResourceName={getAndroidIconResourceName(icon)}\n iconResource={getAndroidIconResource(icon)}\n icon={shouldResetTitleAndIcon ? undefined : convertOptionsIconToPropsIcon(icon)}\n selectedIcon={\n shouldResetTitleAndIcon ? undefined : convertOptionsIconToPropsIcon(selectedIcon)\n }\n title={shouldResetTitleAndIcon ? undefined : title}\n freezeContents={false}\n tabKey={routeKey}\n systemItem={descriptor.options.role}\n isFocused={isFocused}>\n {descriptor.render()}\n </BottomTabsScreen>\n );\n}\n\ntype AwaitedIcon =\n | {\n sf?: SFSymbol;\n drawable?: string;\n }\n | {\n src?: ImageSourcePropType;\n };\n\nfunction useAwaitedScreensIcon(icon: NativeTabOptions['icon']) {\n const src = icon && typeof icon === 'object' && 'src' in icon ? icon.src : undefined;\n const [awaitedIcon, setAwaitedIcon] = useState<AwaitedIcon | undefined>(undefined);\n\n useEffect(() => {\n const loadIcon = async () => {\n if (src && src instanceof Promise) {\n const currentAwaitedIcon = { src: await src };\n setAwaitedIcon(currentAwaitedIcon);\n }\n };\n loadIcon();\n // Checking `src` rather then icon here, to avoid unnecessary re-renders\n // The icon object can be recreated, while src should stay the same\n // In this case as we control `VectorIcon`, it will only change if `family` or `name` props change\n // So we should be safe with promise resolving\n }, [src]);\n\n return useMemo(() => (isAwaitedIcon(icon) ? icon : awaitedIcon), [awaitedIcon, icon]);\n}\n\nfunction isAwaitedIcon(icon: NativeTabOptions['icon']): icon is AwaitedIcon {\n return !icon || !('src' in icon && icon.src instanceof Promise);\n}\n\nfunction convertOptionsIconToPropsIcon(\n icon: AwaitedIcon | undefined\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\nfunction getAndroidIconResource(\n icon: AwaitedIcon | undefined\n): BottomTabsScreenProps['iconResource'] {\n if (icon && 'src' in icon && icon.src) {\n return icon.src;\n }\n return undefined;\n}\n\nfunction getAndroidIconResourceName(\n icon: AwaitedIcon | undefined\n): BottomTabsScreenProps['iconResourceName'] {\n if (icon && 'drawable' in icon && icon.drawable) {\n return icon.drawable;\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);\n\nfunction BottomTabsWrapper(props: BottomTabsProps) {\n let { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, ...rest } = props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n console.warn(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n tabBarMinimizeBehavior = undefined;\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n console.warn(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n tabBarItemLabelVisibilityMode = undefined;\n }\n\n return (\n <BottomTabs\n tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode}\n tabBarMinimizeBehavior={tabBarMinimizeBehavior}\n {...rest}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeTabsView.web.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAIrE,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAwDxD"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.NativeTabsView = NativeTabsView;
|
|
40
|
+
const react_tabs_1 = require("@radix-ui/react-tabs");
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const utils_1 = require("./utils");
|
|
43
|
+
const native_tabs_module_css_1 = __importDefault(require("../../../assets/native-tabs.module.css"));
|
|
44
|
+
function NativeTabsView(props) {
|
|
45
|
+
const { builder, focusedIndex } = props;
|
|
46
|
+
const { state, descriptors, navigation } = builder;
|
|
47
|
+
const { routes } = state;
|
|
48
|
+
const defaultTabName = (0, react_1.useMemo)(() => state.routes[focusedIndex]?.name ?? state.routes[0].name, []);
|
|
49
|
+
const value = state.routes[focusedIndex]?.name ?? state.routes[0].name;
|
|
50
|
+
const currentTabKey = state.routes[focusedIndex]?.key ?? state.routes[0].key;
|
|
51
|
+
const items = routes
|
|
52
|
+
.filter(({ key }) => (0, utils_1.shouldTabBeVisible)(descriptors[key].options))
|
|
53
|
+
.map((route) => (<TabItem key={route.key} route={route} title={descriptors[route.key].options.title ?? route.name} badgeValue={descriptors[route.key].options.badgeValue}/>));
|
|
54
|
+
const children = routes
|
|
55
|
+
.filter(({ key }) => (0, utils_1.shouldTabBeVisible)(descriptors[key].options))
|
|
56
|
+
.map((route) => {
|
|
57
|
+
return (<react_tabs_1.TabsContent key={route.name} value={route.name} className={native_tabs_module_css_1.default.tabContent} forceMount>
|
|
58
|
+
{descriptors[route.key].render()}
|
|
59
|
+
</react_tabs_1.TabsContent>);
|
|
60
|
+
});
|
|
61
|
+
return (<react_tabs_1.Tabs className={native_tabs_module_css_1.default.nativeTabsContainer} defaultValue={defaultTabName} value={value} onValueChange={(value) => {
|
|
62
|
+
navigation.dispatch({
|
|
63
|
+
type: 'JUMP_TO',
|
|
64
|
+
target: state.key,
|
|
65
|
+
payload: {
|
|
66
|
+
name: value,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}} style={convertNativeTabsPropsToStyleVars(props, descriptors[currentTabKey]?.options)}>
|
|
70
|
+
<react_tabs_1.TabsList aria-label="Main" className={native_tabs_module_css_1.default.navigationMenuRoot}>
|
|
71
|
+
{items}
|
|
72
|
+
</react_tabs_1.TabsList>
|
|
73
|
+
{children}
|
|
74
|
+
</react_tabs_1.Tabs>);
|
|
75
|
+
}
|
|
76
|
+
function TabItem(props) {
|
|
77
|
+
const { title, badgeValue, route } = props;
|
|
78
|
+
const isBadgeEmpty = badgeValue === ' ';
|
|
79
|
+
return (<react_tabs_1.TabsTrigger value={route.name} className={native_tabs_module_css_1.default.navigationMenuTrigger}>
|
|
80
|
+
<span className={native_tabs_module_css_1.default.tabText}>{title}</span>
|
|
81
|
+
{badgeValue && (<div className={`${native_tabs_module_css_1.default.tabBadge} ${isBadgeEmpty ? native_tabs_module_css_1.default.emptyTabBadge : ''}`}>
|
|
82
|
+
{badgeValue}
|
|
83
|
+
</div>)}
|
|
84
|
+
</react_tabs_1.TabsTrigger>);
|
|
85
|
+
}
|
|
86
|
+
function convertNativeTabsPropsToStyleVars(props, currentTabOptions) {
|
|
87
|
+
const vars = {};
|
|
88
|
+
if (!props) {
|
|
89
|
+
return vars;
|
|
90
|
+
}
|
|
91
|
+
const { labelStyle } = props;
|
|
92
|
+
const optionsLabelStyle = currentTabOptions?.labelStyle;
|
|
93
|
+
if (optionsLabelStyle?.fontFamily) {
|
|
94
|
+
vars['--expo-router-tabs-font-family'] = String(optionsLabelStyle.fontFamily);
|
|
95
|
+
}
|
|
96
|
+
else if (labelStyle?.fontFamily) {
|
|
97
|
+
vars['--expo-router-tabs-font-family'] = String(labelStyle.fontFamily);
|
|
98
|
+
}
|
|
99
|
+
if (optionsLabelStyle?.fontSize) {
|
|
100
|
+
vars['--expo-router-tabs-font-size'] = String(optionsLabelStyle.fontSize);
|
|
101
|
+
}
|
|
102
|
+
else if (labelStyle?.fontSize) {
|
|
103
|
+
vars['--expo-router-tabs-font-size'] = String(labelStyle.fontSize);
|
|
104
|
+
}
|
|
105
|
+
if (optionsLabelStyle?.fontWeight) {
|
|
106
|
+
vars['--expo-router-tabs-font-weight'] = String(optionsLabelStyle.fontWeight);
|
|
107
|
+
}
|
|
108
|
+
else if (labelStyle?.fontWeight) {
|
|
109
|
+
vars['--expo-router-tabs-font-weight'] = String(labelStyle.fontWeight);
|
|
110
|
+
}
|
|
111
|
+
if (optionsLabelStyle?.fontStyle) {
|
|
112
|
+
vars['--expo-router-tabs-font-style'] = String(optionsLabelStyle.fontStyle);
|
|
113
|
+
}
|
|
114
|
+
else if (labelStyle?.fontStyle) {
|
|
115
|
+
vars['--expo-router-tabs-font-style'] = String(labelStyle.fontStyle);
|
|
116
|
+
}
|
|
117
|
+
if (optionsLabelStyle?.color) {
|
|
118
|
+
vars['--expo-router-tabs-text-color'] = String(optionsLabelStyle.color);
|
|
119
|
+
}
|
|
120
|
+
else if (labelStyle?.color) {
|
|
121
|
+
vars['--expo-router-tabs-text-color'] = String(labelStyle.color);
|
|
122
|
+
}
|
|
123
|
+
if (currentTabOptions?.selectedLabelStyle?.color) {
|
|
124
|
+
vars['--expo-router-tabs-active-text-color'] = String(currentTabOptions.selectedLabelStyle.color);
|
|
125
|
+
}
|
|
126
|
+
else if (props.tintColor) {
|
|
127
|
+
vars['--expo-router-tabs-active-text-color'] = String(props.tintColor);
|
|
128
|
+
}
|
|
129
|
+
if (currentTabOptions?.selectedLabelStyle?.fontSize) {
|
|
130
|
+
vars['--expo-router-tabs-active-font-size'] = String(currentTabOptions.selectedLabelStyle.fontSize);
|
|
131
|
+
}
|
|
132
|
+
if (currentTabOptions?.indicatorColor) {
|
|
133
|
+
vars['--expo-router-tabs-active-background-color'] = String(currentTabOptions.indicatorColor);
|
|
134
|
+
}
|
|
135
|
+
else if (props.indicatorColor) {
|
|
136
|
+
vars['--expo-router-tabs-active-background-color'] = String(props.indicatorColor);
|
|
137
|
+
}
|
|
138
|
+
if (currentTabOptions?.backgroundColor) {
|
|
139
|
+
vars['--expo-router-tabs-background-color'] = String(currentTabOptions.backgroundColor);
|
|
140
|
+
}
|
|
141
|
+
else if (props.backgroundColor) {
|
|
142
|
+
vars['--expo-router-tabs-background-color'] = String(props.backgroundColor);
|
|
143
|
+
}
|
|
144
|
+
if (currentTabOptions?.badgeBackgroundColor) {
|
|
145
|
+
vars['--expo-router-tabs-badge-background-color'] = String(currentTabOptions.badgeBackgroundColor);
|
|
146
|
+
}
|
|
147
|
+
else if (props.badgeBackgroundColor) {
|
|
148
|
+
vars['--expo-router-tabs-badge-background-color'] = String(props.badgeBackgroundColor);
|
|
149
|
+
}
|
|
150
|
+
if (currentTabOptions?.badgeTextColor) {
|
|
151
|
+
vars['--expo-router-tabs-badge-text-color'] = String(currentTabOptions.badgeTextColor);
|
|
152
|
+
}
|
|
153
|
+
else if (props.badgeTextColor) {
|
|
154
|
+
vars['--expo-router-tabs-badge-text-color'] = String(props.badgeTextColor);
|
|
155
|
+
}
|
|
156
|
+
return vars;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=NativeTabsView.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeTabsView.web.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.web.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wCAwDC;AA/DD,qDAAgF;AAChF,+CAAuC;AAGvC,mCAA6C;AAC7C,oGAAsE;AAEtE,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,cAAc,GAAG,IAAA,eAAO,EAC5B,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAC9D,EAAE,CACH,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,CAAC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AAC;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC,IAAI,CAAC,4CAA4C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,iBAAiB,EAAE,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC1F,CAAC;SAAM,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC9E,CAAC;IACD,IAAI,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;QAC5C,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CACxD,iBAAiB,CAAC,oBAAoB,CACvC,CAAC;IACJ,CAAC;SAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACtC,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,iBAAiB,EAAE,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACzF,CAAC;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Tabs, TabsContent, TabsList, TabsTrigger } from '@radix-ui/react-tabs';\nimport React, { useMemo } from 'react';\n\nimport type { NativeTabOptions, NativeTabsViewProps } from './types';\nimport { shouldTabBeVisible } from './utils';\nimport nativeTabsStyles from '../../../assets/native-tabs.module.css';\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n const defaultTabName = useMemo(\n () => state.routes[focusedIndex]?.name ?? state.routes[0].name,\n []\n );\n const value = state.routes[focusedIndex]?.name ?? state.routes[0].name;\n const currentTabKey = state.routes[focusedIndex]?.key ?? state.routes[0].key;\n\n const items = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => (\n <TabItem\n key={route.key}\n route={route}\n title={descriptors[route.key].options.title ?? route.name}\n badgeValue={descriptors[route.key].options.badgeValue}\n />\n ));\n const children = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => {\n return (\n <TabsContent\n key={route.name}\n value={route.name}\n className={nativeTabsStyles.tabContent}\n forceMount>\n {descriptors[route.key].render()}\n </TabsContent>\n );\n });\n\n return (\n <Tabs\n className={nativeTabsStyles.nativeTabsContainer}\n defaultValue={defaultTabName}\n value={value}\n onValueChange={(value) => {\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: value,\n },\n });\n }}\n style={convertNativeTabsPropsToStyleVars(props, descriptors[currentTabKey]?.options)}>\n <TabsList aria-label=\"Main\" className={nativeTabsStyles.navigationMenuRoot}>\n {items}\n </TabsList>\n {children}\n </Tabs>\n );\n}\n\ninterface TabItemProps {\n title: string;\n badgeValue?: string;\n route: { name: string };\n}\n\nfunction TabItem(props: TabItemProps) {\n const { title, badgeValue, route } = props;\n const isBadgeEmpty = badgeValue === ' ';\n\n return (\n <TabsTrigger value={route.name} className={nativeTabsStyles.navigationMenuTrigger}>\n <span className={nativeTabsStyles.tabText}>{title}</span>\n {badgeValue && (\n <div\n className={`${nativeTabsStyles.tabBadge} ${isBadgeEmpty ? nativeTabsStyles.emptyTabBadge : ''}`}>\n {badgeValue}\n </div>\n )}\n </TabsTrigger>\n );\n}\n\nfunction convertNativeTabsPropsToStyleVars(\n props: NativeTabsViewProps | undefined,\n currentTabOptions: NativeTabOptions | undefined\n): Record<string, string | undefined> {\n const vars: Record<`--expo-router-tabs-${string}`, string | undefined> = {};\n if (!props) {\n return vars;\n }\n const { labelStyle } = props;\n const optionsLabelStyle = currentTabOptions?.labelStyle;\n if (optionsLabelStyle?.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(optionsLabelStyle.fontFamily);\n } else if (labelStyle?.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(labelStyle.fontFamily);\n }\n if (optionsLabelStyle?.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(optionsLabelStyle.fontSize);\n } else if (labelStyle?.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(labelStyle.fontSize);\n }\n if (optionsLabelStyle?.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(optionsLabelStyle.fontWeight);\n } else if (labelStyle?.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(labelStyle.fontWeight);\n }\n if (optionsLabelStyle?.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(optionsLabelStyle.fontStyle);\n } else if (labelStyle?.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(labelStyle.fontStyle);\n }\n if (optionsLabelStyle?.color) {\n vars['--expo-router-tabs-text-color'] = String(optionsLabelStyle.color);\n } else if (labelStyle?.color) {\n vars['--expo-router-tabs-text-color'] = String(labelStyle.color);\n }\n if (currentTabOptions?.selectedLabelStyle?.color) {\n vars['--expo-router-tabs-active-text-color'] = String(\n currentTabOptions.selectedLabelStyle.color\n );\n } else if (props.tintColor) {\n vars['--expo-router-tabs-active-text-color'] = String(props.tintColor);\n }\n if (currentTabOptions?.selectedLabelStyle?.fontSize) {\n vars['--expo-router-tabs-active-font-size'] = String(\n currentTabOptions.selectedLabelStyle.fontSize\n );\n }\n if (currentTabOptions?.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(currentTabOptions.indicatorColor);\n } else if (props.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(props.indicatorColor);\n }\n if (currentTabOptions?.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(currentTabOptions.backgroundColor);\n } else if (props.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(props.backgroundColor);\n }\n if (currentTabOptions?.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(\n currentTabOptions.badgeBackgroundColor\n );\n } else if (props.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(props.badgeBackgroundColor);\n }\n if (currentTabOptions?.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(currentTabOptions.badgeTextColor);\n } else if (props.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(props.badgeTextColor);\n }\n return vars;\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import type { BottomTabsScreenAppearance, BottomTabsScreenItemStateAppearance } from 'react-native-screens';
|
|
3
|
+
import { type NativeTabOptions, type NativeTabsBlurEffect, type NativeTabsLabelStyle } from './types';
|
|
4
|
+
export declare function createStandardAppearanceFromOptions(options: NativeTabOptions, baseStandardAppearance: BottomTabsScreenAppearance): BottomTabsScreenAppearance;
|
|
5
|
+
export declare function createScrollEdgeAppearanceFromOptions(options: NativeTabOptions, baseScrollEdgeAppearance: BottomTabsScreenAppearance): BottomTabsScreenAppearance;
|
|
6
|
+
export interface AppearanceStyle extends NativeTabsLabelStyle {
|
|
7
|
+
iconColor?: ColorValue;
|
|
8
|
+
backgroundColor?: ColorValue | null;
|
|
9
|
+
blurEffect?: NativeTabsBlurEffect;
|
|
10
|
+
badgeBackgroundColor?: ColorValue;
|
|
11
|
+
titlePositionAdjustment?: {
|
|
12
|
+
horizontal?: number;
|
|
13
|
+
vertical?: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function appendSelectedStyleToAppearance(selectedStyle: AppearanceStyle, appearance: BottomTabsScreenAppearance): BottomTabsScreenAppearance;
|
|
17
|
+
export declare function appendStyleToAppearance(style: AppearanceStyle, appearance: BottomTabsScreenAppearance, states: ('selected' | 'focused' | 'disabled' | 'normal')[]): BottomTabsScreenAppearance;
|
|
18
|
+
export declare function convertStyleToAppearance(style: AppearanceStyle | undefined): BottomTabsScreenAppearance;
|
|
19
|
+
export declare function convertStyleToItemStateAppearance(style: AppearanceStyle | undefined): BottomTabsScreenItemStateAppearance;
|
|
20
|
+
//# sourceMappingURL=appearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/appearance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,0BAA0B,EAE1B,mCAAmC,EACpC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,gBAAgB,EACzB,sBAAsB,EAAE,0BAA0B,GACjD,0BAA0B,CAsB5B;AAED,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,gBAAgB,EACzB,wBAAwB,EAAE,0BAA0B,GACnD,0BAA0B,CAsB5B;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,uBAAuB,CAAC,EAAE;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,eAAe,EAC9B,UAAU,EAAE,0BAA0B,GACrC,0BAA0B,CAE5B;AASD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,0BAA0B,EACtC,MAAM,EAAE,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,EAAE,GACzD,0BAA0B,CA6B5B;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,0BAA0B,CAkB5B;AAED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,mCAAmC,CAyBrC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStandardAppearanceFromOptions = createStandardAppearanceFromOptions;
|
|
4
|
+
exports.createScrollEdgeAppearanceFromOptions = createScrollEdgeAppearanceFromOptions;
|
|
5
|
+
exports.appendSelectedStyleToAppearance = appendSelectedStyleToAppearance;
|
|
6
|
+
exports.appendStyleToAppearance = appendStyleToAppearance;
|
|
7
|
+
exports.convertStyleToAppearance = convertStyleToAppearance;
|
|
8
|
+
exports.convertStyleToItemStateAppearance = convertStyleToItemStateAppearance;
|
|
9
|
+
function createStandardAppearanceFromOptions(options, baseStandardAppearance) {
|
|
10
|
+
const appearance = appendStyleToAppearance({
|
|
11
|
+
...options.labelStyle,
|
|
12
|
+
iconColor: options.iconColor,
|
|
13
|
+
backgroundColor: options.backgroundColor,
|
|
14
|
+
blurEffect: options.blurEffect,
|
|
15
|
+
badgeBackgroundColor: options.badgeBackgroundColor,
|
|
16
|
+
titlePositionAdjustment: options.titlePositionAdjustment,
|
|
17
|
+
}, baseStandardAppearance, ['normal', 'focused', 'selected']);
|
|
18
|
+
return appendSelectedStyleToAppearance({
|
|
19
|
+
...(options.selectedLabelStyle ?? {}),
|
|
20
|
+
iconColor: options.selectedIconColor,
|
|
21
|
+
badgeBackgroundColor: options.selectedBadgeBackgroundColor,
|
|
22
|
+
titlePositionAdjustment: options.selectedTitlePositionAdjustment,
|
|
23
|
+
}, appearance);
|
|
24
|
+
}
|
|
25
|
+
function createScrollEdgeAppearanceFromOptions(options, baseScrollEdgeAppearance) {
|
|
26
|
+
const appearance = appendStyleToAppearance({
|
|
27
|
+
...options.labelStyle,
|
|
28
|
+
iconColor: options.iconColor,
|
|
29
|
+
blurEffect: options.disableTransparentOnScrollEdge ? options.blurEffect : 'none',
|
|
30
|
+
backgroundColor: options.disableTransparentOnScrollEdge ? options.backgroundColor : null,
|
|
31
|
+
badgeBackgroundColor: options.badgeBackgroundColor,
|
|
32
|
+
titlePositionAdjustment: options.titlePositionAdjustment,
|
|
33
|
+
}, baseScrollEdgeAppearance, ['normal', 'focused', 'selected']);
|
|
34
|
+
return appendSelectedStyleToAppearance({
|
|
35
|
+
...(options.selectedLabelStyle ?? {}),
|
|
36
|
+
iconColor: options.selectedIconColor,
|
|
37
|
+
badgeBackgroundColor: options.selectedBadgeBackgroundColor,
|
|
38
|
+
titlePositionAdjustment: options.selectedTitlePositionAdjustment,
|
|
39
|
+
}, appearance);
|
|
40
|
+
}
|
|
41
|
+
function appendSelectedStyleToAppearance(selectedStyle, appearance) {
|
|
42
|
+
return appendStyleToAppearance(selectedStyle, appearance, ['selected', 'focused']);
|
|
43
|
+
}
|
|
44
|
+
const EMPTY_APPEARANCE_ITEM = {
|
|
45
|
+
normal: {},
|
|
46
|
+
selected: {},
|
|
47
|
+
focused: {},
|
|
48
|
+
disabled: {},
|
|
49
|
+
};
|
|
50
|
+
function appendStyleToAppearance(style, appearance, states) {
|
|
51
|
+
const baseItemAppearance = appearance.stacked || appearance.inline || appearance.compactInline || {};
|
|
52
|
+
const styleAppearance = convertStyleToAppearance(style);
|
|
53
|
+
const newAppearances = states.map((state) => ({
|
|
54
|
+
key: state,
|
|
55
|
+
appearance: {
|
|
56
|
+
...baseItemAppearance.normal,
|
|
57
|
+
...baseItemAppearance[state],
|
|
58
|
+
...styleAppearance.stacked?.normal,
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
61
|
+
const itemAppearance = {
|
|
62
|
+
...EMPTY_APPEARANCE_ITEM,
|
|
63
|
+
...baseItemAppearance,
|
|
64
|
+
...Object.fromEntries(newAppearances.map(({ key, appearance }) => [key, appearance])),
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
stacked: itemAppearance,
|
|
68
|
+
inline: itemAppearance,
|
|
69
|
+
compactInline: itemAppearance,
|
|
70
|
+
tabBarBackgroundColor: style.backgroundColor === null
|
|
71
|
+
? undefined
|
|
72
|
+
: (style.backgroundColor ?? appearance.tabBarBackgroundColor),
|
|
73
|
+
tabBarBlurEffect: styleAppearance.tabBarBlurEffect ?? appearance.tabBarBlurEffect,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function convertStyleToAppearance(style) {
|
|
77
|
+
if (!style) {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
const stateAppearance = convertStyleToItemStateAppearance(style);
|
|
81
|
+
const itemAppearance = {
|
|
82
|
+
normal: stateAppearance,
|
|
83
|
+
selected: stateAppearance,
|
|
84
|
+
focused: stateAppearance,
|
|
85
|
+
disabled: {},
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
inline: itemAppearance,
|
|
89
|
+
stacked: itemAppearance,
|
|
90
|
+
compactInline: itemAppearance,
|
|
91
|
+
tabBarBackgroundColor: style?.backgroundColor ?? undefined,
|
|
92
|
+
tabBarBlurEffect: style?.blurEffect,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function convertStyleToItemStateAppearance(style) {
|
|
96
|
+
if (!style) {
|
|
97
|
+
return {};
|
|
98
|
+
}
|
|
99
|
+
const stateAppearance = {
|
|
100
|
+
tabBarItemBadgeBackgroundColor: style.badgeBackgroundColor,
|
|
101
|
+
tabBarItemTitlePositionAdjustment: style.titlePositionAdjustment,
|
|
102
|
+
tabBarItemIconColor: style.iconColor,
|
|
103
|
+
tabBarItemTitleFontFamily: style.fontFamily,
|
|
104
|
+
tabBarItemTitleFontSize: style.fontSize,
|
|
105
|
+
// Only string values are accepted by rn-screens
|
|
106
|
+
tabBarItemTitleFontWeight: style?.fontWeight
|
|
107
|
+
? String(style.fontWeight)
|
|
108
|
+
: undefined,
|
|
109
|
+
tabBarItemTitleFontStyle: style.fontStyle,
|
|
110
|
+
tabBarItemTitleFontColor: style.color,
|
|
111
|
+
};
|
|
112
|
+
Object.keys(stateAppearance).forEach((key) => {
|
|
113
|
+
if (stateAppearance[key] === undefined) {
|
|
114
|
+
delete stateAppearance[key];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return stateAppearance;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=appearance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/appearance.ts"],"names":[],"mappings":";;AAaA,kFAyBC;AAED,sFAyBC;AAaD,0EAKC;AASD,0DAiCC;AAED,4DAoBC;AAED,8EA2BC;AAnKD,SAAgB,mCAAmC,CACjD,OAAyB,EACzB,sBAAkD;IAElD,MAAM,UAAU,GAAG,uBAAuB,CACxC;QACE,GAAG,OAAO,CAAC,UAAU;QACrB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;KACzD,EACD,sBAAsB,EACtB,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAClC,CAAC;IACF,OAAO,+BAA+B,CACpC;QACE,GAAG,CAAC,OAAO,CAAC,kBAAkB,IAAI,EAAE,CAAC;QACrC,SAAS,EAAE,OAAO,CAAC,iBAAiB;QACpC,oBAAoB,EAAE,OAAO,CAAC,4BAA4B;QAC1D,uBAAuB,EAAE,OAAO,CAAC,+BAA+B;KACjE,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AAc;QACtB,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,cAAc;QAC7B,qBAAqB,EAAE,KAAK,EAAE,eAAe,IAAI,SAAS;QAC1D,gBAAgB,EAAE,KAAK,EAAE,UAAU;KACpC,CAAC;AACJ,CAAC;AAED,SAAgB,iCAAiC,CAC/C,KAAkC;IAElC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,eAAe,GAAwC;QAC3D,8BAA8B,EAAE,KAAK,CAAC,oBAAoB;QAC1D,iCAAiC,EAAE,KAAK,CAAC,uBAAuB;QAChE,mBAAmB,EAAE,KAAK,CAAC,SAAS;QACpC,yBAAyB,EAAE,KAAK,CAAC,UAAU;QAC3C,uBAAuB,EAAE,KAAK,CAAC,QAAQ;QACvC,gDAAgD;QAChD,yBAAyB,EAAE,KAAK,EAAE,UAAU;YAC1C,CAAC,CAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAoD;YAC9E,CAAC,CAAC,SAAS;QACb,wBAAwB,EAAE,KAAK,CAAC,SAAS;QACzC,wBAAwB,EAAE,KAAK,CAAC,KAAK;KACtC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,eAAe,CAAmD,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC9F,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColorValue } from 'react-native';\nimport type {\n BottomTabsScreenAppearance,\n BottomTabsScreenItemAppearance,\n BottomTabsScreenItemStateAppearance,\n} from 'react-native-screens';\n\nimport {\n type NativeTabOptions,\n type NativeTabsBlurEffect,\n type NativeTabsLabelStyle,\n} from './types';\n\nexport function createStandardAppearanceFromOptions(\n options: NativeTabOptions,\n baseStandardAppearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n backgroundColor: options.backgroundColor,\n blurEffect: options.blurEffect,\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n },\n baseStandardAppearance,\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport function createScrollEdgeAppearanceFromOptions(\n options: NativeTabOptions,\n baseScrollEdgeAppearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n blurEffect: options.disableTransparentOnScrollEdge ? options.blurEffect : 'none',\n backgroundColor: options.disableTransparentOnScrollEdge ? options.backgroundColor : null,\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n },\n baseScrollEdgeAppearance,\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport interface AppearanceStyle extends NativeTabsLabelStyle {\n iconColor?: ColorValue;\n backgroundColor?: ColorValue | null;\n blurEffect?: NativeTabsBlurEffect;\n badgeBackgroundColor?: ColorValue;\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n}\n\nexport function appendSelectedStyleToAppearance(\n selectedStyle: AppearanceStyle,\n appearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n return appendStyleToAppearance(selectedStyle, appearance, ['selected', 'focused']);\n}\n\nconst EMPTY_APPEARANCE_ITEM: BottomTabsScreenItemAppearance = {\n normal: {},\n selected: {},\n focused: {},\n disabled: {},\n};\n\nexport function appendStyleToAppearance(\n style: AppearanceStyle,\n appearance: BottomTabsScreenAppearance,\n states: ('selected' | 'focused' | 'disabled' | 'normal')[]\n): BottomTabsScreenAppearance {\n const baseItemAppearance =\n appearance.stacked || appearance.inline || appearance.compactInline || {};\n\n const styleAppearance = convertStyleToAppearance(style);\n const newAppearances = states.map((state) => ({\n key: state,\n appearance: {\n ...baseItemAppearance.normal,\n ...baseItemAppearance[state],\n ...styleAppearance.stacked?.normal,\n },\n }));\n\n const itemAppearance: BottomTabsScreenItemAppearance = {\n ...EMPTY_APPEARANCE_ITEM,\n ...baseItemAppearance,\n ...Object.fromEntries(newAppearances.map(({ key, appearance }) => [key, appearance])),\n };\n return {\n stacked: itemAppearance,\n inline: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor:\n style.backgroundColor === null\n ? undefined\n : (style.backgroundColor ?? appearance.tabBarBackgroundColor),\n tabBarBlurEffect: styleAppearance.tabBarBlurEffect ?? appearance.tabBarBlurEffect,\n };\n}\n\nexport function convertStyleToAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance = convertStyleToItemStateAppearance(style);\n const itemAppearance: BottomTabsScreenItemAppearance = {\n normal: stateAppearance,\n selected: stateAppearance,\n focused: stateAppearance,\n disabled: {},\n };\n return {\n inline: itemAppearance,\n stacked: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor: style?.backgroundColor ?? undefined,\n tabBarBlurEffect: style?.blurEffect,\n };\n}\n\nexport function convertStyleToItemStateAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenItemStateAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance: BottomTabsScreenItemStateAppearance = {\n tabBarItemBadgeBackgroundColor: style.badgeBackgroundColor,\n tabBarItemTitlePositionAdjustment: style.titlePositionAdjustment,\n tabBarItemIconColor: style.iconColor,\n tabBarItemTitleFontFamily: style.fontFamily,\n tabBarItemTitleFontSize: style.fontSize,\n // Only string values are accepted by rn-screens\n tabBarItemTitleFontWeight: style?.fontWeight\n ? (String(style.fontWeight) as `${NonNullable<(typeof style)['fontWeight']>}`)\n : undefined,\n tabBarItemTitleFontStyle: style.fontStyle,\n tabBarItemTitleFontColor: style.color,\n };\n\n (Object.keys(stateAppearance) as (keyof BottomTabsScreenItemStateAppearance)[]).forEach((key) => {\n if (stateAppearance[key] === undefined) {\n delete stateAppearance[key];\n }\n });\n\n return stateAppearance;\n}\n"]}
|