expo-router 6.0.10 → 6.1.0-canary-20251003-7b9d7ff

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 (63) hide show
  1. package/build/Route.d.ts +5 -2
  2. package/build/Route.d.ts.map +1 -1
  3. package/build/Route.js.map +1 -1
  4. package/build/exports.d.ts +1 -1
  5. package/build/exports.d.ts.map +1 -1
  6. package/build/exports.js +2 -1
  7. package/build/exports.js.map +1 -1
  8. package/build/getRoutesCore.d.ts.map +1 -1
  9. package/build/getRoutesCore.js +5 -0
  10. package/build/getRoutesCore.js.map +1 -1
  11. package/build/getServerManifest.d.ts.map +1 -1
  12. package/build/getServerManifest.js +5 -2
  13. package/build/getServerManifest.js.map +1 -1
  14. package/build/hooks.d.ts +22 -1
  15. package/build/hooks.d.ts.map +1 -1
  16. package/build/hooks.js +102 -4
  17. package/build/hooks.js.map +1 -1
  18. package/build/link/useLinkHooks.d.ts +1 -1
  19. package/build/loaders/ServerDataLoaderContext.d.ts +9 -0
  20. package/build/loaders/ServerDataLoaderContext.d.ts.map +1 -0
  21. package/build/loaders/ServerDataLoaderContext.js +13 -0
  22. package/build/loaders/ServerDataLoaderContext.js.map +1 -0
  23. package/build/loaders/utils.d.ts +9 -0
  24. package/build/loaders/utils.d.ts.map +1 -0
  25. package/build/loaders/utils.js +29 -0
  26. package/build/loaders/utils.js.map +1 -0
  27. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
  28. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +5 -0
  29. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
  30. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +1 -5
  31. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
  32. package/build/native-tabs/NativeBottomTabs/types.d.ts +5 -3
  33. package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
  34. package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
  35. package/build/native-tabs/common/elements.d.ts +59 -1
  36. package/build/native-tabs/common/elements.d.ts.map +1 -1
  37. package/build/native-tabs/common/elements.js.map +1 -1
  38. package/build/static/html.d.ts +7 -0
  39. package/build/static/html.d.ts.map +1 -1
  40. package/build/static/html.js +14 -0
  41. package/build/static/html.js.map +1 -1
  42. package/build/static/renderStaticContent.d.ts +6 -1
  43. package/build/static/renderStaticContent.d.ts.map +1 -1
  44. package/build/static/renderStaticContent.js +11 -2
  45. package/build/static/renderStaticContent.js.map +1 -1
  46. package/build/testing-library/context-stubs.d.ts +3 -1
  47. package/build/testing-library/context-stubs.d.ts.map +1 -1
  48. package/build/testing-library/context-stubs.js.map +1 -1
  49. package/build/ts-declarations/expo-router-internal-globals.d.ts +4 -0
  50. package/build/ts-declarations/expo-router-internal-globals.d.ts.map +1 -1
  51. package/build/ts-declarations/expo-router-internal-globals.js.map +1 -1
  52. package/build/types.d.ts +8 -0
  53. package/build/types.d.ts.map +1 -1
  54. package/build/types.js.map +1 -1
  55. package/build/utils/html.d.ts +12 -0
  56. package/build/utils/html.d.ts.map +1 -0
  57. package/build/utils/html.js +29 -0
  58. package/build/utils/html.js.map +1 -0
  59. package/package.json +9 -10
  60. package/plugin/build/index.d.ts +2 -0
  61. package/plugin/options.json +5 -0
  62. package/plugin/src/index.ts +2 -0
  63. package/plugin/tsconfig.tsbuildinfo +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":";;;AAkMa,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,eAAe;IACf,YAAY;IACZ,OAAO;IACP,MAAM;IACN,SAAS;IACT,WAAW;IACX,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,8BAA8B;IAC9B,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;CAClB,CAAC;AAuKE,QAAA,6CAA6C,GAAG;IAC3D,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;CACH,CAAC;AAUE,QAAA,oCAAoC,GAAG;IAClD,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC;AA+DX,MAAM,4BAA4B,GAAG;IACnC,WAAW;IACX,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,SAAS;IACT,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,UAAU;CACF,CAAC","sourcesContent":["import type {\n DefaultRouterOptions,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport type { PropsWithChildren } from 'react';\nimport type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';\nimport type { BottomTabsScreenProps } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nexport interface NativeTabOptions extends DefaultRouterOptions {\n /**\n * The icon to display in the tab bar.\n * @platform android\n * @platform iOS\n */\n icon?: SymbolOrImageSource;\n /**\n * The icon to display when the tab is selected.\n * @platform iOS\n */\n selectedIcon?: SymbolOrImageSource;\n /**\n * Title of the tab screen, displayed in the tab bar item.\n *\n * @platform android\n * @platform iOS\n */\n title?: string;\n /**\n * Specifies content of tab bar item badge.\n *\n * On Android, the value is interpreted in the following order:\n * - If the string can be parsed to integer, displays the value as a number\n * - Otherwise if the string is empty, displays \"small dot\" badge\n * - Otherwise, displays the value as a text\n *\n * On iOS, badge is displayed as regular string.\n *\n * @platform android\n * @platform ios\n */\n badgeValue?: string;\n /**\n * The style of the tab label when the tab is selected.\n */\n selectedLabelStyle?: NativeTabsLabelStyle;\n /**\n * The style of all the tab labels, when the tab is selected\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. Custom `icon` or `selectedIcon`\n * properties will override the system icon, but the system-defined title cannot\n * be customized.\n *\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem|UITabBarItem.SystemItem}\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n /**\n * The color of the icon when the tab is selected.\n */\n selectedIconColor?: ColorValue;\n /**\n * The color of the badge when the tab is selected.\n */\n selectedBadgeBackgroundColor?: ColorValue;\n /**\n * The color of all the badges when the tab is selected.\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * The color of the background when the tab is selected.\n */\n backgroundColor?: ColorValue;\n /**\n * The blur effect to apply when the tab is selected.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow when the tab is selected.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * The color of the icon when the tab is selected.\n *\n * On iOS 26+ you can change the icon color in the scroll edge state.\n */\n iconColor?: ColorValue;\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The position adjustment for all the labels when the tab is selected.\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * The position adjustment for the label when the tab is selected.\n *\n * @platform iOS\n */\n selectedTitlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport type SymbolOrImageSource =\n | {\n /**\n * The name of the SF Symbol to use as an icon.\n * @platform iOS\n */\n sf?: SFSymbol;\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n }\n | {\n /**\n * The image source to use as an icon.\n */\n src?: ImageSourcePropType | Promise<ImageSourcePropType | null>;\n };\n\nexport interface ExtendedNativeTabOptions extends NativeTabOptions {\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n specialEffects?: BottomTabsScreenProps['specialEffects'];\n}\n\ntype NumericFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n\nexport interface NativeTabsLabelStyle {\n /**\n * The font family of the tab label.\n */\n fontFamily?: TextStyle['fontFamily'];\n /**\n * The font size of the tab label.\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * The font weight of the tab label.\n */\n fontWeight?: NumericFontWeight | `${NumericFontWeight}`;\n /**\n * The font style of the tab label.\n */\n fontStyle?: TextStyle['fontStyle'];\n /**\n * The color of the tab label.\n */\n color?: TextStyle['color'];\n}\n\nexport const SUPPORTED_BLUR_EFFECTS = [\n 'none',\n 'systemDefault',\n 'extraLight',\n 'light',\n 'dark',\n 'regular',\n 'prominent',\n 'systemUltraThinMaterial',\n 'systemThinMaterial',\n 'systemMaterial',\n 'systemThickMaterial',\n 'systemChromeMaterial',\n 'systemUltraThinMaterialLight',\n 'systemThinMaterialLight',\n 'systemMaterialLight',\n 'systemThickMaterialLight',\n 'systemChromeMaterialLight',\n 'systemUltraThinMaterialDark',\n 'systemThinMaterialDark',\n 'systemMaterialDark',\n 'systemThickMaterialDark',\n 'systemChromeMaterialDark',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiblureffect/style)\n */\nexport type NativeTabsBlurEffect = (typeof SUPPORTED_BLUR_EFFECTS)[number];\n\n/**\n * @platform android\n * @platform web\n */\nexport interface NativeTabsActiveStyleType {\n /**\n * @platform android\n * @platform web\n */\n color?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * @platform android\n */\n iconColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport interface NativeTabsProps extends PropsWithChildren {\n // #region common props\n /**\n * The style of the every tab label in the tab bar.\n */\n labelStyle?: NativeTabsLabelStyle;\n // disabledLabelStyle?: NativeTabsLabelStyle;\n /**\n * The color of every tab icon in the tab bar.\n */\n iconColor?: ColorValue;\n /**\n * The tint color of the tab icon.\n *\n * Can be overridden by icon color and label color for each tab individually.\n */\n tintColor?: ColorValue;\n /**\n * The background color of the tab bar.\n */\n backgroundColor?: ColorValue | null;\n /**\n * The background color of every badge in the tab bar.\n */\n badgeBackgroundColor?: ColorValue;\n // #endregion common props\n // #region iOS props\n /**\n * Specifies the minimize behavior for the tab bar.\n *\n * Available starting from iOS 26.\n *\n * The following values are currently supported:\n *\n * - `automatic` - resolves to the system default minimize behavior\n * - `never` - the tab bar does not minimize\n * - `onScrollDown` - the tab bar minimizes when scrolling down and\n * expands when scrolling back up\n * - `onScrollUp` - the tab bar minimizes when scrolling up and expands\n * when scrolling back down\n *\n * @see The supported values correspond to the official [UIKit documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior).\n *\n * @default automatic\n *\n * @platform iOS 26+\n */\n minimizeBehavior?: NativeTabsTabBarMinimizeBehavior;\n /**\n * The blur effect applied to the tab bar.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/titlepositionadjustment)\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n // #endregion iOS props\n // #region android props\n /**\n * Disables the active indicator for the tab bar.\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n /**\n * The visibility mode of the tab item label.\n *\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * The color of the ripple effect when the tab is pressed.\n *\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n // #endregion android props\n}\nexport interface NativeTabsViewProps extends NativeTabsProps {\n focusedIndex: number;\n builder: ReturnType<\n typeof useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n NativeTabOptions,\n Record<string, any>\n >\n >;\n}\n\nexport const SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = [\n 'auto',\n 'selected',\n 'labeled',\n 'unlabeled',\n] as const;\n\n/**\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\nexport type NativeTabsTabBarItemLabelVisibilityMode =\n (typeof SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES)[number];\n\nexport const SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior)\n *\n * @platform iOS 26\n */\nexport type NativeTabsTabBarMinimizeBehavior =\n (typeof SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS)[number];\n\nexport interface NativeTabTriggerProps {\n /**\n * The name of the route.\n *\n * This is required when used inside a Layout component.\n *\n * When used in a route it has no effect.\n */\n name?: string;\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n /**\n * The options for the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components as children to customize the tab, rather then raw options.\n */\n options?: NativeTabOptions;\n /**\n * If true, the tab will not pop stack to the root when selected again.\n *\n * @default false\n * @platform iOS\n */\n disablePopToTop?: boolean;\n /**\n * If true, the tab will not scroll to the top when selected again.\n * @default false\n *\n * @platform iOS\n */\n disableScrollToTop?: boolean;\n /**\n * The children of the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components to customize the tab.\n */\n children?: React.ReactNode;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. Custom `icon` or `selectedIcon`\n * properties will override the system icon, but the system-defined title cannot\n * be customized.\n *\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem|UITabBarItem.SystemItem}\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n}\n\nconst SUPPORTED_TAB_BAR_ITEM_ROLES = [\n 'bookmarks',\n 'contacts',\n 'downloads',\n 'favorites',\n 'featured',\n 'history',\n 'more',\n 'mostRecent',\n 'mostViewed',\n 'recents',\n 'search',\n 'topRated',\n] as const;\n\nexport type NativeTabsTabBarItemRole = (typeof SUPPORTED_TAB_BAR_ITEM_ROLES)[number];\n\nexport interface NativeTabsTriggerTabBarProps {\n /**\n * The style of the every tab label in the tab bar.\n *\n * @platform iOS\n * @platform web\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * The background color of the tab bar, when the tab is selected\n */\n backgroundColor?: ColorValue;\n /**\n * The color of every tab icon, when the tab is selected\n *\n * @platform iOS\n */\n iconColor?: ColorValue;\n /**\n * The background color of every badge in the tab bar.\n *\n * @platform iOS\n * @platform web\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * The blur effect applied to the tab bar, when the tab is selected\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow when the tab is selected.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The color of the badge text.\n *\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":";;;AAkMa,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,eAAe;IACf,YAAY;IACZ,OAAO;IACP,MAAM;IACN,SAAS;IACT,WAAW;IACX,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,8BAA8B;IAC9B,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;CAClB,CAAC;AAuKE,QAAA,6CAA6C,GAAG;IAC3D,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;CACH,CAAC;AAUE,QAAA,oCAAoC,GAAG;IAClD,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC;AAiEX,MAAM,4BAA4B,GAAG;IACnC,WAAW;IACX,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,SAAS;IACT,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,UAAU;CACF,CAAC","sourcesContent":["import type {\n DefaultRouterOptions,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport type { PropsWithChildren } from 'react';\nimport type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';\nimport type { BottomTabsScreenProps } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nexport interface NativeTabOptions extends DefaultRouterOptions {\n /**\n * The icon to display in the tab bar.\n * @platform android\n * @platform iOS\n */\n icon?: SymbolOrImageSource;\n /**\n * The icon to display when the tab is selected.\n * @platform iOS\n */\n selectedIcon?: SymbolOrImageSource;\n /**\n * Title of the tab screen, displayed in the tab bar item.\n *\n * @platform android\n * @platform iOS\n */\n title?: string;\n /**\n * Specifies content of tab bar item badge.\n *\n * On Android, the value is interpreted in the following order:\n * - If the string can be parsed to integer, displays the value as a number\n * - Otherwise if the string is empty, displays \"small dot\" badge\n * - Otherwise, displays the value as a text\n *\n * On iOS, badge is displayed as regular string.\n *\n * @platform android\n * @platform ios\n */\n badgeValue?: string;\n /**\n * The style of the tab label when the tab is selected.\n */\n selectedLabelStyle?: NativeTabsLabelStyle;\n /**\n * The style of all the tab labels, when the tab is selected\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. If you override the `title`,\n * `icon`, or `selectedIcon`, note that this is not officially supported\n * by Apple and may lead to unexpected results.\n *\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem|UITabBarItem.SystemItem}\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n /**\n * The color of the icon when the tab is selected.\n */\n selectedIconColor?: ColorValue;\n /**\n * The color of the badge when the tab is selected.\n */\n selectedBadgeBackgroundColor?: ColorValue;\n /**\n * The color of all the badges when the tab is selected.\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * The color of the background when the tab is selected.\n */\n backgroundColor?: ColorValue;\n /**\n * The blur effect to apply when the tab is selected.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow when the tab is selected.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * The color of the icon when the tab is selected.\n *\n * On iOS 26+ you can change the icon color in the scroll edge state.\n */\n iconColor?: ColorValue;\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The position adjustment for all the labels when the tab is selected.\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * The position adjustment for the label when the tab is selected.\n *\n * @platform iOS\n */\n selectedTitlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport type SymbolOrImageSource =\n | {\n /**\n * The name of the SF Symbol to use as an icon.\n * @platform iOS\n */\n sf?: SFSymbol;\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n }\n | {\n /**\n * The image source to use as an icon.\n */\n src?: ImageSourcePropType | Promise<ImageSourcePropType | null>;\n };\n\nexport interface ExtendedNativeTabOptions extends NativeTabOptions {\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n specialEffects?: BottomTabsScreenProps['specialEffects'];\n}\n\ntype NumericFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n\nexport interface NativeTabsLabelStyle {\n /**\n * The font family of the tab label.\n */\n fontFamily?: TextStyle['fontFamily'];\n /**\n * The font size of the tab label.\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * The font weight of the tab label.\n */\n fontWeight?: NumericFontWeight | `${NumericFontWeight}`;\n /**\n * The font style of the tab label.\n */\n fontStyle?: TextStyle['fontStyle'];\n /**\n * The color of the tab label.\n */\n color?: TextStyle['color'];\n}\n\nexport const SUPPORTED_BLUR_EFFECTS = [\n 'none',\n 'systemDefault',\n 'extraLight',\n 'light',\n 'dark',\n 'regular',\n 'prominent',\n 'systemUltraThinMaterial',\n 'systemThinMaterial',\n 'systemMaterial',\n 'systemThickMaterial',\n 'systemChromeMaterial',\n 'systemUltraThinMaterialLight',\n 'systemThinMaterialLight',\n 'systemMaterialLight',\n 'systemThickMaterialLight',\n 'systemChromeMaterialLight',\n 'systemUltraThinMaterialDark',\n 'systemThinMaterialDark',\n 'systemMaterialDark',\n 'systemThickMaterialDark',\n 'systemChromeMaterialDark',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiblureffect/style)\n */\nexport type NativeTabsBlurEffect = (typeof SUPPORTED_BLUR_EFFECTS)[number];\n\n/**\n * @platform android\n * @platform web\n */\nexport interface NativeTabsActiveStyleType {\n /**\n * @platform android\n * @platform web\n */\n color?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * @platform android\n */\n iconColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport interface NativeTabsProps extends PropsWithChildren {\n // #region common props\n /**\n * The style of the every tab label in the tab bar.\n */\n labelStyle?: NativeTabsLabelStyle;\n // disabledLabelStyle?: NativeTabsLabelStyle;\n /**\n * The color of every tab icon in the tab bar.\n */\n iconColor?: ColorValue;\n /**\n * The tint color of the tab icon.\n *\n * Can be overridden by icon color and label color for each tab individually.\n */\n tintColor?: ColorValue;\n /**\n * The background color of the tab bar.\n */\n backgroundColor?: ColorValue | null;\n /**\n * The background color of every badge in the tab bar.\n */\n badgeBackgroundColor?: ColorValue;\n // #endregion common props\n // #region iOS props\n /**\n * Specifies the minimize behavior for the tab bar.\n *\n * Available starting from iOS 26.\n *\n * The following values are currently supported:\n *\n * - `automatic` - resolves to the system default minimize behavior\n * - `never` - the tab bar does not minimize\n * - `onScrollDown` - the tab bar minimizes when scrolling down and\n * expands when scrolling back up\n * - `onScrollUp` - the tab bar minimizes when scrolling up and expands\n * when scrolling back down\n *\n * @see The supported values correspond to the official [UIKit documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior).\n *\n * @default automatic\n *\n * @platform iOS 26+\n */\n minimizeBehavior?: NativeTabsTabBarMinimizeBehavior;\n /**\n * The blur effect applied to the tab bar.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/titlepositionadjustment)\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n // #endregion iOS props\n // #region android props\n /**\n * Disables the active indicator for the tab bar.\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n /**\n * The visibility mode of the tab item label.\n *\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * The color of the ripple effect when the tab is pressed.\n *\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n // #endregion android props\n}\nexport interface NativeTabsViewProps extends NativeTabsProps {\n focusedIndex: number;\n builder: ReturnType<\n typeof useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n NativeTabOptions,\n Record<string, any>\n >\n >;\n}\n\nexport const SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = [\n 'auto',\n 'selected',\n 'labeled',\n 'unlabeled',\n] as const;\n\n/**\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\nexport type NativeTabsTabBarItemLabelVisibilityMode =\n (typeof SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES)[number];\n\nexport const SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior)\n *\n * @platform iOS 26\n */\nexport type NativeTabsTabBarMinimizeBehavior =\n (typeof SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS)[number];\n\nexport interface NativeTabTriggerProps {\n /**\n * The name of the route.\n *\n * This is required when used inside a Layout component.\n *\n * When used in a route it has no effect.\n */\n name?: string;\n /**\n * If true, the tab will be hidden from the tab bar.\n *\n * > **Note**: Marking a tab as `hidden` means it cannot be navigated to in any way.\n */\n hidden?: boolean;\n /**\n * The options for the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components as children to customize the tab, rather then raw options.\n */\n options?: NativeTabOptions;\n /**\n * If true, the tab will not pop stack to the root when selected again.\n *\n * @default false\n * @platform iOS\n */\n disablePopToTop?: boolean;\n /**\n * If true, the tab will not scroll to the top when selected again.\n * @default false\n *\n * @platform iOS\n */\n disableScrollToTop?: boolean;\n /**\n * The children of the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components to customize the tab.\n */\n children?: React.ReactNode;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. Custom `icon` or `selectedIcon`\n * properties will override the system icon, but the system-defined title cannot\n * be customized.\n *\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem|UITabBarItem.SystemItem}\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n}\n\nconst SUPPORTED_TAB_BAR_ITEM_ROLES = [\n 'bookmarks',\n 'contacts',\n 'downloads',\n 'favorites',\n 'featured',\n 'history',\n 'more',\n 'mostRecent',\n 'mostViewed',\n 'recents',\n 'search',\n 'topRated',\n] as const;\n\nexport type NativeTabsTabBarItemRole = (typeof SUPPORTED_TAB_BAR_ITEM_ROLES)[number];\n\nexport interface NativeTabsTriggerTabBarProps {\n /**\n * The style of the every tab label in the tab bar.\n *\n * @platform iOS\n * @platform web\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * The background color of the tab bar, when the tab is selected\n */\n backgroundColor?: ColorValue;\n /**\n * The color of every tab icon, when the tab is selected\n *\n * @platform iOS\n */\n iconColor?: ColorValue;\n /**\n * The background color of every badge in the tab bar.\n *\n * @platform iOS\n * @platform web\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * The blur effect applied to the tab bar, when the tab is selected\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow when the tab is selected.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The color of the badge text.\n *\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n"]}
@@ -41,6 +41,7 @@ export interface SourceIconCombination {
41
41
  };
42
42
  drawable?: never;
43
43
  sf?: never;
44
+ androidSrc?: never;
44
45
  }
45
46
  export interface NamedIconCombination {
46
47
  /**
@@ -72,10 +73,67 @@ export interface NamedIconCombination {
72
73
  */
73
74
  drawable?: string;
74
75
  src?: never;
76
+ androidSrc?: never;
77
+ }
78
+ export interface CrossPlatformIconCombination {
79
+ /**
80
+ * The name of the SF Symbol to use as an icon on iOS.
81
+ *
82
+ * The value can be provided in two ways:
83
+ * - As a string with the SF Symbol name
84
+ * - As an object specifying the default and selected states
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * <Icon sf="magnifyingglass" androidSrc={require('./search.png')} />
89
+ * ```
90
+ *
91
+ * @example
92
+ * ```tsx
93
+ * <Icon
94
+ * sf={{ default: "house", selected: "house.fill" }}
95
+ * androidSrc={{ default: require('./home.png'), selected: require('./home-filled.png') }}
96
+ * />
97
+ * ```
98
+ *
99
+ * @platform iOS
100
+ */
101
+ sf?: SFSymbol | {
102
+ default?: SFSymbol;
103
+ selected: SFSymbol;
104
+ };
105
+ /**
106
+ * The image source to use as an icon on Android.
107
+ *
108
+ * The value can be provided in two ways:
109
+ * - As an image source
110
+ * - As an object specifying the default and selected states
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * <Icon sf="magnifyingglass" androidSrc={require('./search.png')} />
115
+ * ```
116
+ *
117
+ * @example
118
+ * ```tsx
119
+ * <Icon
120
+ * sf={{ default: "house", selected: "house.fill" }}
121
+ * androidSrc={{ default: require('./icon.png'), selected: require('./icon-selected.png') }}
122
+ * />
123
+ * ```
124
+ *
125
+ * @platform Android
126
+ */
127
+ androidSrc?: ImageSourcePropType | React.ReactElement | {
128
+ default?: ImageSourcePropType | React.ReactElement;
129
+ selected: ImageSourcePropType | React.ReactElement;
130
+ };
131
+ src?: never;
132
+ drawable?: never;
75
133
  }
76
134
  export type IconProps = {
77
135
  selectedColor?: ColorValue;
78
- } & (NamedIconCombination | SourceIconCombination);
136
+ } & (NamedIconCombination | SourceIconCombination | CrossPlatformIconCombination);
79
137
  /**
80
138
  * Renders an icon for the tab.
81
139
  *
@@ -1 +1 @@
1
- {"version":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AAI,CAAC,KAAK,EAAE,SAAS,QAEpC;AAED,MAAM,WAAW,eAAe,CAAC,KAAK,SAAS,MAAM;IACnD;;;;;;;OAOG;IACH,MAAM,EAAE;QACN,cAAc,EAAE,CACd,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,KACd,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;KAC1C,CAAC;IACF;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,QAE7E;AAED,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uBAAuB,CAAC,EAAE,UAAU,CAAC;CACtC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,QAEtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;AAkBA,sBAEC;AA0ED,oBAEC;AA2CD,gCAEC;AAiBD,sBAEC;AA9ID,SAAgB,KAAK,CAAC,KAAiB;IACrC,OAAO,IAAI,CAAC;AACd,CAAC;AAoED;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAwBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,UAAU,CAAuB,KAA6B;IAC5E,OAAO,IAAI,CAAC;AACd,CAAC;AAiBD,SAAgB,KAAK,CAAC,KAAiB;IACrC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ColorValue, ImageSourcePropType } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type { NativeTabsLabelStyle } from '../NativeBottomTabs/types';\n\nexport interface LabelProps {\n /**\n * The text to display as the label for the tab.\n */\n children?: string;\n selectedStyle?: NativeTabsLabelStyle;\n /**\n * If true, the label will be hidden.\n * @default false\n */\n hidden?: boolean;\n}\n\nexport function Label(props: LabelProps) {\n return null;\n}\n\nexport interface SourceIconCombination {\n /**\n * The image source to use as an icon.\n *\n * The value can be provided in two ways:\n * - As an image source\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon src={require('./path/to/icon.png')} />\n * ```\n *\n * @example\n * ```tsx\n * <Icon src={{ default: require('./path/to/icon.png'), selected: require('./path/to/icon-selected.png') }} />\n * ```\n *\n * @platform Android\n * @platform iOS\n */\n src?:\n | ImageSourcePropType\n | React.ReactElement\n | {\n default?: ImageSourcePropType | React.ReactElement;\n selected: ImageSourcePropType | React.ReactElement;\n };\n drawable?: never;\n sf?: never;\n}\n\nexport interface NamedIconCombination {\n /**\n * The name of the SF Symbol to use as an icon.\n *\n * The value can be provided in two ways:\n * - As a string with the SF Symbol name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon sf=\"magnifyingglass\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon sf={{ default: \"house\", selected: \"house.fill\" }} />\n * ```\n *\n * @platform iOS\n */\n sf?: SFSymbol | { default?: SFSymbol; selected: SFSymbol };\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n src?: never;\n}\n\nexport type IconProps = { selectedColor?: ColorValue } & (\n | NamedIconCombination\n | SourceIconCombination\n);\n\n/**\n * Renders an icon for the tab.\n *\n * @platform ios\n * @platform android\n */\nexport function Icon(props: IconProps) {\n return null;\n}\n\nexport interface VectorIconProps<NameT extends string> {\n /**\n * The family of the vector icon.\n *\n * @example\n * ```tsx\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n * ```\n */\n family: {\n getImageSource: (\n name: NameT,\n size: number,\n color: ColorValue\n ) => Promise<ImageSourcePropType | null>;\n };\n /**\n * The name of the vector icon.\n */\n name: NameT;\n}\n\n/**\n * Helper component which can be used to load vector icons for `NativeTabs`.\n *\n * @example\n * ```tsx\n * import { NativeTabs, VectorIcon } from 'expo-router';\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n *\n * export default Layout(){\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"index\">\n * <Icon src={<VectorIcon family={MaterialCommunityIcons} name=\"home\" />} />\n * </NativeTabs.Trigger>\n * </NativeTabs>\n * );\n * }\n * ```\n */\nexport function VectorIcon<NameT extends string>(props: VectorIconProps<NameT>) {\n return null;\n}\n\nexport interface BadgeProps {\n /**\n * The text to display as the badge for the tab.\n * If not provided, the badge will not be displayed.\n */\n children?: string;\n\n /**\n * If true, the badge will be hidden.\n * @default false\n */\n hidden?: boolean;\n selectedBackgroundColor?: ColorValue;\n}\n\nexport function Badge(props: BadgeProps) {\n return null;\n}\n"]}
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;AAkBA,sBAEC;AAsID,oBAEC;AA2CD,gCAEC;AAiBD,sBAEC;AA1MD,SAAgB,KAAK,CAAC,KAAiB;IACrC,OAAO,IAAI,CAAC;AACd,CAAC;AAgID;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAwBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,UAAU,CAAuB,KAA6B;IAC5E,OAAO,IAAI,CAAC;AACd,CAAC;AAiBD,SAAgB,KAAK,CAAC,KAAiB;IACrC,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ColorValue, ImageSourcePropType } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type { NativeTabsLabelStyle } from '../NativeBottomTabs/types';\n\nexport interface LabelProps {\n /**\n * The text to display as the label for the tab.\n */\n children?: string;\n selectedStyle?: NativeTabsLabelStyle;\n /**\n * If true, the label will be hidden.\n * @default false\n */\n hidden?: boolean;\n}\n\nexport function Label(props: LabelProps) {\n return null;\n}\n\nexport interface SourceIconCombination {\n /**\n * The image source to use as an icon.\n *\n * The value can be provided in two ways:\n * - As an image source\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon src={require('./path/to/icon.png')} />\n * ```\n *\n * @example\n * ```tsx\n * <Icon src={{ default: require('./path/to/icon.png'), selected: require('./path/to/icon-selected.png') }} />\n * ```\n *\n * @platform Android\n * @platform iOS\n */\n src?:\n | ImageSourcePropType\n | React.ReactElement\n | {\n default?: ImageSourcePropType | React.ReactElement;\n selected: ImageSourcePropType | React.ReactElement;\n };\n drawable?: never;\n sf?: never;\n androidSrc?: never;\n}\n\nexport interface NamedIconCombination {\n /**\n * The name of the SF Symbol to use as an icon.\n *\n * The value can be provided in two ways:\n * - As a string with the SF Symbol name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon sf=\"magnifyingglass\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon sf={{ default: \"house\", selected: \"house.fill\" }} />\n * ```\n *\n * @platform iOS\n */\n sf?: SFSymbol | { default?: SFSymbol; selected: SFSymbol };\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n src?: never;\n androidSrc?: never;\n}\n\nexport interface CrossPlatformIconCombination {\n /**\n * The name of the SF Symbol to use as an icon on iOS.\n *\n * The value can be provided in two ways:\n * - As a string with the SF Symbol name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon sf=\"magnifyingglass\" androidSrc={require('./search.png')} />\n * ```\n *\n * @example\n * ```tsx\n * <Icon\n * sf={{ default: \"house\", selected: \"house.fill\" }}\n * androidSrc={{ default: require('./home.png'), selected: require('./home-filled.png') }}\n * />\n * ```\n *\n * @platform iOS\n */\n sf?: SFSymbol | { default?: SFSymbol; selected: SFSymbol };\n /**\n * The image source to use as an icon on Android.\n *\n * The value can be provided in two ways:\n * - As an image source\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon sf=\"magnifyingglass\" androidSrc={require('./search.png')} />\n * ```\n *\n * @example\n * ```tsx\n * <Icon\n * sf={{ default: \"house\", selected: \"house.fill\" }}\n * androidSrc={{ default: require('./icon.png'), selected: require('./icon-selected.png') }}\n * />\n * ```\n *\n * @platform Android\n */\n androidSrc?:\n | ImageSourcePropType\n | React.ReactElement\n | {\n default?: ImageSourcePropType | React.ReactElement;\n selected: ImageSourcePropType | React.ReactElement;\n };\n src?: never;\n drawable?: never;\n}\n\nexport type IconProps = { selectedColor?: ColorValue } & (\n | NamedIconCombination\n | SourceIconCombination\n | CrossPlatformIconCombination\n);\n\n/**\n * Renders an icon for the tab.\n *\n * @platform ios\n * @platform android\n */\nexport function Icon(props: IconProps) {\n return null;\n}\n\nexport interface VectorIconProps<NameT extends string> {\n /**\n * The family of the vector icon.\n *\n * @example\n * ```tsx\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n * ```\n */\n family: {\n getImageSource: (\n name: NameT,\n size: number,\n color: ColorValue\n ) => Promise<ImageSourcePropType | null>;\n };\n /**\n * The name of the vector icon.\n */\n name: NameT;\n}\n\n/**\n * Helper component which can be used to load vector icons for `NativeTabs`.\n *\n * @example\n * ```tsx\n * import { NativeTabs, VectorIcon } from 'expo-router';\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n *\n * export default Layout(){\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"index\">\n * <Icon src={<VectorIcon family={MaterialCommunityIcons} name=\"home\" />} />\n * </NativeTabs.Trigger>\n * </NativeTabs>\n * );\n * }\n * ```\n */\nexport function VectorIcon<NameT extends string>(props: VectorIconProps<NameT>) {\n return null;\n}\n\nexport interface BadgeProps {\n /**\n * The text to display as the badge for the tab.\n * If not provided, the badge will not be displayed.\n */\n children?: string;\n\n /**\n * If true, the badge will be hidden.\n * @default false\n */\n hidden?: boolean;\n selectedBackgroundColor?: ColorValue;\n}\n\nexport function Badge(props: BadgeProps) {\n return null;\n}\n"]}
@@ -9,5 +9,12 @@ import React, { type PropsWithChildren } from 'react';
9
9
  * Root style-reset for full-screen React Native web apps with a root `<ScrollView />` should use the following styles to ensure native parity. [Learn more](https://necolas.github.io/react-native-web/docs/setup/#root-element).
10
10
  */
11
11
  export declare function ScrollViewStyleReset(): React.JSX.Element;
12
+ /**
13
+ * Injects loader data into the HTML as a script tag for client-side hydration.
14
+ * The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.
15
+ */
16
+ export declare function PreloadedDataScript({ data }: {
17
+ data: Record<string, unknown>;
18
+ }): React.JSX.Element;
12
19
  export declare function Html({ children }: PropsWithChildren): React.JSX.Element;
13
20
  //# sourceMappingURL=html.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/static/html.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,wBAAgB,oBAAoB,sBASnC;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,qBAYnD"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/static/html.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAItD;;GAEG;AACH,wBAAgB,oBAAoB,sBASnC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,qBAc9E;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,qBAYnD"}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ScrollViewStyleReset = ScrollViewStyleReset;
7
+ exports.PreloadedDataScript = PreloadedDataScript;
7
8
  exports.Html = Html;
8
9
  /**
9
10
  * Copyright © 2023 650 Industries.
@@ -12,6 +13,7 @@ exports.Html = Html;
12
13
  * LICENSE file in the root directory of this source tree.
13
14
  */
14
15
  const react_1 = __importDefault(require("react"));
16
+ const html_1 = require("../utils/html");
15
17
  /**
16
18
  * Root style-reset for full-screen React Native web apps with a root `<ScrollView />` should use the following styles to ensure native parity. [Learn more](https://necolas.github.io/react-native-web/docs/setup/#root-element).
17
19
  */
@@ -20,6 +22,18 @@ function ScrollViewStyleReset() {
20
22
  __html: `#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}`,
21
23
  }}/>);
22
24
  }
25
+ /**
26
+ * Injects loader data into the HTML as a script tag for client-side hydration.
27
+ * The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.
28
+ */
29
+ function PreloadedDataScript({ data }) {
30
+ const safeJson = (0, html_1.escapeUnsafeCharacters)(JSON.stringify(data));
31
+ return (<script id="expo-router-data" type="module" dangerouslySetInnerHTML={{
32
+ // NOTE(@hassankhan): The double serialization used here isn't as much of a problem server-side, but allows faster
33
+ // client-side parsing using native `JSON.parse()`. See https://v8.dev/blog/cost-of-javascript-2019#json
34
+ __html: `globalThis.__EXPO_ROUTER_LOADER_DATA__ = JSON.parse(${JSON.stringify(safeJson)});`,
35
+ }}/>);
36
+ }
23
37
  function Html({ children }) {
24
38
  return (<html lang="en">
25
39
  <head>
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/static/html.tsx"],"names":[],"mappings":";;;;;AAWA,oDASC;AAED,oBAYC;AAlCD;;;;;GAKG;AACH,kDAAsD;AAEtD;;GAEG;AACH,SAAgB,oBAAoB;IAClC,OAAO,CACL,CAAC,KAAK,CACJ,EAAE,CAAC,YAAY,CACf,uBAAuB,CAAC,CAAC;YACvB,MAAM,EAAE,sEAAsE;SAC/E,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED,SAAgB,IAAI,CAAC,EAAE,QAAQ,EAAqB;IAClD,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACb;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EACrB;QAAA,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,EACnD;QAAA,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,uDAAuD,EACrF;QAAA,CAAC,oBAAoB,CAAC,AAAD,EACvB;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CACxB;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React, { type PropsWithChildren } from 'react';\n\n/**\n * Root style-reset for full-screen React Native web apps with a root `<ScrollView />` should use the following styles to ensure native parity. [Learn more](https://necolas.github.io/react-native-web/docs/setup/#root-element).\n */\nexport function ScrollViewStyleReset() {\n return (\n <style\n id=\"expo-reset\"\n dangerouslySetInnerHTML={{\n __html: `#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}`,\n }}\n />\n );\n}\n\nexport function Html({ children }: PropsWithChildren) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta httpEquiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\" />\n <ScrollViewStyleReset />\n </head>\n <body>{children}</body>\n </html>\n );\n}\n"]}
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../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is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React, { type PropsWithChildren } from 'react';\n\nimport { escapeUnsafeCharacters } from '../utils/html';\n\n/**\n * Root style-reset for full-screen React Native web apps with a root `<ScrollView />` should use the following styles to ensure native parity. [Learn more](https://necolas.github.io/react-native-web/docs/setup/#root-element).\n */\nexport function ScrollViewStyleReset() {\n return (\n <style\n id=\"expo-reset\"\n dangerouslySetInnerHTML={{\n __html: `#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}`,\n }}\n />\n );\n}\n\n/**\n * Injects loader data into the HTML as a script tag for client-side hydration.\n * The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.\n */\nexport function PreloadedDataScript({ data }: { data: Record<string, unknown> }) {\n const safeJson = escapeUnsafeCharacters(JSON.stringify(data));\n\n return (\n <script\n id=\"expo-router-data\"\n type=\"module\"\n dangerouslySetInnerHTML={{\n // NOTE(@hassankhan): The double serialization used here isn't as much of a problem server-side, but allows faster\n // client-side parsing using native `JSON.parse()`. See https://v8.dev/blog/cost-of-javascript-2019#json\n __html: `globalThis.__EXPO_ROUTER_LOADER_DATA__ = JSON.parse(${JSON.stringify(safeJson)});`,\n }}\n />\n );\n}\n\nexport function Html({ children }: PropsWithChildren) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta httpEquiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\" />\n <ScrollViewStyleReset />\n </head>\n <body>{children}</body>\n </html>\n );\n}\n"]}
@@ -5,6 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import '@expo/metro-runtime';
8
- export declare function getStaticContent(location: URL): Promise<string>;
8
+ type GetStaticContentOptions = {
9
+ loader?: {
10
+ data?: any;
11
+ };
12
+ };
13
+ export declare function getStaticContent(location: URL, options?: GetStaticContentOptions): Promise<string>;
9
14
  export { getBuildTimeServerManifestAsync, getManifest } from './getServerManifest';
10
15
  //# sourceMappingURL=renderStaticContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderStaticContent.d.ts","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,qBAAqB,CAAC;AA4B7B,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDrE;AAmBD,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"renderStaticContent.d.ts","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,qBAAqB,CAAC;AA8B7B,KAAK,uBAAuB,GAAG;IAC7B,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,CAAC;CACH,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,GAAG,EACb,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,MAAM,CAAC,CA+DjB;AAmBD,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
@@ -55,6 +55,8 @@ const getRootComponent_1 = require("./getRootComponent");
55
55
  const _ctx_1 = require("../../_ctx");
56
56
  const ExpoRoot_1 = require("../ExpoRoot");
57
57
  const head_1 = require("../head");
58
+ const html_1 = require("./html");
59
+ const ServerDataLoaderContext_1 = require("../loaders/ServerDataLoaderContext");
58
60
  const debug = require('debug')('expo:router:renderStaticContent');
59
61
  react_native_web_1.AppRegistry.registerComponent('App', () => ExpoRoot_1.ExpoRoot);
60
62
  function resetReactNavigationContexts() {
@@ -65,7 +67,7 @@ function resetReactNavigationContexts() {
65
67
  const contexts = '__react_navigation__elements_contexts';
66
68
  global[contexts] = new Map();
67
69
  }
68
- async function getStaticContent(location) {
70
+ async function getStaticContent(location, options) {
69
71
  const headContext = {};
70
72
  const ref = react_1.default.createRef();
71
73
  const {
@@ -87,8 +89,11 @@ async function getStaticContent(location) {
87
89
  // This MUST be run before `ReactDOMServer.renderToString` to prevent
88
90
  // "Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."
89
91
  resetReactNavigationContexts();
92
+ const loadedData = options?.loader?.data ? { [location.pathname]: options.loader.data } : null;
90
93
  const html = await server_node_1.default.renderToString(<head_1.Head.Provider context={headContext}>
91
- <native_1.ServerContainer ref={ref}>{element}</native_1.ServerContainer>
94
+ <ServerDataLoaderContext_1.ServerDataLoaderContext value={loadedData}>
95
+ <native_1.ServerContainer ref={ref}>{element}</native_1.ServerContainer>
96
+ </ServerDataLoaderContext_1.ServerDataLoaderContext>
92
97
  </head_1.Head.Provider>);
93
98
  // Eval the CSS after the HTML is rendered so that the CSS is in the same order
94
99
  const css = server_node_1.default.renderToStaticMarkup(getStyleElement());
@@ -99,6 +104,10 @@ async function getStaticContent(location) {
99
104
  // debug('Push static fonts:', fonts)
100
105
  // Inject static fonts loaded with expo-font
101
106
  output = output.replace('</head>', `${fonts.join('')}</head>`);
107
+ if (loadedData) {
108
+ const loaderDataScript = server_node_1.default.renderToStaticMarkup(<html_1.PreloadedDataScript data={loadedData}/>);
109
+ output = output.replace('</head>', `${loaderDataScript}</head>`);
110
+ }
102
111
  return '<!DOCTYPE html>' + output;
103
112
  }
104
113
  function mixHeadComponentsWithStaticResults(helmet, html) {
@@ -1 +1 @@
1
- {"version":3,"file":"renderStaticContent.js","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,4CAoDC;AAtFD;;;;;GAKG;AACH,+BAA6B;AAE7B,qDAA+E;AAC/E,6DAA+C;AAC/C,kDAA0B;AAC1B,wEAAmD;AACnD,wFAAwF;AACxF,uDAA+C;AAE/C,yDAAsD;AACtD,qCAAiC;AAC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AE,GAAG,CAAC,CAAC;IAC7E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAE7E,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8BAA8B;AAC9B,yDAAmF;AAA1E,oIAAA,+BAA+B,OAAA;AAAE,gHAAA,WAAW,OAAA","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport '@expo/metro-runtime';\n\nimport { ServerContainer, ServerContainerRef } from '@react-navigation/native';\nimport * as Font from 'expo-font/build/server';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server.node';\n// @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)\nimport { AppRegistry } from 'react-native-web';\n\nimport { getRootComponent } from './getRootComponent';\nimport { ctx } from '../../_ctx';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { Head } from '../head';\n\nconst debug = require('debug')('expo:router:renderStaticContent');\n\nAppRegistry.registerComponent('App', () => ExpoRoot);\n\nfunction resetReactNavigationContexts() {\n // https://github.com/expo/router/discussions/588\n // https://github.com/react-navigation/react-navigation/blob/9fe34b445fcb86e5666f61e144007d7540f014fa/packages/elements/src/getNamedContext.tsx#LL3C1-L4C1\n\n // React Navigation is storing providers in a global, this is fine for the first static render\n // but subsequent static renders of Stack or Tabs will cause React to throw a warning. To prevent this warning, we'll reset the globals before rendering.\n const contexts = '__react_navigation__elements_contexts';\n global[contexts] = new Map<string, React.Context<any>>();\n}\n\nexport async function getStaticContent(location: URL): Promise<string> {\n const headContext: { helmet?: any } = {};\n\n const ref = React.createRef<ServerContainerRef>();\n\n const {\n // NOTE: The `element` that's returned adds two extra Views and\n // the seemingly unused `RootTagContext.Provider`.\n element,\n getStyleElement,\n } = AppRegistry.getApplication('App', {\n initialProps: {\n location,\n context: ctx,\n wrapper: ({ children }: React.ComponentProps<any>) => (\n <Root>\n <div id=\"root\">{children}</div>\n </Root>\n ),\n },\n });\n\n const Root = getRootComponent();\n\n // Clear any existing static resources from the global scope to attempt to prevent leaking between pages.\n // This could break if pages are rendered in parallel or if fonts are loaded outside of the React tree\n Font.resetServerContext();\n\n // This MUST be run before `ReactDOMServer.renderToString` to prevent\n // \"Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.\"\n resetReactNavigationContexts();\n\n const html = await ReactDOMServer.renderToString(\n <Head.Provider context={headContext}>\n <ServerContainer ref={ref}>{element}</ServerContainer>\n </Head.Provider>\n );\n\n // Eval the CSS after the HTML is rendered so that the CSS is in the same order\n const css = ReactDOMServer.renderToStaticMarkup(getStyleElement());\n\n let output = mixHeadComponentsWithStaticResults(headContext.helmet, html);\n\n output = output.replace('</head>', `${css}</head>`);\n\n const fonts = Font.getServerResources();\n debug(`Pushing static fonts: (count: ${fonts.length})`, fonts);\n // debug('Push static fonts:', fonts)\n // Inject static fonts loaded with expo-font\n output = output.replace('</head>', `${fonts.join('')}</head>`);\n\n return '<!DOCTYPE html>' + output;\n}\n\nfunction mixHeadComponentsWithStaticResults(helmet: any, html: string) {\n // Head components\n for (const key of ['title', 'priority', 'meta', 'link', 'script', 'style'].reverse()) {\n const result = helmet?.[key]?.toString();\n if (result) {\n html = html.replace('<head>', `<head>${result}`);\n }\n }\n\n // attributes\n html = html.replace('<html ', `<html ${helmet?.htmlAttributes.toString()} `);\n html = html.replace('<body ', `<body ${helmet?.bodyAttributes.toString()} `);\n\n return html;\n}\n\n// Re-export for use in server\nexport { getBuildTimeServerManifestAsync, getManifest } from './getServerManifest';\n"]}
1
+ {"version":3,"file":"renderStaticContent.js","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,4CAkEC;AA5GD;;;;;GAKG;AACH,+BAA6B;AAE7B,qDAA+E;AAC/E,6DAA+C;AAC/C,kD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AG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,gBAAgB,SAAS,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,iBAAiB,GAAG,MAAM,CAAC;AACpC,CAAC;AAED,SAAS,kCAAkC,CAAC,MAAW,EAAE,IAAY;IACnE,kBAAkB;IAClB,KAAK,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACrF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC;QACzC,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,aAAa;IACb,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAE7E,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8BAA8B;AAC9B,yDAAmF;AAA1E,oIAAA,+BAA+B,OAAA;AAAE,gHAAA,WAAW,OAAA","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport '@expo/metro-runtime';\n\nimport { ServerContainer, ServerContainerRef } from '@react-navigation/native';\nimport * as Font from 'expo-font/build/server';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server.node';\n// @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)\nimport { AppRegistry } from 'react-native-web';\n\nimport { getRootComponent } from './getRootComponent';\nimport { ctx } from '../../_ctx';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { Head } from '../head';\nimport { PreloadedDataScript } from './html';\nimport { ServerDataLoaderContext } from '../loaders/ServerDataLoaderContext';\n\nconst debug = require('debug')('expo:router:renderStaticContent');\n\nAppRegistry.registerComponent('App', () => ExpoRoot);\n\nfunction resetReactNavigationContexts() {\n // https://github.com/expo/router/discussions/588\n // https://github.com/react-navigation/react-navigation/blob/9fe34b445fcb86e5666f61e144007d7540f014fa/packages/elements/src/getNamedContext.tsx#LL3C1-L4C1\n\n // React Navigation is storing providers in a global, this is fine for the first static render\n // but subsequent static renders of Stack or Tabs will cause React to throw a warning. To prevent this warning, we'll reset the globals before rendering.\n const contexts = '__react_navigation__elements_contexts';\n global[contexts] = new Map<string, React.Context<any>>();\n}\n\ntype GetStaticContentOptions = {\n loader?: {\n data?: any;\n };\n};\n\nexport async function getStaticContent(\n location: URL,\n options?: GetStaticContentOptions\n): Promise<string> {\n const headContext: { helmet?: any } = {};\n\n const ref = React.createRef<ServerContainerRef>();\n\n const {\n // NOTE: The `element` that's returned adds two extra Views and\n // the seemingly unused `RootTagContext.Provider`.\n element,\n getStyleElement,\n } = AppRegistry.getApplication('App', {\n initialProps: {\n location,\n context: ctx,\n wrapper: ({ children }: React.ComponentProps<any>) => (\n <Root>\n <div id=\"root\">{children}</div>\n </Root>\n ),\n },\n });\n\n const Root = getRootComponent();\n\n // Clear any existing static resources from the global scope to attempt to prevent leaking between pages.\n // This could break if pages are rendered in parallel or if fonts are loaded outside of the React tree\n Font.resetServerContext();\n\n // This MUST be run before `ReactDOMServer.renderToString` to prevent\n // \"Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.\"\n resetReactNavigationContexts();\n\n const loadedData = options?.loader?.data ? { [location.pathname]: options.loader.data } : null;\n\n const html = await ReactDOMServer.renderToString(\n <Head.Provider context={headContext}>\n <ServerDataLoaderContext value={loadedData}>\n <ServerContainer ref={ref}>{element}</ServerContainer>\n </ServerDataLoaderContext>\n </Head.Provider>\n );\n\n // Eval the CSS after the HTML is rendered so that the CSS is in the same order\n const css = ReactDOMServer.renderToStaticMarkup(getStyleElement());\n\n let output = mixHeadComponentsWithStaticResults(headContext.helmet, html);\n\n output = output.replace('</head>', `${css}</head>`);\n\n const fonts = Font.getServerResources();\n debug(`Pushing static fonts: (count: ${fonts.length})`, fonts);\n // debug('Push static fonts:', fonts)\n // Inject static fonts loaded with expo-font\n output = output.replace('</head>', `${fonts.join('')}</head>`);\n\n if (loadedData) {\n const loaderDataScript = ReactDOMServer.renderToStaticMarkup(\n <PreloadedDataScript data={loadedData} />\n );\n output = output.replace('</head>', `${loaderDataScript}</head>`);\n }\n\n return '<!DOCTYPE html>' + output;\n}\n\nfunction mixHeadComponentsWithStaticResults(helmet: any, html: string) {\n // Head components\n for (const key of ['title', 'priority', 'meta', 'link', 'script', 'style'].reverse()) {\n const result = helmet?.[key]?.toString();\n if (result) {\n html = html.replace('<head>', `<head>${result}`);\n }\n }\n\n // attributes\n html = html.replace('<html ', `<html ${helmet?.htmlAttributes.toString()} `);\n html = html.replace('<body ', `<body ${helmet?.bodyAttributes.toString()} `);\n\n return html;\n}\n\n// Re-export for use in server\nexport { getBuildTimeServerManifestAsync, getManifest } from './getServerManifest';\n"]}
@@ -1,10 +1,11 @@
1
1
  import requireContext from './require-context-ponyfill';
2
- import { NativeIntent } from '../types';
2
+ import { LoaderFunction, NativeIntent } from '../types';
3
3
  export type ReactComponent = () => React.ReactElement<any, any> | null;
4
4
  export type NativeIntentStub = NativeIntent;
5
5
  export type FileStub = (Record<string, unknown> & {
6
6
  default: ReactComponent;
7
7
  unstable_settings?: Record<string, any>;
8
+ loader?: LoaderFunction;
8
9
  }) | ReactComponent;
9
10
  export type MemoryContext = Record<string, FileStub | NativeIntentStub> & {
10
11
  '+native-intent'?: NativeIntentStub;
@@ -13,6 +14,7 @@ export { requireContext };
13
14
  export declare function inMemoryContext(context: MemoryContext): ((id: string) => NativeIntent | ReactComponent | (Record<string, unknown> & {
14
15
  default: ReactComponent;
15
16
  unstable_settings?: Record<string, any>;
17
+ loader?: LoaderFunction;
16
18
  }) | {
17
19
  default: NativeIntent | FileStub;
18
20
  }) & {
@@ -1 +1 @@
1
- {"version":3,"file":"context-stubs.d.ts","sourceRoot":"","sources":["../../src/testing-library/context-stubs.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAC5C,MAAM,MAAM,QAAQ,GAChB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACzB,OAAO,EAAE,cAAc,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC,CAAC,GACF,cAAc,CAAC;AAEnB,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,CAAC,GAAG;IACxE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC;AAI1B,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,SAEpC,MAAM;aAfT,cAAc;wBACH,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;mBAmBxB,MAAM;;;EAa1B;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,SAI/D,MAAM;;mBAUH,MAAM;;EAI1B"}
1
+ {"version":3,"file":"context-stubs.d.ts","sourceRoot":"","sources":["../../src/testing-library/context-stubs.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,cAAc,EAA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E,CAAC,CAAC;YAC5B,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,EACD;QACE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;QAClE,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG;QAC7B,EAAE,EAAE,GAAG;KACR,CACF,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport requireContext from './require-context-ponyfill';\nimport { NativeIntent } from '../types';\n\nexport type ReactComponent = () => React.ReactElement<any, any> | null;\nexport type NativeIntentStub = NativeIntent;\nexport type FileStub =\n | (Record<string, unknown> & {\n default: ReactComponent;\n unstable_settings?: Record<string, any>;\n })\n | ReactComponent;\n\nexport type MemoryContext = Record<string, FileStub | NativeIntentStub> & {\n '+native-intent'?: NativeIntentStub;\n};\n\nexport { requireContext };\n\nconst validExtensions = ['.js', '.jsx', '.ts', '.tsx'];\n\nexport function inMemoryContext(context: MemoryContext) {\n return Object.assign(\n function (id: string) {\n id = id.replace(/^\\.\\//, '').replace(/\\.\\w*$/, '');\n return typeof context[id] === 'function' ? { default: context[id] } : context[id];\n },\n {\n resolve: (key: string) => key,\n id: '0',\n keys: () =>\n Object.keys(context).map((key) => {\n const ext = path.extname(key);\n key = key.replace(/^\\.\\//, '');\n key = key.startsWith('/') ? key : `./${key}`;\n key = validExtensions.includes(ext) ? key : `${key}.js`;\n\n return key;\n }),\n }\n );\n}\n\nexport function requireContextWithOverrides(dir: string, overrides: MemoryContext) {\n const existingContext = requireContext(path.resolve(process.cwd(), dir));\n\n return Object.assign(\n function (id: string) {\n if (id in overrides) {\n const route = overrides[id];\n return typeof route === 'function' ? { default: route } : route;\n } else {\n return existingContext(id);\n }\n },\n {\n keys: () => [...Object.keys(overrides), ...existingContext.keys()],\n resolve: (key: string) => key,\n id: '0',\n }\n );\n}\n"]}
1
+ {"version":3,"file":"context-stubs.js","sourceRoot":"","sources":["../../src/testing-library/context-stubs.ts"],"names":[],"mappings":";;;;;;AAuBA,0CAoBC;AAED,kEAkBC;AA/DD,gDAAwB;AAExB,0FAAwD;AAiB/C,yBAjBF,kCAAc,CAiBE;AAEvB,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAEvD,SAAgB,eAAe,CAAC,OAAsB;IACpD,OAAO,MAAM,CAAC,MAAM,CAClB,UAAU,EAAU;QAClB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACnD,OAAO,OAAO,OAAO,CAAC,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC,EACD;QACE,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG;QAC7B,EAAE,EAAE,GAAG;QACP,IAAI,EAAE,GAAG,EAAE,CACT,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAC/B,MAAM,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC9B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAC/B,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC7C,GAAG,GAAG,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC;YAExD,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;KACL,CACF,CAAC;AACJ,CAAC;AAED,SAAgB,2BAA2B,CAAC,GAAW,EAAE,SAAwB;IAC/E,MAAM,eAAe,GAAG,IAAA,kCAAc,EAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IAEzE,OAAO,MAAM,CAAC,MAAM,CAClB,UAAU,EAAU;QAClB,IAAI,EAAE,IAAI,SAAS,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;YAC5B,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,EACD;QACE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;QAClE,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG;QAC7B,EAAE,EAAE,GAAG;KACR,CACF,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport requireContext from './require-context-ponyfill';\nimport { LoaderFunction, NativeIntent } from '../types';\n\nexport type ReactComponent = () => React.ReactElement<any, any> | null;\nexport type NativeIntentStub = NativeIntent;\nexport type FileStub =\n | (Record<string, unknown> & {\n default: ReactComponent;\n unstable_settings?: Record<string, any>;\n loader?: LoaderFunction;\n })\n | ReactComponent;\n\nexport type MemoryContext = Record<string, FileStub | NativeIntentStub> & {\n '+native-intent'?: NativeIntentStub;\n};\n\nexport { requireContext };\n\nconst validExtensions = ['.js', '.jsx', '.ts', '.tsx'];\n\nexport function inMemoryContext(context: MemoryContext) {\n return Object.assign(\n function (id: string) {\n id = id.replace(/^\\.\\//, '').replace(/\\.\\w*$/, '');\n return typeof context[id] === 'function' ? { default: context[id] } : context[id];\n },\n {\n resolve: (key: string) => key,\n id: '0',\n keys: () =>\n Object.keys(context).map((key) => {\n const ext = path.extname(key);\n key = key.replace(/^\\.\\//, '');\n key = key.startsWith('/') ? key : `./${key}`;\n key = validExtensions.includes(ext) ? key : `${key}.js`;\n\n return key;\n }),\n }\n );\n}\n\nexport function requireContextWithOverrides(dir: string, overrides: MemoryContext) {\n const existingContext = requireContext(path.resolve(process.cwd(), dir));\n\n return Object.assign(\n function (id: string) {\n if (id in overrides) {\n const route = overrides[id];\n return typeof route === 'function' ? { default: route } : route;\n } else {\n return existingContext(id);\n }\n },\n {\n keys: () => [...Object.keys(overrides), ...existingContext.keys()],\n resolve: (key: string) => key,\n id: '0',\n }\n );\n}\n"]}
@@ -4,6 +4,10 @@ declare global {
4
4
  var __EXPO_REFETCH_ROUTE__: undefined | (() => void);
5
5
  var __EXPO_REFETCH_ROUTE_NO_CACHE__: undefined | (() => void);
6
6
  var __expo_platform_header: undefined | string;
7
+ /**
8
+ * Data injected by a server data loader for the current route.
9
+ */
10
+ var __EXPO_ROUTER_LOADER_DATA__: Record<string, any> | undefined;
7
11
  }
8
12
  export {};
9
13
  //# sourceMappingURL=expo-router-internal-globals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expo-router-internal-globals.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,6BAA6B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC9D,IAAI,oBAAoB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACnD,IAAI,sBAAsB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACrD,IAAI,+BAA+B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC9D,IAAI,sBAAsB,EAAE,SAAS,GAAG,MAAM,CAAC;CAChD"}
1
+ {"version":3,"file":"expo-router-internal-globals.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,6BAA6B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC9D,IAAI,oBAAoB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACnD,IAAI,sBAAsB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACrD,IAAI,+BAA+B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC9D,IAAI,sBAAsB,EAAE,SAAS,GAAG,MAAM,CAAC;IAC/C;;OAEG;IACH,IAAI,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CAClE"}
@@ -1 +1 @@
1
- {"version":3,"file":"expo-router-internal-globals.js","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":";AAAA,2BAA2B","sourcesContent":["/* eslint-disable no-var */\n\ndeclare global {\n var __EXPO_RSC_RELOAD_LISTENERS__: undefined | (() => void)[];\n var __EXPO_REFETCH_RSC__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE_NO_CACHE__: undefined | (() => void);\n var __expo_platform_header: undefined | string;\n}\n"]}
1
+ {"version":3,"file":"expo-router-internal-globals.js","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":";AAAA,2BAA2B","sourcesContent":["/* eslint-disable no-var */\n\ndeclare global {\n var __EXPO_RSC_RELOAD_LISTENERS__: undefined | (() => void)[];\n var __EXPO_REFETCH_RSC__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE_NO_CACHE__: undefined | (() => void);\n var __expo_platform_header: undefined | string;\n /**\n * Data injected by a server data loader for the current route.\n */\n var __EXPO_ROUTER_LOADER_DATA__: Record<string, any> | undefined;\n}\n"]}
package/build/types.d.ts CHANGED
@@ -55,5 +55,13 @@ export type NativeIntent = {
55
55
  */
56
56
  legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);
57
57
  };
58
+ /**
59
+ * Function type for route loaders. Loaders are executed on the server during
60
+ * SSR/SSG to fetch data required by a route.
61
+ */
62
+ export type LoaderFunction<T = any> = (args: {
63
+ params: Record<string, string | string[]>;
64
+ request?: Request;
65
+ }) => Promise<T> | T;
58
66
  export type * from './typed-routes/types';
59
67
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEjF;;;;;;;;;GASG;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;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAAK,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;CACzF,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErB,mBAAmB,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// TODO: Use the global type\n/**\n * @hidden\n */\nexport interface RequireContext {\n /** Return the keys that can be resolved. */\n keys(): string[];\n (id: string): any;\n <T>(id: string): T;\n /** **Unimplemented:** Return the module identifier for a user request. */\n resolve(id: string): string;\n /** **Unimplemented:** Readable identifier for the context module. */\n id: string;\n}\n\n/**\n * The list of input keys will become optional, everything else will remain the same.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * Created by using a special file called `+native-intent.tsx` at the top-level of your\n * project's **app** directory. It exports `redirectSystemPath` or `legacy_subscribe` functions,\n * both methods designed to handle URL/path processing.\n *\n * Useful for re-writing URLs to correctly target a route when unique/referred URLs\n * are incoming from third-party providers or stale URLs from previous versions.\n *\n * @see For more information on how to use `NativeIntent`, see [Customizing links](/router/advanced/native-intent/).\n */\nexport type NativeIntent = {\n /**\n * A special method used to process URLs in native apps. When invoked, it receives an\n * `options` object with the following properties:\n * - **path**: represents the URL or path undergoing processing.\n * - **initial**: a boolean indicating whether the path is the app's initial URL.\n *\n * It's return value should either be a `string` or a `Promise<string>`.\n * Note that throwing errors within this method may result in app crashes. It's recommended to\n * wrap your code inside a `try/catch` block and utilize `.catch()` when appropriate.\n *\n * @see For usage information, see [Redirecting system paths](/router/advanced/native-intent/#redirectsystempath).\n */\n redirectSystemPath?: (event: { path: string; initial: boolean }) => Promise<string> | string;\n /**\n * > **warning** Experimentally available in SDK 52.\n *\n * Useful as an alternative API when a third-party provider doesn't support Expo Router\n * but has support for React Navigation via `Linking.subscribe()` for existing projects.\n *\n * Using this API is not recommended for newer projects or integrations since it is\n * incompatible with Server Side Routing and\n * [Static Rendering](/router/reference/static-rendering/), and can become challenging to manage while offline or in a low network environment.\n *\n */\n legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);\n};\n\nexport type * from './typed-routes/types';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// TODO: Use the global type\n/**\n * @hidden\n */\nexport interface RequireContext {\n /** Return the keys that can be resolved. */\n keys(): string[];\n (id: string): any;\n <T>(id: string): T;\n /** **Unimplemented:** Return the module identifier for a user request. */\n resolve(id: string): string;\n /** **Unimplemented:** Readable identifier for the context module. */\n id: string;\n}\n\n/**\n * The list of input keys will become optional, everything else will remain the same.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * Created by using a special file called `+native-intent.tsx` at the top-level of your\n * project's **app** directory. It exports `redirectSystemPath` or `legacy_subscribe` functions,\n * both methods designed to handle URL/path processing.\n *\n * Useful for re-writing URLs to correctly target a route when unique/referred URLs\n * are incoming from third-party providers or stale URLs from previous versions.\n *\n * @see For more information on how to use `NativeIntent`, see [Customizing links](/router/advanced/native-intent/).\n */\nexport type NativeIntent = {\n /**\n * A special method used to process URLs in native apps. When invoked, it receives an\n * `options` object with the following properties:\n * - **path**: represents the URL or path undergoing processing.\n * - **initial**: a boolean indicating whether the path is the app's initial URL.\n *\n * It's return value should either be a `string` or a `Promise<string>`.\n * Note that throwing errors within this method may result in app crashes. It's recommended to\n * wrap your code inside a `try/catch` block and utilize `.catch()` when appropriate.\n *\n * @see For usage information, see [Redirecting system paths](/router/advanced/native-intent/#redirectsystempath).\n */\n redirectSystemPath?: (event: { path: string; initial: boolean }) => Promise<string> | string;\n /**\n * > **warning** Experimentally available in SDK 52.\n *\n * Useful as an alternative API when a third-party provider doesn't support Expo Router\n * but has support for React Navigation via `Linking.subscribe()` for existing projects.\n *\n * Using this API is not recommended for newer projects or integrations since it is\n * incompatible with Server Side Routing and\n * [Static Rendering](/router/reference/static-rendering/), and can become challenging to manage while offline or in a low network environment.\n *\n */\n legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);\n};\n\n/**\n * Function type for route loaders. Loaders are executed on the server during\n * SSR/SSG to fetch data required by a route.\n */\nexport type LoaderFunction<T = any> = (args: {\n params: Record<string, string | string[]>;\n request?: Request;\n}) => Promise<T> | T;\n\nexport type * from './typed-routes/types';\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright © 2023 650 Industries.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Replaces unsafe characters in a string with their escaped equivalents. This is to safely
9
+ * embed data in an HTML context to prevent XSS.
10
+ */
11
+ export declare function escapeUnsafeCharacters(str: string): string;
12
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright © 2023 650 Industries.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.escapeUnsafeCharacters = escapeUnsafeCharacters;
10
+ // See: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/packages/next-urql/src/htmlescape.ts#L10
11
+ // License: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/LICENSE
12
+ // This utility is based on https://github.com/zertosh/htmlescape
13
+ // License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
14
+ const UNSAFE_CHARACTERS_REGEX = /[&><\u2028\u2029]/g;
15
+ const ESCAPED_CHARACTERS = {
16
+ '&': '\\u0026',
17
+ '>': '\\u003e',
18
+ '<': '\\u003c',
19
+ '\u2028': '\\u2028',
20
+ '\u2029': '\\u2029',
21
+ };
22
+ /**
23
+ * Replaces unsafe characters in a string with their escaped equivalents. This is to safely
24
+ * embed data in an HTML context to prevent XSS.
25
+ */
26
+ function escapeUnsafeCharacters(str) {
27
+ return str.replace(UNSAFE_CHARACTERS_REGEX, (match) => ESCAPED_CHARACTERS[match]);
28
+ }
29
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqBH,wDAEC;AArBD,mIAAmI;AACnI,sGAAsG;AAEtG,iEAAiE;AACjE,uGAAuG;AAEvG,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AACrD,MAAM,kBAAkB,GAAgC;IACtD,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;AACpF,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// See: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/packages/next-urql/src/htmlescape.ts#L10\n// License: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/LICENSE\n\n// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n\nconst UNSAFE_CHARACTERS_REGEX = /[&><\\u2028\\u2029]/g;\nconst ESCAPED_CHARACTERS: { [match: string]: string } = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n};\n\n/**\n * Replaces unsafe characters in a string with their escaped equivalents. This is to safely\n * embed data in an HTML context to prevent XSS.\n */\nexport function escapeUnsafeCharacters(str: string): string {\n return str.replace(UNSAFE_CHARACTERS_REGEX, (match) => ESCAPED_CHARACTERS[match]);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "6.0.10",
3
+ "version": "6.1.0-canary-20251003-7b9d7ff",
4
4
  "description": "Expo Router is a file-based router for React Native and web applications.",
5
5
  "author": "650 Industries, Inc.",
6
6
  "license": "MIT",
@@ -77,12 +77,12 @@
77
77
  "expo"
78
78
  ],
79
79
  "peerDependencies": {
80
- "@expo/metro-runtime": "^6.1.2",
80
+ "@expo/metro-runtime": "6.1.3-canary-20251003-7b9d7ff",
81
81
  "@react-navigation/drawer": "^7.5.0",
82
82
  "@testing-library/react-native": ">= 12.0.0",
83
- "expo": "*",
84
- "expo-constants": "^18.0.9",
85
- "expo-linking": "^8.0.8",
83
+ "expo": "55.0.0-canary-20251003-7b9d7ff",
84
+ "expo-constants": "18.0.10-canary-20251003-7b9d7ff",
85
+ "expo-linking": "8.0.9-canary-20251003-7b9d7ff",
86
86
  "react": "*",
87
87
  "react-dom": "*",
88
88
  "react-native": "*",
@@ -128,8 +128,8 @@
128
128
  "tsd": "^0.28.1"
129
129
  },
130
130
  "dependencies": {
131
- "@expo/metro-runtime": "^6.1.2",
132
- "@expo/schema-utils": "^0.1.7",
131
+ "@expo/metro-runtime": "6.1.3-canary-20251003-7b9d7ff",
132
+ "@expo/schema-utils": "0.1.8-canary-20251003-7b9d7ff",
133
133
  "@radix-ui/react-slot": "1.2.0",
134
134
  "@radix-ui/react-tabs": "^1.1.12",
135
135
  "@react-navigation/bottom-tabs": "^7.4.0",
@@ -138,7 +138,7 @@
138
138
  "client-only": "^0.0.1",
139
139
  "debug": "^4.3.4",
140
140
  "escape-string-regexp": "^4.0.0",
141
- "expo-server": "^1.0.0",
141
+ "expo-server": "1.0.1-canary-20251003-7b9d7ff",
142
142
  "fast-deep-equal": "^3.1.3",
143
143
  "invariant": "^2.2.4",
144
144
  "nanoid": "^3.3.8",
@@ -151,6 +151,5 @@
151
151
  "shallowequal": "^1.1.0",
152
152
  "use-latest-callback": "^0.2.1",
153
153
  "vaul": "^1.1.2"
154
- },
155
- "gitHead": "73d9bc0ee4f1e28cfda349dc36ee53d16fad0c5d"
154
+ }
156
155
  }
@@ -19,5 +19,7 @@ declare const withRouter: ConfigPlugin<{
19
19
  partialTypedGroups?: boolean;
20
20
  /** Enable experimental server middleware support with a `+middleware.ts` file. Requires `web.output: 'server'` to be set in app config. */
21
21
  unstable_useServerMiddleware?: boolean;
22
+ /** Enable experimental data loader support. Requires `web.output: 'static'` to be set in app config. */
23
+ unstable_useServerDataLoaders?: boolean;
22
24
  } | void>;
23
25
  export default withRouter;