expo-router 7.0.0-canary-20251031-b135dff → 7.0.0-canary-20251118-8f7ee64

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.
Files changed (157) hide show
  1. package/build/Route.d.ts +2 -0
  2. package/build/Route.d.ts.map +1 -1
  3. package/build/Route.js.map +1 -1
  4. package/build/color/android.attr.types.d.ts +142 -0
  5. package/build/color/android.attr.types.d.ts.map +1 -0
  6. package/build/color/android.attr.types.js +3 -0
  7. package/build/color/android.attr.types.js.map +1 -0
  8. package/build/color/android.color.types.d.ts +1278 -0
  9. package/build/color/android.color.types.d.ts.map +1 -0
  10. package/build/color/android.color.types.js +3 -0
  11. package/build/color/android.color.types.js.map +1 -0
  12. package/build/color/android.dynamic.types.d.ts +384 -0
  13. package/build/color/android.dynamic.types.d.ts.map +1 -0
  14. package/build/color/android.dynamic.types.js +3 -0
  15. package/build/color/android.dynamic.types.js.map +1 -0
  16. package/build/color/android.material.types.d.ts +291 -0
  17. package/build/color/android.material.types.d.ts.map +1 -0
  18. package/build/color/android.material.types.js +3 -0
  19. package/build/color/android.material.types.js.map +1 -0
  20. package/build/color/index.d.ts +35 -0
  21. package/build/color/index.d.ts.map +1 -0
  22. package/build/color/index.js +71 -0
  23. package/build/color/index.js.map +1 -0
  24. package/build/color/ios.types.d.ts +156 -0
  25. package/build/color/ios.types.d.ts.map +1 -0
  26. package/build/color/ios.types.js +3 -0
  27. package/build/color/ios.types.js.map +1 -0
  28. package/build/color/materialColor.android.d.ts +4 -0
  29. package/build/color/materialColor.android.d.ts.map +1 -0
  30. package/build/color/materialColor.android.js +28 -0
  31. package/build/color/materialColor.android.js.map +1 -0
  32. package/build/color/materialColor.d.ts +4 -0
  33. package/build/color/materialColor.d.ts.map +1 -0
  34. package/build/color/materialColor.js +11 -0
  35. package/build/color/materialColor.js.map +1 -0
  36. package/build/exports.d.ts +2 -0
  37. package/build/exports.d.ts.map +1 -1
  38. package/build/exports.js +7 -1
  39. package/build/exports.js.map +1 -1
  40. package/build/layouts/DrawerClient.d.ts +4 -2
  41. package/build/layouts/DrawerClient.d.ts.map +1 -1
  42. package/build/layouts/Stack.d.ts.map +1 -1
  43. package/build/layouts/Stack.js +3 -2
  44. package/build/layouts/Stack.js.map +1 -1
  45. package/build/layouts/Stack.web.d.ts.map +1 -1
  46. package/build/layouts/Stack.web.js +3 -2
  47. package/build/layouts/Stack.web.js.map +1 -1
  48. package/build/layouts/StackClient.d.ts +18 -10
  49. package/build/layouts/StackClient.d.ts.map +1 -1
  50. package/build/layouts/StackClient.js +95 -5
  51. package/build/layouts/StackClient.js.map +1 -1
  52. package/build/layouts/TabsClient.d.ts +6 -3
  53. package/build/layouts/TabsClient.d.ts.map +1 -1
  54. package/build/layouts/stack-utils/StackHeaderBackButton.d.ts +14 -0
  55. package/build/layouts/stack-utils/StackHeaderBackButton.d.ts.map +1 -0
  56. package/build/layouts/stack-utils/StackHeaderBackButton.js +19 -0
  57. package/build/layouts/stack-utils/StackHeaderBackButton.js.map +1 -0
  58. package/build/layouts/stack-utils/StackHeaderComponent.d.ts +22 -0
  59. package/build/layouts/stack-utils/StackHeaderComponent.d.ts.map +1 -0
  60. package/build/layouts/stack-utils/StackHeaderComponent.js +67 -0
  61. package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -0
  62. package/build/layouts/stack-utils/StackHeaderLeft.d.ts +9 -0
  63. package/build/layouts/stack-utils/StackHeaderLeft.d.ts.map +1 -0
  64. package/build/layouts/stack-utils/StackHeaderLeft.js +17 -0
  65. package/build/layouts/stack-utils/StackHeaderLeft.js.map +1 -0
  66. package/build/layouts/stack-utils/StackHeaderRight.d.ts +9 -0
  67. package/build/layouts/stack-utils/StackHeaderRight.d.ts.map +1 -0
  68. package/build/layouts/stack-utils/StackHeaderRight.js +17 -0
  69. package/build/layouts/stack-utils/StackHeaderRight.js.map +1 -0
  70. package/build/layouts/stack-utils/StackHeaderSearchBar.d.ts +7 -0
  71. package/build/layouts/stack-utils/StackHeaderSearchBar.d.ts.map +1 -0
  72. package/build/layouts/stack-utils/StackHeaderSearchBar.js +16 -0
  73. package/build/layouts/stack-utils/StackHeaderSearchBar.js.map +1 -0
  74. package/build/layouts/stack-utils/StackHeaderTitle.d.ts +22 -0
  75. package/build/layouts/stack-utils/StackHeaderTitle.d.ts.map +1 -0
  76. package/build/layouts/stack-utils/StackHeaderTitle.js +41 -0
  77. package/build/layouts/stack-utils/StackHeaderTitle.js.map +1 -0
  78. package/build/layouts/stack-utils/StackScreen.d.ts +9 -0
  79. package/build/layouts/stack-utils/StackScreen.d.ts.map +1 -0
  80. package/build/layouts/stack-utils/StackScreen.js +34 -0
  81. package/build/layouts/stack-utils/StackScreen.js.map +1 -0
  82. package/build/layouts/stack-utils/index.d.ts +17 -0
  83. package/build/layouts/stack-utils/index.d.ts.map +1 -0
  84. package/build/layouts/stack-utils/index.js +28 -0
  85. package/build/layouts/stack-utils/index.js.map +1 -0
  86. package/build/layouts/stack-utils/utils.d.ts +3 -0
  87. package/build/layouts/stack-utils/utils.d.ts.map +1 -0
  88. package/build/layouts/stack-utils/utils.js +8 -0
  89. package/build/layouts/stack-utils/utils.js.map +1 -0
  90. package/build/layouts/withLayoutContext.js +1 -1
  91. package/build/layouts/withLayoutContext.js.map +1 -1
  92. package/build/loaders/utils.d.ts +9 -0
  93. package/build/loaders/utils.d.ts.map +1 -1
  94. package/build/loaders/utils.js +16 -2
  95. package/build/loaders/utils.js.map +1 -1
  96. package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -1
  97. package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -1
  98. package/build/native-tabs/NativeTabTrigger.d.ts +9 -7
  99. package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
  100. package/build/native-tabs/NativeTabTrigger.js +25 -64
  101. package/build/native-tabs/NativeTabTrigger.js.map +1 -1
  102. package/build/native-tabs/NativeTabs.d.ts +4 -1
  103. package/build/native-tabs/NativeTabs.d.ts.map +1 -1
  104. package/build/native-tabs/NativeTabsView.d.ts.map +1 -1
  105. package/build/native-tabs/NativeTabsView.js +8 -3
  106. package/build/native-tabs/NativeTabsView.js.map +1 -1
  107. package/build/native-tabs/common/elements.d.ts +28 -90
  108. package/build/native-tabs/common/elements.d.ts.map +1 -1
  109. package/build/native-tabs/common/elements.js +16 -18
  110. package/build/native-tabs/common/elements.js.map +1 -1
  111. package/build/native-tabs/index.d.ts +1 -2
  112. package/build/native-tabs/index.d.ts.map +1 -1
  113. package/build/native-tabs/index.js +1 -3
  114. package/build/native-tabs/index.js.map +1 -1
  115. package/build/native-tabs/types.d.ts +20 -170
  116. package/build/native-tabs/types.d.ts.map +1 -1
  117. package/build/native-tabs/types.js.map +1 -1
  118. package/build/native-tabs/utils/icon.d.ts +3 -3
  119. package/build/native-tabs/utils/icon.d.ts.map +1 -1
  120. package/build/native-tabs/utils/icon.js +22 -13
  121. package/build/native-tabs/utils/icon.js.map +1 -1
  122. package/build/primitives/elements.d.ts +18 -0
  123. package/build/primitives/elements.d.ts.map +1 -0
  124. package/build/primitives/elements.js +31 -0
  125. package/build/primitives/elements.js.map +1 -0
  126. package/build/primitives/index.d.ts +5 -0
  127. package/build/primitives/index.d.ts.map +1 -0
  128. package/build/primitives/index.js +26 -0
  129. package/build/primitives/index.js.map +1 -0
  130. package/build/primitives/menu.d.ts +12 -0
  131. package/build/primitives/menu.d.ts.map +1 -0
  132. package/build/primitives/menu.js +28 -0
  133. package/build/primitives/menu.js.map +1 -0
  134. package/build/{primitives.d.ts → primitives/navigation.d.ts} +1 -1
  135. package/build/primitives/navigation.d.ts.map +1 -0
  136. package/build/{primitives.js → primitives/navigation.js} +1 -1
  137. package/build/primitives/navigation.js.map +1 -0
  138. package/build/primitives/types.d.ts +26 -0
  139. package/build/primitives/types.d.ts.map +1 -0
  140. package/build/primitives/types.js +3 -0
  141. package/build/primitives/types.js.map +1 -0
  142. package/build/split-view/elements.js +4 -4
  143. package/build/split-view/elements.js.map +1 -1
  144. package/build/split-view/split-view.d.ts +1 -1
  145. package/build/split-view/split-view.d.ts.map +1 -1
  146. package/build/split-view/split-view.js +5 -5
  147. package/build/split-view/split-view.js.map +1 -1
  148. package/expo-module.config.json +10 -1
  149. package/ios/{ExpoHead.podspec → ExpoRouter.podspec} +1 -1
  150. package/package.json +14 -14
  151. package/build/native-tabs/NativeTabsTriggerTabBar.d.ts +0 -24
  152. package/build/native-tabs/NativeTabsTriggerTabBar.d.ts.map +0 -1
  153. package/build/native-tabs/NativeTabsTriggerTabBar.js +0 -28
  154. package/build/native-tabs/NativeTabsTriggerTabBar.js.map +0 -1
  155. package/build/primitives.d.ts.map +0 -1
  156. package/build/primitives.js.map +0 -1
  157. package/node/getExpoConstantsManifest.js +0 -163
@@ -1 +1 @@
1
- {"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,0DAsFC;AAoCD,8CA2CC;AAzLD,+CAUe;AAEf,oCAAyC;AACzC,sEAA+F;AAE/F,8CAA8D;AAC9D,mEAAgE;AAChE,kDAAwE;AACxE,4CAAmD;AAEnD,SAAgB,uBAAuB,CACrC,QAAmB,EACnB,EACE,iBAAiB,EACjB,UAAU,MAKR,EAAE;IAEN,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,MAAM,cAAc,GAAU,EAAE,CAAC;QAEjC,MAAM,OAAO,GAAuC,EAAE,CAAC;QACvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE3C,SAAS,YAAY,CAAC,KAAgB,EAAE,OAAO,GAAG,KAAK;YACrD,IAAI,IAAA,iBAAQ,EAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC;gBAChC,IAAI,OAAO,EAAE,CAAC;oBACZ,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACzC,CAAC;qBAAM,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AAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAEjE,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,SAAS,IAAI,EAAE,EAAE,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;QAE9F,uDAAuD;QACvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,CACL,CAAC,6CAAqB,CAAC,KAAK,CAC1B;UAAA,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAC7D;QAAA,EAAE,6CAAqB,CAAC,CACzB,CAAC;IACJ,CAAC,CAAC,EACF;QACE,MAAM,EAAN,eAAM;QACN,SAAS,EAAT,qBAAS;KACV,CAMF,CAAC;AACJ,CAAC","sourcesContent":["import { EventMapBase, NavigationState } from '@react-navigation/native';\nimport React, {\n Children,\n forwardRef,\n ComponentProps,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n ReactNode,\n RefAttributes,\n useMemo,\n} from 'react';\n\nimport { useContextKey } from '../Route';\nimport { isNativeTabTrigger, convertTabPropsToOptions } from '../native-tabs/NativeTabTrigger';\nimport { PickPartial } from '../types';\nimport { useSortedScreens, ScreenProps } from '../useScreens';\nimport { IsWithinLayoutContext } from './IsWithinLayoutContext';\nimport { isProtectedReactElement, Protected } from '../views/Protected';\nimport { isScreen, Screen } from '../views/Screen';\n\nexport function useFilterScreenChildren(\n children: ReactNode,\n {\n isCustomNavigator,\n contextKey,\n }: {\n isCustomNavigator?: boolean;\n /** Used for sending developer hints */\n contextKey?: string;\n } = {}\n) {\n return useMemo(() => {\n const customChildren: any[] = [];\n\n const screens: (ScreenProps & { name: string })[] = [];\n const protectedScreens = new Set<string>();\n\n function flattenChild(child: ReactNode, exclude = false) {\n if (isScreen(child, contextKey)) {\n if (exclude) {\n protectedScreens.add(child.props.name);\n } else {\n screens.push(child.props);\n }\n return;\n }\n\n if (isNativeTabTrigger(child, contextKey)) {\n if (exclude) {\n protectedScreens.add(child.props.name);\n } else {\n const options = convertTabPropsToOptions(child.props);\n if (options.hidden === false) {\n screens.push({\n ...child.props,\n options: convertTabPropsToOptions(child.props),\n });\n } else {\n // - hidden = undefined -> then the route was not specified in navigator\n // - hidden = true -> then the route is hidden\n // In this cases we should treat the tab as protected\n protectedScreens.add(child.props.name);\n }\n }\n return;\n }\n\n if (isProtectedReactElement(child)) {\n const excludeChildren = exclude || !child.props.guard;\n Children.forEach(child.props.children, (protectedChild) => {\n flattenChild(protectedChild, excludeChildren);\n });\n return;\n }\n\n if (isCustomNavigator) {\n customChildren.push(child);\n return null;\n }\n\n console.warn(\n `Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />. Update Layout Route at: \"app${contextKey}/_layout\"`\n );\n\n return null;\n }\n\n Children.forEach(children, (child) => flattenChild(child));\n\n // Add an assertion for development\n if (process.env.NODE_ENV !== 'production') {\n // Assert if names are not unique\n const names = screens?.map(\n (screen) => screen && typeof screen === 'object' && 'name' in screen && screen.name\n );\n if (names && new Set(names).size !== names.length) {\n throw new Error('Screen names must be unique: ' + names);\n }\n }\n\n return {\n screens,\n children: customChildren,\n protectedScreens,\n };\n }, [children]);\n}\n\n/**\n * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.\n * Return type with `children` prop optional.\n * \n * Enables use of other built-in React Navigation navigators and other navigators built with the React Navigation custom navigator API.\n *\n * @param Nav - The navigator component to wrap.\n * @param processor - A function that processes the screens before passing them to the navigator.\n * @param useOnlyUserDefinedScreens - If true, all screens not specified as navigator's children will be ignored.\n *\n * @example\n * ```tsx app/_layout.tsx\n * import { ParamListBase, TabNavigationState } from \"@react-navigation/native\";\n * import {\n * createMaterialTopTabNavigator,\n * MaterialTopTabNavigationOptions,\n * MaterialTopTabNavigationEventMap,\n * } from \"@react-navigation/material-top-tabs\";\n * import { withLayoutContext } from \"expo-router\";\n * \n * const MaterialTopTabs = createMaterialTopTabNavigator();\n * \n * const ExpoRouterMaterialTopTabs = withLayoutContext<\n * MaterialTopTabNavigationOptions,\n * typeof MaterialTopTabs.Navigator,\n * TabNavigationState<ParamListBase>,\n * MaterialTopTabNavigationEventMap\n * >(MaterialTopTabs.Navigator);\n\n * export default function TabLayout() {\n * return <ExpoRouterMaterialTopTabs />;\n * }\n * ```\n */\nexport function withLayoutContext<\n TOptions extends object,\n T extends ComponentType<any>,\n TState extends NavigationState,\n TEventMap extends EventMapBase,\n>(\n Nav: T,\n processor?: (options: ScreenProps[]) => ScreenProps[],\n useOnlyUserDefinedScreens: boolean = false\n) {\n return Object.assign(\n forwardRef(({ children: userDefinedChildren, ...props }: any, ref) => {\n const contextKey = useContextKey();\n\n const { screens, protectedScreens } = useFilterScreenChildren(userDefinedChildren, {\n contextKey,\n });\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? [], protectedScreens, useOnlyUserDefinedScreens);\n\n // Prevent throwing an error when there are no screens.\n if (!sorted.length) {\n return null;\n }\n\n return (\n <IsWithinLayoutContext value>\n <Nav {...props} id={contextKey} ref={ref} children={sorted} />\n </IsWithinLayoutContext>\n );\n }),\n {\n Screen,\n Protected,\n }\n ) as ForwardRefExoticComponent<\n PropsWithoutRef<PickPartial<ComponentProps<T>, 'children'>> & RefAttributes<unknown>\n > & {\n Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;\n Protected: typeof Protected;\n };\n}\n"]}
1
+ {"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,0DAsFC;AAoCD,8CA2CC;AAzLD,+CAUe;AAEf,oCAAyC;AACzC,sEAA+F;AAE/F,8CA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,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,iBAAiB,CAM/B,GAAM,EACN,SAAqD,EACrD,4BAAqC,KAAK;IAE1C,OAAO,MAAM,CAAC,MAAM,CAClB,IAAA,kBAAU,EAAC,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,GAAG,KAAK,EAAO,EAAE,GAAG,EAAE,EAAE;QACnE,MAAM,UAAU,GAAG,IAAA,qBAAa,GAAE,CAAC;QAEnC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,uBAAuB,CAAC,mBAAmB,EAAE;YACjF,UAAU;SACX,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAEjE,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,SAAS,IAAI,EAAE,EAAE,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;QAE9F,uDAAuD;QACvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,CACL,CAAC,6CAAqB,CAAC,KAAK,CAC1B;UAAA,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAC7D;QAAA,EAAE,6CAAqB,CAAC,CACzB,CAAC;IACJ,CAAC,CAAC,EACF;QACE,MAAM,EAAN,eAAM;QACN,SAAS,EAAT,qBAAS;KACV,CAMF,CAAC;AACJ,CAAC","sourcesContent":["import { EventMapBase, NavigationState } from '@react-navigation/native';\nimport React, {\n Children,\n forwardRef,\n ComponentProps,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n ReactNode,\n RefAttributes,\n useMemo,\n} from 'react';\n\nimport { useContextKey } from '../Route';\nimport { isNativeTabTrigger, convertTabPropsToOptions } from '../native-tabs/NativeTabTrigger';\nimport { PickPartial } from '../types';\nimport { useSortedScreens, ScreenProps } from '../useScreens';\nimport { IsWithinLayoutContext } from './IsWithinLayoutContext';\nimport { isProtectedReactElement, Protected } from '../views/Protected';\nimport { isScreen, Screen } from '../views/Screen';\n\nexport function useFilterScreenChildren(\n children: ReactNode,\n {\n isCustomNavigator,\n contextKey,\n }: {\n isCustomNavigator?: boolean;\n /** Used for sending developer hints */\n contextKey?: string;\n } = {}\n) {\n return useMemo(() => {\n const customChildren: any[] = [];\n\n const screens: (ScreenProps & { name: string })[] = [];\n const protectedScreens = new Set<string>();\n\n function flattenChild(child: ReactNode, exclude = false) {\n if (isScreen(child, contextKey)) {\n if (exclude) {\n protectedScreens.add(child.props.name);\n } else {\n screens.push(child.props);\n }\n return;\n }\n\n if (isNativeTabTrigger(child, contextKey)) {\n if (exclude) {\n protectedScreens.add(child.props.name);\n } else {\n const options = convertTabPropsToOptions(child.props);\n if (options.hidden === false) {\n screens.push({\n ...child.props,\n options,\n });\n } else {\n // - hidden = undefined -> then the route was not specified in navigator\n // - hidden = true -> then the route is hidden\n // In this cases we should treat the tab as protected\n protectedScreens.add(child.props.name);\n }\n }\n return;\n }\n\n if (isProtectedReactElement(child)) {\n const excludeChildren = exclude || !child.props.guard;\n Children.forEach(child.props.children, (protectedChild) => {\n flattenChild(protectedChild, excludeChildren);\n });\n return;\n }\n\n if (isCustomNavigator) {\n customChildren.push(child);\n return null;\n }\n\n console.warn(\n `Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />. Update Layout Route at: \"app${contextKey}/_layout\"`\n );\n\n return null;\n }\n\n Children.forEach(children, (child) => flattenChild(child));\n\n // Add an assertion for development\n if (process.env.NODE_ENV !== 'production') {\n // Assert if names are not unique\n const names = screens?.map(\n (screen) => screen && typeof screen === 'object' && 'name' in screen && screen.name\n );\n if (names && new Set(names).size !== names.length) {\n throw new Error('Screen names must be unique: ' + names);\n }\n }\n\n return {\n screens,\n children: customChildren,\n protectedScreens,\n };\n }, [children]);\n}\n\n/**\n * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.\n * Return type with `children` prop optional.\n * \n * Enables use of other built-in React Navigation navigators and other navigators built with the React Navigation custom navigator API.\n *\n * @param Nav - The navigator component to wrap.\n * @param processor - A function that processes the screens before passing them to the navigator.\n * @param useOnlyUserDefinedScreens - If true, all screens not specified as navigator's children will be ignored.\n *\n * @example\n * ```tsx app/_layout.tsx\n * import { ParamListBase, TabNavigationState } from \"@react-navigation/native\";\n * import {\n * createMaterialTopTabNavigator,\n * MaterialTopTabNavigationOptions,\n * MaterialTopTabNavigationEventMap,\n * } from \"@react-navigation/material-top-tabs\";\n * import { withLayoutContext } from \"expo-router\";\n * \n * const MaterialTopTabs = createMaterialTopTabNavigator();\n * \n * const ExpoRouterMaterialTopTabs = withLayoutContext<\n * MaterialTopTabNavigationOptions,\n * typeof MaterialTopTabs.Navigator,\n * TabNavigationState<ParamListBase>,\n * MaterialTopTabNavigationEventMap\n * >(MaterialTopTabs.Navigator);\n\n * export default function TabLayout() {\n * return <ExpoRouterMaterialTopTabs />;\n * }\n * ```\n */\nexport function withLayoutContext<\n TOptions extends object,\n T extends ComponentType<any>,\n TState extends NavigationState,\n TEventMap extends EventMapBase,\n>(\n Nav: T,\n processor?: (options: ScreenProps[]) => ScreenProps[],\n useOnlyUserDefinedScreens: boolean = false\n) {\n return Object.assign(\n forwardRef(({ children: userDefinedChildren, ...props }: any, ref) => {\n const contextKey = useContextKey();\n\n const { screens, protectedScreens } = useFilterScreenChildren(userDefinedChildren, {\n contextKey,\n });\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? [], protectedScreens, useOnlyUserDefinedScreens);\n\n // Prevent throwing an error when there are no screens.\n if (!sorted.length) {\n return null;\n }\n\n return (\n <IsWithinLayoutContext value>\n <Nav {...props} id={contextKey} ref={ref} children={sorted} />\n </IsWithinLayoutContext>\n );\n }),\n {\n Screen,\n Protected,\n }\n ) as ForwardRefExoticComponent<\n PropsWithoutRef<PickPartial<ComponentProps<T>, 'children'>> & RefAttributes<unknown>\n > & {\n Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;\n Protected: typeof Protected;\n };\n}\n"]}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Convert a route's pathname to a loader module path.
3
+ *
4
+ * @example
5
+ * getLoaderModulePath(`/`); // `/_expo/loaders/index`
6
+ * getLoaderModulePath(`/about`) // `/_expo/loaders/about`
7
+ * getLoaderModulePath(`/posts/1`) // `/_expo/loaders/posts/1`
8
+ */
9
+ export declare function getLoaderModulePath(pathname: string): string;
1
10
  /**
2
11
  * Fetches and parses a loader module from the given route path.
3
12
  * This works in all environments including:
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAkBvE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAiBvE"}
@@ -1,6 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLoaderModulePath = getLoaderModulePath;
3
4
  exports.fetchLoaderModule = fetchLoaderModule;
5
+ /**
6
+ * Convert a route's pathname to a loader module path.
7
+ *
8
+ * @example
9
+ * getLoaderModulePath(`/`); // `/_expo/loaders/index`
10
+ * getLoaderModulePath(`/about`) // `/_expo/loaders/about`
11
+ * getLoaderModulePath(`/posts/1`) // `/_expo/loaders/posts/1`
12
+ */
13
+ function getLoaderModulePath(pathname) {
14
+ const urlPath = new URL(pathname, 'http://localhost').pathname;
15
+ const normalizedPath = urlPath === '/' ? '/' : urlPath.replace(/\/$/, '');
16
+ const pathSegment = normalizedPath === '/' ? '/index' : normalizedPath;
17
+ return `/_expo/loaders${pathSegment}`;
18
+ }
4
19
  /**
5
20
  * Fetches and parses a loader module from the given route path.
6
21
  * This works in all environments including:
@@ -9,8 +24,7 @@ exports.fetchLoaderModule = fetchLoaderModule;
9
24
  * 3. SSR environments
10
25
  */
11
26
  async function fetchLoaderModule(routePath) {
12
- const loaderPath = `/_expo/loaders${routePath}`;
13
- // NOTE(@hassankhan): Might be a good idea to convert `loaderPath` to an `URL` object
27
+ const loaderPath = getLoaderModulePath(routePath);
14
28
  const response = await fetch(loaderPath, {
15
29
  headers: {
16
30
  Accept: 'application/json',
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;AAOA,8CAkBC;AAzBD;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CAAC,SAAiB;IACvD,MAAM,UAAU,GAAG,iBAAiB,SAAS,EAAE,CAAC;IAEhD,qFAAqF;IACrF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;QACvC,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;KACF,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC","sourcesContent":["/**\n * Fetches and parses a loader module from the given route path.\n * This works in all environments including:\n * 1. Development with Metro dev server (see `LoaderModuleMiddleware`)\n * 2. Production with static files (SSG)\n * 3. SSR environments\n */\nexport async function fetchLoaderModule(routePath: string): Promise<any> {\n const loaderPath = `/_expo/loaders${routePath}`;\n\n // NOTE(@hassankhan): Might be a good idea to convert `loaderPath` to an `URL` object\n const response = await fetch(loaderPath, {\n headers: {\n Accept: 'application/json',\n },\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch loader data: ${response.status}`);\n }\n\n try {\n return await response.json();\n } catch (error) {\n throw new Error(`Failed to parse loader data: ${error}`);\n }\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;AAQA,kDAMC;AASD,8CAiBC;AAxCD;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,QAAgB;IAClD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC;IAC/D,MAAM,cAAc,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,WAAW,GAAG,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC;IAEvE,OAAO,iBAAiB,WAAW,EAAE,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CAAC,SAAiB;IACvD,MAAM,UAAU,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;QACvC,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;KACF,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC","sourcesContent":["/**\n * Convert a route's pathname to a loader module path.\n *\n * @example\n * getLoaderModulePath(`/`); // `/_expo/loaders/index`\n * getLoaderModulePath(`/about`) // `/_expo/loaders/about`\n * getLoaderModulePath(`/posts/1`) // `/_expo/loaders/posts/1`\n */\nexport function getLoaderModulePath(pathname: string): string {\n const urlPath = new URL(pathname, 'http://localhost').pathname;\n const normalizedPath = urlPath === '/' ? '/' : urlPath.replace(/\\/$/, '');\n const pathSegment = normalizedPath === '/' ? '/index' : normalizedPath;\n\n return `/_expo/loaders${pathSegment}`;\n}\n\n/**\n * Fetches and parses a loader module from the given route path.\n * This works in all environments including:\n * 1. Development with Metro dev server (see `LoaderModuleMiddleware`)\n * 2. Production with static files (SSG)\n * 3. SSR environments\n */\nexport async function fetchLoaderModule(routePath: string): Promise<any> {\n const loaderPath = getLoaderModulePath(routePath);\n\n const response = await fetch(loaderPath, {\n headers: {\n Accept: 'application/json',\n },\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch loader data: ${response.status}`);\n }\n\n try {\n return await response.json();\n } catch (error) {\n throw new Error(`Failed to parse loader data: ${error}`);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,aAAa,EAIb,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,OAAO,KAAK,EAEV,gBAAgB,EAChB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAOjB,eAAO,MAAM,iBAAiB,wBAAsC,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,GAAG,IAAI,EACR,EAAE,eAAe,qBAqGjB;AAID,eAAO,MAAM,8BAA8B;;;;;;;;;;;CAKa,CAAC"}
1
+ {"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,aAAa,EAIb,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAC;AAOxF,eAAO,MAAM,iBAAiB,wBAAsC,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,GAAG,IAAI,EACR,EAAE,eAAe,qBAqGjB;AAID,eAAO,MAAM,8BAA8B;;;;;;;;;;;CAKa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeBottomTabsNavigator.js","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6Bb,kDAgHC;AA3ID,qDAQkC;AAClC,+CAAyD;AAEzD,qEAAkE;AAClE,qDAAkD;AAOlD,mCAAsF;AACtF,oEAAiE;AACjE,6CAAmD;A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AAC,CAAC,CAAC,CAAC,CAAC;IAE9E,MAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,CAAC,MAAc,EAAE,EAAE;QACjB,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC/B,UAAU,CAAC,QAAQ,CAAC;YAClB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,KAAK,CAAC,GAAG;YACjB,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CACrC,CAAC;IAEF,OAAO,CACL,CAAC,iBAAiB,CAChB;MAAA,CAAC,yBAAiB,CAAC,KAAK,CACtB;QAAA,CAAC,+BAAc,CACb,IAAI,IAAI,CAAC,CACT,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,IAAI,CAAC,CAAC,WAAW,CAAC,CAClB,WAAW,CAAC,CAAC,WAAW,CAAC,EAE7B;MAAA,EAAE,yBAAiB,CACrB;IAAA,EAAE,iBAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,wBAAwB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AAEhE,QAAA,8BAA8B,GAAG,IAAA,qCAAiB,EAK7D,wBAAwB,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","sourcesContent":["'use client';\n\nimport {\n createNavigatorFactory,\n NavigationState,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n type EventMapBase,\n} from '@react-navigation/native';\nimport React, { use, useCallback, useMemo } from 'react';\n\nimport { NativeBottomTabsRouter } from './NativeBottomTabsRouter';\nimport { NativeTabsView } from './NativeTabsView';\nimport type {\n ExtendedNativeTabOptions,\n NativeTabOptions,\n NativeTabsProps,\n NativeTabsViewTabItem,\n} from './types';\nimport { convertIconColorPropToObject, convertLabelStylePropToObject } from './utils';\nimport { withLayoutContext } from '../layouts/withLayoutContext';\nimport { getPathFromState } from '../link/linking';\n\n// In Jetpack Compose, the default back behavior is to go back to the initial route.\nconst defaultBackBehavior = 'initialRoute';\nexport const NativeTabsContext = React.createContext<boolean>(false);\n\nexport function NativeTabsNavigator({\n children,\n backBehavior = defaultBackBehavior,\n labelStyle,\n iconColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n ...rest\n}: NativeTabsProps) {\n if (use(NativeTabsContext)) {\n throw new Error(\n 'Nesting Native Tabs inside each other is not supported natively. Use JS tabs for nesting instead.'\n );\n }\n\n const processedLabelStyle = convertLabelStylePropToObject(labelStyle);\n const processedIconColor = convertIconColorPropToObject(iconColor);\n\n const selectedLabelStyle = processedLabelStyle.selected\n ? {\n ...processedLabelStyle.selected,\n color: processedLabelStyle.selected.color ?? rest.tintColor,\n }\n : rest.tintColor\n ? { color: rest.tintColor }\n : undefined;\n\n const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n ExtendedNativeTabOptions,\n Record<string, any>\n >(NativeBottomTabsRouter, {\n children,\n backBehavior,\n screenOptions: {\n disableTransparentOnScrollEdge: rest.disableTransparentOnScrollEdge,\n labelStyle: processedLabelStyle.default,\n selectedLabelStyle,\n iconColor: processedIconColor.default,\n selectedIconColor: processedIconColor.selected ?? rest.tintColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n },\n });\n\n const { routes } = state;\n\n const visibleTabs = useMemo(\n () =>\n routes\n // The <NativeTab.Trigger> always sets `hidden` to defined boolean value.\n // If it is not defined, then it was not specified, and we should hide the tab.\n .filter((route) => descriptors[route.key].options?.hidden !== true)\n .map(\n (route): NativeTabsViewTabItem => ({\n options: descriptors[route.key].options,\n routeKey: route.key,\n name: route.name,\n contentRenderer: () => descriptors[route.key].render(),\n })\n ),\n [routes, descriptors]\n );\n const visibleFocusedTabIndex = useMemo(\n () => visibleTabs.findIndex((tab) => tab.routeKey === routes[state.index].key),\n [visibleTabs, routes, state.index]\n );\n\n if (visibleFocusedTabIndex < 0) {\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 }\n const focusedIndex = visibleFocusedTabIndex >= 0 ? visibleFocusedTabIndex : 0;\n\n const onTabChange = useCallback(\n (tabKey: string) => {\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 [descriptors, navigation, state.key]\n );\n\n return (\n <NavigationContent>\n <NativeTabsContext value>\n <NativeTabsView\n {...rest}\n focusedIndex={focusedIndex}\n tabs={visibleTabs}\n onTabChange={onTabChange}\n />\n </NativeTabsContext>\n </NavigationContent>\n );\n}\n\nconst createNativeTabNavigator = createNavigatorFactory(NativeTabsNavigator);\n\nexport const NativeTabsNavigatorWithContext = withLayoutContext<\n NativeTabOptions,\n typeof NativeTabsNavigator,\n NavigationState,\n EventMapBase\n>(createNativeTabNavigator().Navigator, undefined, true);\n"]}
1
+ {"version":3,"file":"NativeBottomTabsNavigator.js","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBb,kDAgHC;AAtID,qDAQkC;AAClC,+CAAyD;AAEzD,qEAAkE;AAClE,qDAAkD;AAElD,mCAAsF;AACtF,oEAAiE;AACjE,6CAAmD;AAEnD,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC9B,QAAA,iBAAiB,GAAG,eAAK,CAAC,aAAa,CAAU,KAAK,CAAC,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GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC/B,UAAU,CAAC,QAAQ,CAAC;YAClB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,KAAK,CAAC,GAAG;YACjB,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CACrC,CAAC;IAEF,OAAO,CACL,CAAC,iBAAiB,CAChB;MAAA,CAAC,yBAAiB,CAAC,KAAK,CACtB;QAAA,CAAC,+BAAc,CACb,IAAI,IAAI,CAAC,CACT,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,IAAI,CAAC,CAAC,WAAW,CAAC,CAClB,WAAW,CAAC,CAAC,WAAW,CAAC,EAE7B;MAAA,EAAE,yBAAiB,CACrB;IAAA,EAAE,iBAAiB,CAAC,CACrB,CAAC;AACJ,CAAC;AAED,MAAM,wBAAwB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AAEhE,QAAA,8BAA8B,GAAG,IAAA,qCAAiB,EAK7D,wBAAwB,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","sourcesContent":["'use client';\n\nimport {\n createNavigatorFactory,\n NavigationState,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n type EventMapBase,\n} from '@react-navigation/native';\nimport React, { use, useCallback, useMemo } from 'react';\n\nimport { NativeBottomTabsRouter } from './NativeBottomTabsRouter';\nimport { NativeTabsView } from './NativeTabsView';\nimport type { NativeTabOptions, NativeTabsProps, NativeTabsViewTabItem } from './types';\nimport { convertIconColorPropToObject, convertLabelStylePropToObject } from './utils';\nimport { withLayoutContext } from '../layouts/withLayoutContext';\nimport { getPathFromState } from '../link/linking';\n\n// In Jetpack Compose, the default back behavior is to go back to the initial route.\nconst defaultBackBehavior = 'initialRoute';\nexport const NativeTabsContext = React.createContext<boolean>(false);\n\nexport function NativeTabsNavigator({\n children,\n backBehavior = defaultBackBehavior,\n labelStyle,\n iconColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n ...rest\n}: NativeTabsProps) {\n if (use(NativeTabsContext)) {\n throw new Error(\n 'Nesting Native Tabs inside each other is not supported natively. Use JS tabs for nesting instead.'\n );\n }\n\n const processedLabelStyle = convertLabelStylePropToObject(labelStyle);\n const processedIconColor = convertIconColorPropToObject(iconColor);\n\n const selectedLabelStyle = processedLabelStyle.selected\n ? {\n ...processedLabelStyle.selected,\n color: processedLabelStyle.selected.color ?? rest.tintColor,\n }\n : rest.tintColor\n ? { color: rest.tintColor }\n : undefined;\n\n const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n NativeTabOptions,\n Record<string, any>\n >(NativeBottomTabsRouter, {\n children,\n backBehavior,\n screenOptions: {\n disableTransparentOnScrollEdge: rest.disableTransparentOnScrollEdge,\n labelStyle: processedLabelStyle.default,\n selectedLabelStyle,\n iconColor: processedIconColor.default,\n selectedIconColor: processedIconColor.selected ?? rest.tintColor,\n blurEffect,\n backgroundColor,\n badgeBackgroundColor,\n indicatorColor,\n badgeTextColor,\n },\n });\n\n const { routes } = state;\n\n const visibleTabs = useMemo(\n () =>\n routes\n // The <NativeTab.Trigger> always sets `hidden` to defined boolean value.\n // If it is not defined, then it was not specified, and we should hide the tab.\n .filter((route) => descriptors[route.key].options?.hidden !== true)\n .map(\n (route): NativeTabsViewTabItem => ({\n options: descriptors[route.key].options,\n routeKey: route.key,\n name: route.name,\n contentRenderer: () => descriptors[route.key].render(),\n })\n ),\n [routes, descriptors]\n );\n const visibleFocusedTabIndex = useMemo(\n () => visibleTabs.findIndex((tab) => tab.routeKey === routes[state.index].key),\n [visibleTabs, routes, state.index]\n );\n\n if (visibleFocusedTabIndex < 0) {\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 }\n const focusedIndex = visibleFocusedTabIndex >= 0 ? visibleFocusedTabIndex : 0;\n\n const onTabChange = useCallback(\n (tabKey: string) => {\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 [descriptors, navigation, state.key]\n );\n\n return (\n <NavigationContent>\n <NativeTabsContext value>\n <NativeTabsView\n {...rest}\n focusedIndex={focusedIndex}\n tabs={visibleTabs}\n onTabChange={onTabChange}\n />\n </NativeTabsContext>\n </NavigationContent>\n );\n}\n\nconst createNativeTabNavigator = createNavigatorFactory(NativeTabsNavigator);\n\nexport const NativeTabsNavigatorWithContext = withLayoutContext<\n NativeTabOptions,\n typeof NativeTabsNavigator,\n NavigationState,\n EventMapBase\n>(createNativeTabNavigator().Navigator, undefined, true);\n"]}
@@ -1,7 +1,6 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
- import { NativeTabsTriggerTabBar } from './NativeTabsTriggerTabBar';
3
- import type { ExtendedNativeTabOptions, NativeTabTriggerProps } from './types';
4
- import { type IconProps } from './common/elements';
2
+ import type { NativeTabOptions, NativeTabTriggerProps } from './types';
3
+ import { type NativeTabsTriggerBadgeProps, type NativeTabsTriggerLabelProps, type NativeTabsTriggerIconProps } from './common/elements';
5
4
  /**
6
5
  * The component used to customize the native tab options both in the _layout file and from the tab screen.
7
6
  *
@@ -32,7 +31,7 @@ import { type IconProps } from './common/elements';
32
31
  * return (
33
32
  * <View>
34
33
  * <NativeTabs.Trigger>
35
- * <Label>Home</Label>
34
+ * <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>
36
35
  * </NativeTabs.Trigger>
37
36
  * <Text>This is home screen!</Text>
38
37
  * </View>
@@ -44,10 +43,13 @@ import { type IconProps } from './common/elements';
44
43
  */
45
44
  declare function NativeTabTriggerImpl(props: NativeTabTriggerProps): null;
46
45
  export declare const NativeTabTrigger: typeof NativeTabTriggerImpl & {
47
- TabBar: typeof NativeTabsTriggerTabBar;
46
+ Label: import("react").FC<NativeTabsTriggerLabelProps>;
47
+ Icon: import("react").FC<NativeTabsTriggerIconProps>;
48
+ Badge: import("react").FC<NativeTabsTriggerBadgeProps>;
49
+ VectorIcon: typeof import("../primitives").VectorIcon;
48
50
  };
49
- export declare function convertTabPropsToOptions({ options, hidden, children, role, disablePopToTop, disableScrollToTop }: NativeTabTriggerProps, isDynamic?: boolean): ExtendedNativeTabOptions;
50
- export declare function appendIconOptions(options: ExtendedNativeTabOptions, props: IconProps): void;
51
+ export declare function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, disableScrollToTop, unstable_nativeProps, }: NativeTabTriggerProps, isDynamic?: boolean): NativeTabOptions;
52
+ export declare function appendIconOptions(options: NativeTabOptions, props: NativeTabsTriggerIconProps): void;
51
53
  export declare function isNativeTabTrigger(child: ReactNode, contextKey?: string): child is ReactElement<NativeTabTriggerProps & {
52
54
  name: string;
53
55
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeTabTrigger.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EACV,wBAAwB,EAGxB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAKL,KAAK,SAAS,EAKf,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,QAsBzD;AAED,e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AAE,SAAS,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,KAAK,IAAI,YAAY,CAAC,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA6BjE"}
@@ -7,7 +7,6 @@ exports.appendIconOptions = appendIconOptions;
7
7
  exports.isNativeTabTrigger = isNativeTabTrigger;
8
8
  const native_1 = require("@react-navigation/native");
9
9
  const react_1 = require("react");
10
- const NativeTabsTriggerTabBar_1 = require("./NativeTabsTriggerTabBar");
11
10
  const utils_1 = require("./utils");
12
11
  const PreviewRouteContext_1 = require("../link/preview/PreviewRouteContext");
13
12
  const useSafeLayoutEffect_1 = require("../views/useSafeLayoutEffect");
@@ -42,7 +41,7 @@ const elements_1 = require("./common/elements");
42
41
  * return (
43
42
  * <View>
44
43
  * <NativeTabs.Trigger>
45
- * <Label>Home</Label>
44
+ * <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>
46
45
  * </NativeTabs.Trigger>
47
46
  * <Text>This is home screen!</Text>
48
47
  * </View>
@@ -72,13 +71,17 @@ function NativeTabTriggerImpl(props) {
72
71
  return null;
73
72
  }
74
73
  exports.NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {
75
- TabBar: NativeTabsTriggerTabBar_1.NativeTabsTriggerTabBar,
74
+ Label: elements_1.NativeTabsTriggerLabel,
75
+ Icon: elements_1.NativeTabsTriggerIcon,
76
+ Badge: elements_1.NativeTabsTriggerBadge,
77
+ VectorIcon: elements_1.NativeTabsTriggerVectorIcon,
76
78
  });
77
- function convertTabPropsToOptions({ options, hidden, children, role, disablePopToTop, disableScrollToTop }, isDynamic = false) {
79
+ function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, disableScrollToTop, unstable_nativeProps, }, isDynamic = false) {
78
80
  const initialOptions = isDynamic
79
- ? { ...options }
81
+ ? {
82
+ ...(unstable_nativeProps ? { nativeProps: unstable_nativeProps } : {}),
83
+ }
80
84
  : {
81
- ...options,
82
85
  hidden: !!hidden,
83
86
  specialEffects: {
84
87
  repeatedTabSelection: {
@@ -86,27 +89,24 @@ function convertTabPropsToOptions({ options, hidden, children, role, disablePopT
86
89
  scrollToTop: !disableScrollToTop,
87
90
  },
88
91
  },
89
- role: role ?? options?.role,
92
+ role,
93
+ nativeProps: unstable_nativeProps,
90
94
  };
91
95
  const allowedChildren = (0, utils_1.filterAllowedChildrenElements)(children, [
92
- elements_1.Badge,
93
- elements_1.Label,
94
- elements_1.Icon,
95
- NativeTabsTriggerTabBar_1.NativeTabsTriggerTabBar,
96
+ elements_1.NativeTabsTriggerBadge,
97
+ elements_1.NativeTabsTriggerLabel,
98
+ elements_1.NativeTabsTriggerIcon,
96
99
  ]);
97
100
  return allowedChildren.reduce((acc, child) => {
98
- if ((0, utils_1.isChildOfType)(child, elements_1.Badge)) {
101
+ if ((0, utils_1.isChildOfType)(child, elements_1.NativeTabsTriggerBadge)) {
99
102
  appendBadgeOptions(acc, child.props);
100
103
  }
101
- else if ((0, utils_1.isChildOfType)(child, elements_1.Label)) {
104
+ else if ((0, utils_1.isChildOfType)(child, elements_1.NativeTabsTriggerLabel)) {
102
105
  appendLabelOptions(acc, child.props);
103
106
  }
104
- else if ((0, utils_1.isChildOfType)(child, elements_1.Icon)) {
107
+ else if ((0, utils_1.isChildOfType)(child, elements_1.NativeTabsTriggerIcon)) {
105
108
  appendIconOptions(acc, child.props);
106
109
  }
107
- else if ((0, utils_1.isChildOfType)(child, NativeTabsTriggerTabBar_1.NativeTabsTriggerTabBar)) {
108
- appendTabBarOptions(acc, child.props);
109
- }
110
110
  return acc;
111
111
  }, { ...initialOptions });
112
112
  }
@@ -134,12 +134,7 @@ function appendLabelOptions(options, props) {
134
134
  }
135
135
  }
136
136
  function appendIconOptions(options, props) {
137
- if ('src' in props && props.src) {
138
- const icon = convertIconSrcToIconOption(props);
139
- options.icon = icon?.icon;
140
- options.selectedIcon = icon?.selectedIcon;
141
- }
142
- else if ('sf' in props && process.env.EXPO_OS === 'ios') {
137
+ if ('sf' in props && props.sf && process.env.EXPO_OS === 'ios') {
143
138
  if (typeof props.sf === 'string') {
144
139
  options.icon = props.sf
145
140
  ? {
@@ -161,15 +156,15 @@ function appendIconOptions(options, props) {
161
156
  : undefined;
162
157
  }
163
158
  }
164
- else if ('androidSrc' in props && process.env.EXPO_OS === 'android') {
165
- const icon = convertIconSrcToIconOption({ src: props.androidSrc });
166
- options.icon = icon?.icon;
167
- options.selectedIcon = icon?.selectedIcon;
168
- }
169
- else if ('drawable' in props && process.env.EXPO_OS === 'android') {
159
+ else if ('drawable' in props && props.drawable && process.env.EXPO_OS === 'android') {
170
160
  options.icon = { drawable: props.drawable };
171
161
  options.selectedIcon = undefined;
172
162
  }
163
+ else if ('src' in props && props.src) {
164
+ const icon = convertIconSrcToIconOption(props);
165
+ options.icon = icon?.icon;
166
+ options.selectedIcon = icon?.selectedIcon;
167
+ }
173
168
  if (props.selectedColor) {
174
169
  options.selectedIconColor = props.selectedColor;
175
170
  }
@@ -189,7 +184,7 @@ function convertIconSrcToIconOption(icon) {
189
184
  function convertSrcOrComponentToSrc(src) {
190
185
  if (src) {
191
186
  if ((0, react_1.isValidElement)(src)) {
192
- if (src.type === elements_1.VectorIcon) {
187
+ if (src.type === elements_1.NativeTabsTriggerVectorIcon) {
193
188
  const props = src.props;
194
189
  return { src: props.family.getImageSource(props.name, 24, 'white') };
195
190
  }
@@ -203,40 +198,6 @@ function convertSrcOrComponentToSrc(src) {
203
198
  }
204
199
  return undefined;
205
200
  }
206
- function appendTabBarOptions(options, props) {
207
- const { backgroundColor, blurEffect, iconColor, disableTransparentOnScrollEdge, badgeBackgroundColor, badgeTextColor, indicatorColor, labelStyle, shadowColor, } = props;
208
- if (backgroundColor) {
209
- options.backgroundColor = backgroundColor;
210
- }
211
- // We need better native integration of this on Android
212
- // Simulating from JS side creates ugly transitions
213
- if (process.env.EXPO_OS !== 'android') {
214
- if (blurEffect) {
215
- options.blurEffect = blurEffect;
216
- }
217
- if (shadowColor) {
218
- options.shadowColor = shadowColor;
219
- }
220
- if (iconColor) {
221
- options.iconColor = iconColor;
222
- }
223
- if (disableTransparentOnScrollEdge !== undefined) {
224
- options.disableTransparentOnScrollEdge = disableTransparentOnScrollEdge;
225
- }
226
- if (badgeBackgroundColor) {
227
- options.badgeBackgroundColor = badgeBackgroundColor;
228
- }
229
- if (badgeTextColor) {
230
- options.badgeTextColor = badgeTextColor;
231
- }
232
- if (indicatorColor) {
233
- options.indicatorColor = indicatorColor;
234
- }
235
- if (labelStyle) {
236
- options.labelStyle = labelStyle;
237
- }
238
- }
239
- }
240
201
  function isNativeTabTrigger(child, contextKey) {
241
202
  if ((0, react_1.isValidElement)(child) && child && child.type === exports.NativeTabTrigger) {
242
203
  if (typeof child.props === 'object' &&
@@ -1 +1 @@
1
- {"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAgGb,4DAsCC;AAyBD,8CAoCC;AAqFD,gDAgCC;AAtTD,qDAAmE;AACnE,iCAA0E;AAG1E,uEAAoE;AAOpE,mCAAuE;AACvE,6EAAmE;AACnE,sEAAmE;AACnE,gDAU2B;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,SAAS,oBAAoB,CAAC,KAA4B;IACxD,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACzC,MAAM,WAAW,GAAG,IAAA,kCAAY,GAAE,CAAC;IAEnC,IAAA,yCAAmB,EAAC,GAAG,EAAE;QACvB,6DAA6D;QAC7D,yEAAyE;QACzE,iDAAiD;QACjD,IAAI,SAAS,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9B,IAAI,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,KAAK,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AAoB,CAAC;QACtD,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;QAC1C,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;QAC1C,CAAC;QACD,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,KAAgB,EAChB,UAAmB;IAEnB,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,wBAAgB,EAAE,CAAC;QACtE,IACE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;YAC/B,KAAK,CAAC,KAAK;YACX,MAAM,IAAI,KAAK,CAAC,KAAK;YACrB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EACjB,CAAC;YACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,8EAA8E,CAChJ,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,IACE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,IAAI,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK,CAAC,KAAK,CAC9E,EACD,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,0GAA0G,CAC5K,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { isValidElement, type ReactElement, type ReactNode } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport { NativeTabsTriggerTabBar } from './NativeTabsTriggerTabBar';\nimport type {\n ExtendedNativeTabOptions,\n NativeTabOptions,\n NativeTabsTriggerTabBarProps,\n NativeTabTriggerProps,\n} from './types';\nimport { filterAllowedChildrenElements, isChildOfType } from './utils';\nimport { useIsPreview } from '../link/preview/PreviewRouteContext';\nimport { useSafeLayoutEffect } from '../views/useSafeLayoutEffect';\nimport {\n Icon,\n Badge,\n Label,\n type LabelProps,\n type IconProps,\n type BadgeProps,\n type SourceIconCombination,\n VectorIcon,\n type VectorIconProps,\n} from './common/elements';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx\n * // In _layout file\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // In a tab screen\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <Label>Home</Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n * ```\n *\n * > **Note:** You can use the alias `NativeTabs.Trigger` for this component.\n */\nfunction NativeTabTriggerImpl(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isFocused = navigation.isFocused();\n const isInPreview = useIsPreview();\n\n useSafeLayoutEffect(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (isFocused && !isInPreview) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props, true);\n navigation.setOptions(options);\n }\n }, [isFocused, props, isInPreview]);\n\n return null;\n}\n\nexport const NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {\n TabBar: NativeTabsTriggerTabBar,\n});\n\nexport function convertTabPropsToOptions(\n { options, hidden, children, role, disablePopToTop, disableScrollToTop }: NativeTabTriggerProps,\n isDynamic: boolean = false\n) {\n const initialOptions: ExtendedNativeTabOptions = isDynamic\n ? { ...options }\n : {\n ...options,\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n role: role ?? options?.role,\n };\n const allowedChildren = filterAllowedChildrenElements(children, [\n Badge,\n Label,\n Icon,\n NativeTabsTriggerTabBar,\n ]);\n return allowedChildren.reduce<ExtendedNativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, Badge)) {\n appendBadgeOptions(acc, child.props);\n } else if (isChildOfType(child, Label)) {\n appendLabelOptions(acc, child.props);\n } else if (isChildOfType(child, Icon)) {\n appendIconOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerTabBar)) {\n appendTabBarOptions(acc, child.props);\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nfunction appendBadgeOptions(options: ExtendedNativeTabOptions, props: BadgeProps) {\n if (props.children) {\n options.badgeValue = String(props.children);\n options.selectedBadgeBackgroundColor = props.selectedBackgroundColor;\n } else if (!props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n options.badgeValue = ' ';\n }\n}\n\nfunction appendLabelOptions(options: ExtendedNativeTabOptions, props: LabelProps) {\n if (props.hidden) {\n options.title = '';\n } else {\n options.title = props.children;\n if (props.selectedStyle) {\n options.selectedLabelStyle = props.selectedStyle;\n }\n }\n}\n\nexport function appendIconOptions(options: ExtendedNativeTabOptions, props: IconProps) {\n if ('src' in props && props.src) {\n const icon = convertIconSrcToIconOption(props);\n options.icon = icon?.icon;\n options.selectedIcon = icon?.selectedIcon;\n } else if ('sf' in props && process.env.EXPO_OS === 'ios') {\n if (typeof props.sf === 'string') {\n options.icon = props.sf\n ? {\n sf: props.sf,\n }\n : undefined;\n options.selectedIcon = undefined;\n } else if (props.sf) {\n options.icon = props.sf.default\n ? {\n sf: props.sf.default,\n }\n : undefined;\n options.selectedIcon = props.sf.selected\n ? {\n sf: props.sf.selected,\n }\n : undefined;\n }\n } else if ('androidSrc' in props && process.env.EXPO_OS === 'android') {\n const icon = convertIconSrcToIconOption({ src: props.androidSrc });\n options.icon = icon?.icon;\n options.selectedIcon = icon?.selectedIcon;\n } else if ('drawable' in props && process.env.EXPO_OS === 'android') {\n options.icon = { drawable: props.drawable };\n options.selectedIcon = undefined;\n }\n if (props.selectedColor) {\n options.selectedIconColor = props.selectedColor;\n }\n}\n\nfunction convertIconSrcToIconOption(\n icon: SourceIconCombination | undefined\n): Pick<NativeTabOptions, 'icon' | 'selectedIcon'> | undefined {\n if (icon && icon.src) {\n const { defaultIcon, selected } =\n typeof icon.src === 'object' && 'selected' in icon.src\n ? { defaultIcon: icon.src.default, selected: icon.src.selected }\n : { defaultIcon: icon.src };\n\n const options: Pick<NativeTabOptions, 'icon' | 'selectedIcon'> = {};\n options.icon = convertSrcOrComponentToSrc(defaultIcon);\n options.selectedIcon = convertSrcOrComponentToSrc(selected);\n return options;\n }\n\n return undefined;\n}\n\nfunction convertSrcOrComponentToSrc(src: ImageSourcePropType | ReactElement | undefined) {\n if (src) {\n if (isValidElement(src)) {\n if (src.type === VectorIcon) {\n const props = src.props as VectorIconProps<string>;\n return { src: props.family.getImageSource(props.name, 24, 'white') };\n } else {\n console.warn('Only VectorIcon is supported as a React element in Icon.src');\n }\n } else {\n return { src };\n }\n }\n return undefined;\n}\n\nfunction appendTabBarOptions(\n options: ExtendedNativeTabOptions,\n props: NativeTabsTriggerTabBarProps\n) {\n const {\n backgroundColor,\n blurEffect,\n iconColor,\n disableTransparentOnScrollEdge,\n badgeBackgroundColor,\n badgeTextColor,\n indicatorColor,\n labelStyle,\n shadowColor,\n } = props;\n\n if (backgroundColor) {\n options.backgroundColor = backgroundColor;\n }\n // We need better native integration of this on Android\n // Simulating from JS side creates ugly transitions\n if (process.env.EXPO_OS !== 'android') {\n if (blurEffect) {\n options.blurEffect = blurEffect;\n }\n if (shadowColor) {\n options.shadowColor = shadowColor;\n }\n if (iconColor) {\n options.iconColor = iconColor;\n }\n if (disableTransparentOnScrollEdge !== undefined) {\n options.disableTransparentOnScrollEdge = disableTransparentOnScrollEdge;\n }\n if (badgeBackgroundColor) {\n options.badgeBackgroundColor = badgeBackgroundColor;\n }\n if (badgeTextColor) {\n options.badgeTextColor = badgeTextColor;\n }\n if (indicatorColor) {\n options.indicatorColor = indicatorColor;\n }\n if (labelStyle) {\n options.labelStyle = labelStyle;\n }\n }\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isValidElement(child) && child && child.type === NativeTabTrigger) {\n if (\n typeof child.props === 'object' &&\n child.props &&\n 'name' in child.props &&\n !child.props.name\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n ['component', 'getComponent'].some(\n (key) => child.props && typeof child.props === 'object' && key in child.props\n )\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA6Fb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KAAK,YAAY,EAAE,CAAC;YAC1C,IACE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,IAAI,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK,CAAC,KAAK,CAC9E,EACD,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,0GAA0G,CAC5K,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { isValidElement, type ReactElement, type ReactNode } from 'react';\nimport { type ImageSourcePropType } from 'react-native';\n\nimport type { NativeTabOptions, NativeTabTriggerProps } from './types';\nimport { filterAllowedChildrenElements, isChildOfType } from './utils';\nimport { useIsPreview } from '../link/preview/PreviewRouteContext';\nimport type { VectorIconProps } from '../primitives';\nimport { useSafeLayoutEffect } from '../views/useSafeLayoutEffect';\nimport {\n NativeTabsTriggerIcon,\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerVectorIcon,\n type NativeTabsTriggerBadgeProps,\n type NativeTabsTriggerLabelProps,\n type NativeTabsTriggerIconProps,\n type SrcIcon,\n} from './common/elements';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx\n * // In _layout file\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // In a tab screen\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n * ```\n *\n * > **Note:** You can use the alias `NativeTabs.Trigger` for this component.\n */\nfunction NativeTabTriggerImpl(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isFocused = navigation.isFocused();\n const isInPreview = useIsPreview();\n\n useSafeLayoutEffect(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (isFocused && !isInPreview) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props, true);\n navigation.setOptions(options);\n }\n }, [isFocused, props, isInPreview]);\n\n return null;\n}\n\nexport const NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {\n Label: NativeTabsTriggerLabel,\n Icon: NativeTabsTriggerIcon,\n Badge: NativeTabsTriggerBadge,\n VectorIcon: NativeTabsTriggerVectorIcon,\n});\n\nexport function convertTabPropsToOptions(\n {\n hidden,\n children,\n role,\n disablePopToTop,\n disableScrollToTop,\n unstable_nativeProps,\n }: NativeTabTriggerProps,\n isDynamic: boolean = false\n) {\n const initialOptions: NativeTabOptions = isDynamic\n ? {\n ...(unstable_nativeProps ? { nativeProps: unstable_nativeProps } : {}),\n }\n : {\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n role,\n nativeProps: unstable_nativeProps,\n };\n const allowedChildren = filterAllowedChildrenElements(children, [\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerIcon,\n ]);\n return allowedChildren.reduce<NativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, NativeTabsTriggerBadge)) {\n appendBadgeOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerLabel)) {\n appendLabelOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerIcon)) {\n appendIconOptions(acc, child.props);\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nfunction appendBadgeOptions(options: NativeTabOptions, props: NativeTabsTriggerBadgeProps) {\n if (props.children) {\n options.badgeValue = String(props.children);\n options.selectedBadgeBackgroundColor = props.selectedBackgroundColor;\n } else if (!props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n options.badgeValue = ' ';\n }\n}\n\nfunction appendLabelOptions(options: NativeTabOptions, props: NativeTabsTriggerLabelProps) {\n if (props.hidden) {\n options.title = '';\n } else {\n options.title = props.children;\n if (props.selectedStyle) {\n options.selectedLabelStyle = props.selectedStyle;\n }\n }\n}\n\nexport function appendIconOptions(options: NativeTabOptions, props: NativeTabsTriggerIconProps) {\n if ('sf' in props && props.sf && process.env.EXPO_OS === 'ios') {\n if (typeof props.sf === 'string') {\n options.icon = props.sf\n ? {\n sf: props.sf,\n }\n : undefined;\n options.selectedIcon = undefined;\n } else if (props.sf) {\n options.icon = props.sf.default\n ? {\n sf: props.sf.default,\n }\n : undefined;\n options.selectedIcon = props.sf.selected\n ? {\n sf: props.sf.selected,\n }\n : undefined;\n }\n } else if ('drawable' in props && props.drawable && process.env.EXPO_OS === 'android') {\n options.icon = { drawable: props.drawable };\n options.selectedIcon = undefined;\n } else if ('src' in props && props.src) {\n const icon = convertIconSrcToIconOption(props);\n options.icon = icon?.icon;\n options.selectedIcon = icon?.selectedIcon;\n }\n if (props.selectedColor) {\n options.selectedIconColor = props.selectedColor;\n }\n}\n\nfunction convertIconSrcToIconOption(\n icon: SrcIcon | undefined\n): Pick<NativeTabOptions, 'icon' | 'selectedIcon'> | undefined {\n if (icon && icon.src) {\n const { defaultIcon, selected } =\n typeof icon.src === 'object' && 'selected' in icon.src\n ? { defaultIcon: icon.src.default, selected: icon.src.selected }\n : { defaultIcon: icon.src };\n\n const options: Pick<NativeTabOptions, 'icon' | 'selectedIcon'> = {};\n options.icon = convertSrcOrComponentToSrc(defaultIcon);\n options.selectedIcon = convertSrcOrComponentToSrc(selected);\n return options;\n }\n\n return undefined;\n}\n\nfunction convertSrcOrComponentToSrc(src: ImageSourcePropType | ReactElement | undefined) {\n if (src) {\n if (isValidElement(src)) {\n if (src.type === NativeTabsTriggerVectorIcon) {\n const props = src.props as VectorIconProps<string>;\n return { src: props.family.getImageSource(props.name, 24, 'white') };\n } else {\n console.warn('Only VectorIcon is supported as a React element in Icon.src');\n }\n } else {\n return { src };\n }\n }\n return undefined;\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isValidElement(child) && child && child.type === NativeTabTrigger) {\n if (\n typeof child.props === 'object' &&\n child.props &&\n 'name' in child.props &&\n !child.props.name\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n ['component', 'getComponent'].some(\n (key) => child.props && typeof child.props === 'object' && key in child.props\n )\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
@@ -19,7 +19,10 @@ import type { NativeTabsProps } from './types';
19
19
  */
20
20
  export declare const NativeTabs: ((props: NativeTabsProps) => import("react").JSX.Element) & {
21
21
  Trigger: ((props: import("./types").NativeTabTriggerProps) => null) & {
22
- TabBar: typeof import("./NativeTabsTriggerTabBar").NativeTabsTriggerTabBar;
22
+ Label: import("react").FC<import(".").NativeTabsTriggerLabelProps>;
23
+ Icon: import("react").FC<import(".").NativeTabsTriggerIconProps>;
24
+ Badge: import("react").FC<import(".").NativeTabsTriggerBadgeProps>;
25
+ VectorIcon: typeof import("..").VectorIcon;
23
26
  };
24
27
  };
25
28
  //# sourceMappingURL=NativeTabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NativeTabs.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabs.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,WACb,eAAe;;;;CAIxB,CAAC"}
1
+ {"version":3,"file":"NativeTabs.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabs.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,WACb,eAAe;;;;;;;CAIxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeTabsView.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAchD,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,SAAS,CAAC;AAYjB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAuExD"}
1
+ {"version":3,"file":"NativeTabsView.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAchD,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,SAAS,CAAC;AAWjB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBA6ExD"}
@@ -43,7 +43,7 @@ const icon_1 = require("./utils/icon");
43
43
  // Otherwise user may see glitches when switching between tabs.
44
44
  react_native_screens_1.featureFlags.experiment.controlledBottomTabs = false;
45
45
  function NativeTabsView(props) {
46
- const { minimizeBehavior, disableIndicator, focusedIndex, tabs } = props;
46
+ const { minimizeBehavior, disableIndicator, focusedIndex, tabs, sidebarAdaptable } = props;
47
47
  const deferredFocusedIndex = (0, react_1.useDeferredValue)(focusedIndex);
48
48
  // We need to check if the deferred index is not out of bounds
49
49
  // This can happen when the focused index is the last tab, and user removes that tab
@@ -60,6 +60,11 @@ function NativeTabsView(props) {
60
60
  return (<Screen key={tab.routeKey} routeKey={tab.routeKey} name={tab.name} options={tab.options} isFocused={isFocused} standardAppearance={appearances[index].standardAppearance} scrollEdgeAppearance={appearances[index].scrollEdgeAppearance} badgeTextColor={tab.options.badgeTextColor} contentRenderer={tab.contentRenderer}/>);
61
61
  });
62
62
  const currentTabAppearance = appearances[inBoundsDeferredFocusedIndex]?.standardAppearance;
63
+ const tabBarControllerMode = sidebarAdaptable
64
+ ? 'tabSidebar'
65
+ : sidebarAdaptable === false
66
+ ? 'tabBar'
67
+ : 'automatic';
63
68
  return (<BottomTabsWrapper
64
69
  // #region android props
65
70
  tabBarItemTitleFontColor={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontColor} tabBarItemTitleFontFamily={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontFamily} tabBarItemTitleFontSize={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize} tabBarItemTitleFontSizeActive={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize} tabBarItemTitleFontWeight={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontWeight} tabBarItemTitleFontStyle={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontStyle} tabBarItemIconColor={currentTabAppearance?.stacked?.normal?.tabBarItemIconColor} tabBarBackgroundColor={currentTabAppearance?.tabBarBackgroundColor} tabBarItemRippleColor={props.rippleColor} tabBarItemLabelVisibilityMode={props.labelVisibilityMode} tabBarItemIconColorActive={currentTabAppearance?.stacked?.selected?.tabBarItemIconColor ?? props?.tintColor} tabBarItemTitleFontColorActive={currentTabAppearance?.stacked?.selected?.tabBarItemTitleFontColor ?? props?.tintColor}
@@ -67,7 +72,7 @@ function NativeTabsView(props) {
67
72
  tabBarItemActiveIndicatorColor={options[inBoundsDeferredFocusedIndex]?.indicatorColor} tabBarItemActiveIndicatorEnabled={!disableIndicator}
68
73
  // #endregion
69
74
  // #region iOS props
70
- tabBarTintColor={props?.tintColor} tabBarMinimizeBehavior={minimizeBehavior}
75
+ tabBarTintColor={props?.tintColor} tabBarMinimizeBehavior={minimizeBehavior} tabBarControllerMode={tabBarControllerMode}
71
76
  // #endregion
72
77
  onNativeFocusChange={({ nativeEvent: { tabKey } }) => {
73
78
  props.onTabChange(tabKey);
@@ -81,7 +86,7 @@ function Screen(props) {
81
86
  // We need to await the icon, as VectorIcon will load asynchronously
82
87
  const icon = (0, icon_1.useAwaitedScreensIcon)(options.icon);
83
88
  const selectedIcon = (0, icon_1.useAwaitedScreensIcon)(options.selectedIcon);
84
- return (<react_native_screens_1.BottomTabsScreen {...options} tabBarItemBadgeBackgroundColor={standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor} tabBarItemBadgeTextColor={badgeTextColor} standardAppearance={standardAppearance} scrollEdgeAppearance={scrollEdgeAppearance} iconResourceName={(0, icon_1.getRNScreensAndroidIconResourceNameFromAwaitedIcon)(icon)} iconResource={(0, icon_1.getRNScreensAndroidIconResourceFromAwaitedIcon)(icon)} icon={(0, icon_1.convertOptionsIconToRNScreensPropsIcon)(icon)} selectedIcon={(0, icon_1.convertOptionsIconToRNScreensPropsIcon)(selectedIcon)} title={title} freezeContents={false} tabKey={routeKey} systemItem={options.role} isFocused={isFocused}>
89
+ return (<react_native_screens_1.BottomTabsScreen {...options} tabBarItemBadgeBackgroundColor={standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor} tabBarItemBadgeTextColor={badgeTextColor} standardAppearance={standardAppearance} scrollEdgeAppearance={scrollEdgeAppearance} icon={(0, icon_1.convertOptionsIconToRNScreensPropsIcon)(icon)} selectedIcon={(0, icon_1.convertOptionsIconToIOSPropsIcon)(selectedIcon)} title={title} freezeContents={false} systemItem={options.role} {...options.nativeProps} tabKey={routeKey} isFocused={isFocused}>
85
90
  {contentRenderer()}
86
91
  </react_native_screens_1.BottomTabsScreen>);
87
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,wCAuEC;AAtGD,+CAAgD;AAEhD,+DAM8B;AAE9B,6CAGsB;AACtB,mCAKiB;AACjB,uCAKsB;AAEtB,8FAA8F;AAC9F,+DAA+D;AAC/D,mCAAY,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC;AAErD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,oBAAoB,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;IAC5D,8DAA8D;IAC9D,oFAAoF;IACpF,wFAAwF;IACxF,2BAA2B;IAC3B,MAAM,4BAA4B,GAChC,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,CAAC;IAE3E,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACrC,kBAAkB,EAAE,IAAA,gDAAmC,EAAC,GAAG,CAAC,OAAO,CAAC;QACpE,oBAAoB,EAAE,IAAA,kDAAqC,EAAC,GAAG,CAAC,OAAO,CAAC;KACzE,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,C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AG,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 } from 'react';\nimport type { ColorValue } from 'react-native';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenAppearance,\n} from 'react-native-screens';\n\nimport {\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\nimport {\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport {\n convertOptionsIconToRNScreensPropsIcon,\n getRNScreensAndroidIconResourceFromAwaitedIcon,\n getRNScreensAndroidIconResourceNameFromAwaitedIcon,\n useAwaitedScreensIcon,\n} from './utils/icon';\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 { minimizeBehavior, disableIndicator, focusedIndex, tabs } = props;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n // We need to check if the deferred index is not out of bounds\n // This can happen when the focused index is the last tab, and user removes that tab\n // In that case the deferred index will still point to the last tab, but after re-render\n // it will be out of bounds\n const inBoundsDeferredFocusedIndex =\n deferredFocusedIndex < tabs.length ? deferredFocusedIndex : focusedIndex;\n\n const appearances = tabs.map((tab) => ({\n standardAppearance: createStandardAppearanceFromOptions(tab.options),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(tab.options),\n }));\n\n const options = tabs.map((tab) => tab.options);\n\n const children = tabs.map((tab, index) => {\n const isFocused = index === inBoundsDeferredFocusedIndex;\n\n return (\n <Screen\n key={tab.routeKey}\n routeKey={tab.routeKey}\n name={tab.name}\n options={tab.options}\n isFocused={isFocused}\n standardAppearance={appearances[index].standardAppearance}\n scrollEdgeAppearance={appearances[index].scrollEdgeAppearance}\n badgeTextColor={tab.options.badgeTextColor}\n contentRenderer={tab.contentRenderer}\n />\n );\n });\n\n const currentTabAppearance = appearances[inBoundsDeferredFocusedIndex]?.standardAppearance;\n\n return (\n <BottomTabsWrapper\n // #region android props\n tabBarItemTitleFontColor={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontColor}\n tabBarItemTitleFontFamily={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontFamily}\n tabBarItemTitleFontSize={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontSizeActive={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontWeight={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontWeight}\n tabBarItemTitleFontStyle={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontStyle}\n tabBarItemIconColor={currentTabAppearance?.stacked?.normal?.tabBarItemIconColor}\n tabBarBackgroundColor={currentTabAppearance?.tabBarBackgroundColor}\n tabBarItemRippleColor={props.rippleColor}\n tabBarItemLabelVisibilityMode={props.labelVisibilityMode}\n tabBarItemIconColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemIconColor ?? props?.tintColor\n }\n tabBarItemTitleFontColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemTitleFontColor ?? props?.tintColor\n }\n // tabBarItemTitleFontSizeActive={activeStyle?.fontSize}\n tabBarItemActiveIndicatorColor={options[inBoundsDeferredFocusedIndex]?.indicatorColor}\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n // #endregion\n // #region iOS props\n tabBarTintColor={props?.tintColor}\n tabBarMinimizeBehavior={minimizeBehavior}\n // #endregion\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n props.onTabChange(tabKey);\n }}>\n {children}\n </BottomTabsWrapper>\n );\n}\n\nfunction Screen(props: {\n routeKey: string;\n name: string;\n isFocused: boolean;\n options: NativeTabOptions;\n standardAppearance: BottomTabsScreenAppearance;\n scrollEdgeAppearance: BottomTabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n contentRenderer: () => React.ReactNode;\n}) {\n const {\n routeKey,\n name,\n options,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n contentRenderer,\n } = props;\n const title = options.title ?? name;\n\n // We need to await the icon, as VectorIcon will load asynchronously\n const icon = useAwaitedScreensIcon(options.icon);\n const selectedIcon = useAwaitedScreensIcon(options.selectedIcon);\n\n return (\n <BottomTabsScreen\n {...options}\n tabBarItemBadgeBackgroundColor={\n standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor\n }\n tabBarItemBadgeTextColor={badgeTextColor}\n standardAppearance={standardAppearance}\n scrollEdgeAppearance={scrollEdgeAppearance}\n iconResourceName={getRNScreensAndroidIconResourceNameFromAwaitedIcon(icon)}\n iconResource={getRNScreensAndroidIconResourceFromAwaitedIcon(icon)}\n icon={convertOptionsIconToRNScreensPropsIcon(icon)}\n selectedIcon={convertOptionsIconToRNScreensPropsIcon(selectedIcon)}\n title={title}\n freezeContents={false}\n tabKey={routeKey}\n systemItem={options.role}\n isFocused={isFocused}>\n {contentRenderer()}\n </BottomTabsScreen>\n );\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"]}
1
+ {"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;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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 } from 'react';\nimport type { ColorValue } from 'react-native';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenAppearance,\n} from 'react-native-screens';\n\nimport {\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\nimport {\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport {\n convertOptionsIconToRNScreensPropsIcon,\n convertOptionsIconToIOSPropsIcon,\n useAwaitedScreensIcon,\n} from './utils/icon';\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 { minimizeBehavior, disableIndicator, focusedIndex, tabs, sidebarAdaptable } = props;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n // We need to check if the deferred index is not out of bounds\n // This can happen when the focused index is the last tab, and user removes that tab\n // In that case the deferred index will still point to the last tab, but after re-render\n // it will be out of bounds\n const inBoundsDeferredFocusedIndex =\n deferredFocusedIndex < tabs.length ? deferredFocusedIndex : focusedIndex;\n\n const appearances = tabs.map((tab) => ({\n standardAppearance: createStandardAppearanceFromOptions(tab.options),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(tab.options),\n }));\n\n const options = tabs.map((tab) => tab.options);\n\n const children = tabs.map((tab, index) => {\n const isFocused = index === inBoundsDeferredFocusedIndex;\n\n return (\n <Screen\n key={tab.routeKey}\n routeKey={tab.routeKey}\n name={tab.name}\n options={tab.options}\n isFocused={isFocused}\n standardAppearance={appearances[index].standardAppearance}\n scrollEdgeAppearance={appearances[index].scrollEdgeAppearance}\n badgeTextColor={tab.options.badgeTextColor}\n contentRenderer={tab.contentRenderer}\n />\n );\n });\n\n const currentTabAppearance = appearances[inBoundsDeferredFocusedIndex]?.standardAppearance;\n const tabBarControllerMode: BottomTabsProps['tabBarControllerMode'] = sidebarAdaptable\n ? 'tabSidebar'\n : sidebarAdaptable === false\n ? 'tabBar'\n : 'automatic';\n\n return (\n <BottomTabsWrapper\n // #region android props\n tabBarItemTitleFontColor={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontColor}\n tabBarItemTitleFontFamily={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontFamily}\n tabBarItemTitleFontSize={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontSizeActive={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontWeight={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontWeight}\n tabBarItemTitleFontStyle={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontStyle}\n tabBarItemIconColor={currentTabAppearance?.stacked?.normal?.tabBarItemIconColor}\n tabBarBackgroundColor={currentTabAppearance?.tabBarBackgroundColor}\n tabBarItemRippleColor={props.rippleColor}\n tabBarItemLabelVisibilityMode={props.labelVisibilityMode}\n tabBarItemIconColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemIconColor ?? props?.tintColor\n }\n tabBarItemTitleFontColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemTitleFontColor ?? props?.tintColor\n }\n // tabBarItemTitleFontSizeActive={activeStyle?.fontSize}\n tabBarItemActiveIndicatorColor={options[inBoundsDeferredFocusedIndex]?.indicatorColor}\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n // #endregion\n // #region iOS props\n tabBarTintColor={props?.tintColor}\n tabBarMinimizeBehavior={minimizeBehavior}\n tabBarControllerMode={tabBarControllerMode}\n // #endregion\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n props.onTabChange(tabKey);\n }}>\n {children}\n </BottomTabsWrapper>\n );\n}\n\nfunction Screen(props: {\n routeKey: string;\n name: string;\n isFocused: boolean;\n options: NativeTabOptions;\n standardAppearance: BottomTabsScreenAppearance;\n scrollEdgeAppearance: BottomTabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n contentRenderer: () => React.ReactNode;\n}) {\n const {\n routeKey,\n name,\n options,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n contentRenderer,\n } = props;\n const title = options.title ?? name;\n\n // We need to await the icon, as VectorIcon will load asynchronously\n const icon = useAwaitedScreensIcon(options.icon);\n const selectedIcon = useAwaitedScreensIcon(options.selectedIcon);\n\n return (\n <BottomTabsScreen\n {...options}\n tabBarItemBadgeBackgroundColor={\n standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor\n }\n tabBarItemBadgeTextColor={badgeTextColor}\n standardAppearance={standardAppearance}\n scrollEdgeAppearance={scrollEdgeAppearance}\n icon={convertOptionsIconToRNScreensPropsIcon(icon)}\n selectedIcon={convertOptionsIconToIOSPropsIcon(selectedIcon)}\n title={title}\n freezeContents={false}\n systemItem={options.role}\n {...options.nativeProps}\n tabKey={routeKey}\n isFocused={isFocused}>\n {contentRenderer()}\n </BottomTabsScreen>\n );\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"]}