expo-router 5.2.0-canary-20250811-5c940c0 → 6.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/build/layouts/Stack.web.d.ts +1 -1
  2. package/build/layouts/Stack.web.d.ts.map +1 -1
  3. package/build/layouts/Stack.web.js +3 -3
  4. package/build/layouts/Stack.web.js.map +1 -1
  5. package/build/layouts/StackClient.d.ts.map +1 -1
  6. package/build/layouts/StackClient.js +7 -8
  7. package/build/layouts/StackClient.js.map +1 -1
  8. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  9. package/build/layouts/withLayoutContext.js +3 -3
  10. package/build/layouts/withLayoutContext.js.map +1 -1
  11. package/build/link/LinkWithPreview.d.ts.map +1 -1
  12. package/build/link/LinkWithPreview.js +13 -4
  13. package/build/link/LinkWithPreview.js.map +1 -1
  14. package/build/link/elements.d.ts +26 -18
  15. package/build/link/elements.d.ts.map +1 -1
  16. package/build/link/elements.js +4 -4
  17. package/build/link/elements.js.map +1 -1
  18. package/build/link/preview/HrefPreview.d.ts.map +1 -1
  19. package/build/link/preview/HrefPreview.js +22 -4
  20. package/build/link/preview/HrefPreview.js.map +1 -1
  21. package/build/link/preview/useNextScreenId.d.ts.map +1 -1
  22. package/build/link/preview/useNextScreenId.js +0 -1
  23. package/build/link/preview/useNextScreenId.js.map +1 -1
  24. package/build/modal/ModalsRenderer.web.js +4 -4
  25. package/build/modal/ModalsRenderer.web.js.map +1 -1
  26. package/build/modal/web/{ModalStack.web.d.ts → ModalStack.d.ts} +1 -1
  27. package/build/modal/web/ModalStack.d.ts.map +1 -0
  28. package/build/modal/web/{ModalStack.web.js → ModalStack.js} +5 -5
  29. package/build/modal/web/ModalStack.js.map +1 -0
  30. package/build/modal/web/{ModalStackRouteDrawer.web.d.ts → ModalStackRouteDrawer.d.ts} +1 -1
  31. package/build/modal/web/ModalStackRouteDrawer.d.ts.map +1 -0
  32. package/build/modal/web/{ModalStackRouteDrawer.web.js → ModalStackRouteDrawer.js} +1 -1
  33. package/build/modal/web/ModalStackRouteDrawer.js.map +1 -0
  34. package/build/modal/web/{TransparentModalStackRouteDrawer.web.d.ts → TransparentModalStackRouteDrawer.d.ts} +1 -1
  35. package/build/modal/web/TransparentModalStackRouteDrawer.d.ts.map +1 -0
  36. package/build/modal/web/{TransparentModalStackRouteDrawer.web.js → TransparentModalStackRouteDrawer.js} +1 -1
  37. package/build/modal/web/TransparentModalStackRouteDrawer.js.map +1 -0
  38. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts +4 -12
  39. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -1
  40. package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -1
  41. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts +47 -0
  42. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -0
  43. package/build/native-tabs/NativeBottomTabs/{TabOptions.js → NativeTabTrigger.js} +57 -7
  44. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -0
  45. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +22 -5
  46. package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -1
  47. package/build/native-tabs/NativeBottomTabs/NativeTabs.js +20 -2
  48. package/build/native-tabs/NativeBottomTabs/NativeTabs.js.map +1 -1
  49. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts +1 -100
  50. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
  51. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +53 -6
  52. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
  53. package/build/native-tabs/NativeBottomTabs/types.d.ts +166 -0
  54. package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -0
  55. package/build/native-tabs/NativeBottomTabs/types.js +3 -0
  56. package/build/native-tabs/NativeBottomTabs/types.js.map +1 -0
  57. package/build/native-tabs/NativeBottomTabs/utils.d.ts +2 -2
  58. package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +1 -1
  59. package/build/native-tabs/NativeBottomTabs/utils.js.map +1 -1
  60. package/build/native-tabs/common/elements.d.ts +21 -6
  61. package/build/native-tabs/common/elements.d.ts.map +1 -1
  62. package/build/native-tabs/common/elements.js +6 -0
  63. package/build/native-tabs/common/elements.js.map +1 -1
  64. package/build/native-tabs/index.d.ts +3 -1
  65. package/build/native-tabs/index.d.ts.map +1 -1
  66. package/build/native-tabs/index.js +18 -5
  67. package/build/native-tabs/index.js.map +1 -1
  68. package/build/rsc/middleware.d.ts +1 -1
  69. package/build/rsc/middleware.d.ts.map +1 -1
  70. package/build/rsc/middleware.js.map +1 -1
  71. package/build/views/Sitemap.d.ts.map +1 -1
  72. package/build/views/Sitemap.js +66 -36
  73. package/build/views/Sitemap.js.map +1 -1
  74. package/ios/LinkPreview/LinkPreviewNativeModule.swift +7 -1
  75. package/ios/LinkPreview/LinkPreviewNativePreviewView.swift +0 -1
  76. package/ios/LinkPreview/LinkPreviewNativeTriggerView.swift +1 -1
  77. package/ios/LinkPreview/LinkPreviewNativeView.swift +4 -3
  78. package/package.json +10 -7
  79. package/plugin/tsconfig.tsbuildinfo +1 -0
  80. package/server.d.ts +2 -2
  81. package/unstable-native-tabs.d.ts +1 -0
  82. package/unstable-native-tabs.js +1 -0
  83. package/build/modal/web/ModalStack.web.d.ts.map +0 -1
  84. package/build/modal/web/ModalStack.web.js.map +0 -1
  85. package/build/modal/web/ModalStackRouteDrawer.web.d.ts.map +0 -1
  86. package/build/modal/web/ModalStackRouteDrawer.web.js.map +0 -1
  87. package/build/modal/web/TransparentModalStackRouteDrawer.web.d.ts.map +0 -1
  88. package/build/modal/web/TransparentModalStackRouteDrawer.web.js.map +0 -1
  89. package/build/native-tabs/NativeBottomTabs/TabOptions.d.ts +0 -40
  90. package/build/native-tabs/NativeBottomTabs/TabOptions.d.ts.map +0 -1
  91. package/build/native-tabs/NativeBottomTabs/TabOptions.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDb,wCAYC;AAqHD,kCA4BC;AAuBD,kCAYC;AAtPD,+CAA8F;AAG9F,6EAA0E;AAC1E,uDAAoD;AACpD,uEAA6D;AAC7D,6CAAqF;AACrF,qCAAkC;AAuClC;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,IAAA,WAAG,EAAC,uDAA0B,CAAC,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC3D,OAAO,CACL,CAAC,gCAAuB,CACtB,IAAI,IAAI,CAAC,CACT,UAAU,CAAC,CAAC,OAAO,CAAC,CACpB,aAAa,CAAC,CAAC,sBAAsB,CAAC,EACtC,CACH,CAAC;AACJ,CAAC;AAkCD;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;IACzD,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,IAAA,WAAG,EAAC,uDAA0B,CAAC,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAC5D,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,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ACvB,KAAK,CAAC,CAAC;YACL,6EAA6E;YAC7E,eAAe,EAAE,MAAM;SACxB,CAAC,CACF,oBAAoB,CAAC,CAAC,WAAW,CAAC,CAClC;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,iCAAwB,CAAC,CAC5B,CAAC;AACJ,CAAC;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,WAAW,CAAC,KAAuB;IACjD,IAAI,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,6EAA6E;QAC7E,qGAAqG;QACrG,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IACD,OAAO,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7B,CAAC","sourcesContent":["'use client';\n\nimport React, { isValidElement, use, type PropsWithChildren, type ReactElement } from 'react';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { HrefPreview } from './preview/HrefPreview';\nimport { useIsPreview } from './preview/PreviewRouteContext';\nimport { NativeLinkPreviewAction, NativeLinkPreviewContent } from './preview/native';\nimport { Slot } from '../ui/Slot';\n\nexport interface LinkMenuActionProps {\n /**\n * The title of the menu item.\n */\n title: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\n /**\n * If true, the menu item will be disabled and not selectable.\n *\n * https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled\n */\n disabled?: boolean;\n /**\n * If true, the menu item will be displayed as destructive.\n *\n * https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive\n */\n destructive?: boolean;\n /**\n * If true, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented\n */\n unstable_keepPresented?: boolean;\n /**\n * If true, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress: () => void;\n}\n\n/**\n * This component renders a context menu action for a link.\n * It should only be used as a child of `Link.Menu` or `LinkMenu`.\n *\n * **Note:** You can use the alias `Link.MenuAction` for this component.\n *\n * @platform ios\n */\nexport function LinkMenuAction(props: LinkMenuActionProps) {\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const { unstable_keepPresented, onPress, ...rest } = props;\n return (\n <NativeLinkPreviewAction\n {...rest}\n onSelected={onPress}\n keepPresented={unstable_keepPresented}\n />\n );\n}\n\nexport interface LinkMenuProps {\n /**\n * The title of the menu item\n */\n title?: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: string;\n /**\n * If true, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette\n */\n displayAsPalette?: boolean;\n /**\n * If true, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline\n */\n displayInline?: boolean;\n /**\n * If true, the menu item will be displayed as destructive.\n *\n * https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive\n */\n destructive?: boolean;\n children: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];\n}\n\n/**\n * Groups context menu actions for a link.\n *\n * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.\n * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.\n *\n * @example\n * ```tsx\n * <Link.Menu>\n * <Link.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Link.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Link.Menu>\n * ```\n *\n * **Note:** You can use the alias `Link.Menu` for this component.\n *\n * @platform ios\n */\nexport const LinkMenu: React.FC<LinkMenuProps> = (props) => {\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const children = React.Children.toArray(props.children).filter(\n (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)\n );\n return (\n <NativeLinkPreviewAction\n {...props}\n title={props.title ?? ''}\n onSelected={() => {}}\n children={children}\n />\n );\n};\n\nexport interface LinkPreviewProps {\n /**\n * Sets the preferred width of the preview.\n * If not set, full width of the screen will be used.\n *\n * This is only **preferred** width, the actual width may be different\n */\n width?: number;\n\n /**\n * Sets the preferred height of the preview.\n * If not set, full height of the screen will be used.\n *\n * This is only **preferred** height, the actual height may be different\n */\n height?: number;\n children?: React.ReactNode;\n}\n\n/**\n * A component used to render and customize the link preview.\n *\n * If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.\n *\n * If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.\n *\n * To customize the preview, you can pass custom content as children.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview>\n * <Text>Custom Preview Content</Text>\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview />\n * </Link>\n * ```\n *\n * **Note:** You can use the alias `Link.Preview` for this component.\n *\n * @platform ios\n */\nexport function LinkPreview(props: LinkPreviewProps) {\n const { width, height, children } = props;\n const internalPreviewContext = use(InternalLinkPreviewContext);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !internalPreviewContext) {\n return null;\n }\n const { isVisible, href } = internalPreviewContext;\n const contentSize = {\n width: width ?? 0,\n height: height ?? 0,\n };\n let content: React.ReactNode;\n if (children) {\n content = isVisible ? children : null;\n } else {\n content = isVisible ? <HrefPreview href={href} /> : null;\n }\n\n return (\n <NativeLinkPreviewContent\n style={{\n /* Setting default background here, so that the preview is not transparent */\n backgroundColor: '#fff',\n }}\n preferredContentSize={contentSize}>\n {content}\n </NativeLinkPreviewContent>\n );\n}\n\nexport type LinkTriggerProps = PropsWithChildren;\n\n/**\n * Serves as the trigger for a link.\n * The content inside this component will be rendered as part of the base link.\n *\n * If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Trigger>\n * Trigger\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * **Note:** You can use the alias `Link.Trigger` for this component.\n *\n * @platform ios\n */\nexport function LinkTrigger(props: LinkTriggerProps) {\n if (React.Children.count(props.children) > 1 || !isValidElement(props.children)) {\n // If onPress is passed, this means that Link passed props to this component.\n // We can assume that asChild is used, so we throw an error, because link will not work in this case.\n if (props && typeof props === 'object' && 'onPress' in props) {\n throw new Error(\n 'When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.'\n );\n }\n return props.children;\n }\n return <Slot {...props} />;\n}\n"]}
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDb,wCAYC;AAqHD,kCA4BC;AA+BD,kCAYC;AA9PD,+CAA8F;AAG9F,6EAA0E;AAC1E,uDAAoD;AACpD,uEAA6D;AAC7D,6CAAqF;AACrF,qCAAkC;AAuClC;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,IAAA,WAAG,EAAC,uDAA0B,CAAC,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,IAAI,EAA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CAAC;IACD,OAAO,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7B,CAAC","sourcesContent":["'use client';\n\nimport React, { isValidElement, use, type PropsWithChildren, type ReactElement } from 'react';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { HrefPreview } from './preview/HrefPreview';\nimport { useIsPreview } from './preview/PreviewRouteContext';\nimport { NativeLinkPreviewAction, NativeLinkPreviewContent } from './preview/native';\nimport { Slot } from '../ui/Slot';\n\nexport interface LinkMenuActionProps {\n /**\n * The title of the menu item.\n */\n title: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress: () => void;\n}\n\n/**\n * This component renders a context menu action for a link.\n * It should only be used as a child of `Link.Menu` or `LinkMenu`.\n *\n * > **Note**: You can use the alias `Link.MenuAction` for this component.\n *\n * @platform ios\n */\nexport function LinkMenuAction(props: LinkMenuActionProps) {\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const { unstable_keepPresented, onPress, ...rest } = props;\n return (\n <NativeLinkPreviewAction\n {...rest}\n onSelected={onPress}\n keepPresented={unstable_keepPresented}\n />\n );\n}\n\nexport interface LinkMenuProps {\n /**\n * The title of the menu item\n */\n title?: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: string;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n displayAsPalette?: boolean;\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n displayInline?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.\n */\n destructive?: boolean;\n children: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];\n}\n\n/**\n * Groups context menu actions for a link.\n *\n * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.\n * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.\n *\n * @example\n * ```tsx\n * <Link.Menu>\n * <Link.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Link.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Link.Menu>\n * ```\n *\n * > **Note**: You can use the alias `Link.Menu` for this component.\n *\n * @platform ios\n */\nexport const LinkMenu: React.FC<LinkMenuProps> = (props) => {\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const children = React.Children.toArray(props.children).filter(\n (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)\n );\n return (\n <NativeLinkPreviewAction\n {...props}\n title={props.title ?? ''}\n onSelected={() => {}}\n children={children}\n />\n );\n};\n\nexport interface LinkPreviewProps {\n /**\n * Sets the preferred width of the preview.\n * If not set, full width of the screen will be used.\n *\n * This is only **preferred** width, the actual width may be different\n */\n width?: number;\n\n /**\n * Sets the preferred height of the preview.\n * If not set, full height of the screen will be used.\n *\n * This is only **preferred** height, the actual height may be different\n */\n height?: number;\n children?: React.ReactNode;\n}\n\n/**\n * A component used to render and customize the link preview.\n *\n * If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.\n *\n * If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.\n *\n * To customize the preview, you can pass custom content as children.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview>\n * <Text>Custom Preview Content</Text>\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview />\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Preview` for this component.\n *\n * @platform ios\n */\nexport function LinkPreview(props: LinkPreviewProps) {\n const { width, height, children } = props;\n const internalPreviewContext = use(InternalLinkPreviewContext);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !internalPreviewContext) {\n return null;\n }\n const { isVisible, href } = internalPreviewContext;\n const contentSize = {\n width: width ?? 0,\n height: height ?? 0,\n };\n let content: React.ReactNode;\n if (children) {\n content = isVisible ? children : null;\n } else {\n content = isVisible ? <HrefPreview href={href} /> : null;\n }\n\n return (\n <NativeLinkPreviewContent\n style={{\n /* Setting default background here, so that the preview is not transparent */\n backgroundColor: '#fff',\n }}\n preferredContentSize={contentSize}>\n {content}\n </NativeLinkPreviewContent>\n );\n}\n\nexport interface LinkTriggerProps extends PropsWithChildren {\n /**\n * Sets the corner radius of the highlight — the element that appears during a long press,\n * before the preview shows, and beside the context menu if no preview is displayed.\n *\n * @platform ios\n */\n highlightBorderRadius?: number;\n}\n\n/**\n * Serves as the trigger for a link.\n * The content inside this component will be rendered as part of the base link.\n *\n * If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Trigger>\n * Trigger\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Trigger` for this component.\n *\n * @platform ios\n */\nexport function LinkTrigger(props: LinkTriggerProps) {\n if (React.Children.count(props.children) > 1 || !isValidElement(props.children)) {\n // If onPress is passed, this means that Link passed props to this component.\n // We can assume that asChild is used, so we throw an error, because link will not work in this case.\n if (props && typeof props === 'object' && 'onPress' in props) {\n throw new Error(\n 'When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.'\n );\n }\n return props.children;\n }\n return <Slot {...props} />;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"HrefPreview.d.ts","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,IAAI,EAAuB,MAAM,aAAa,CAAC;AAKxD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,+BAyBnD"}
1
+ {"version":3,"file":"HrefPreview.d.ts","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,IAAI,EAAuB,MAAM,aAAa,CAAC;AAKxD,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,+BAyCnD"}
@@ -16,11 +16,29 @@ const linking_1 = require("../linking");
16
16
  function HrefPreview({ href }) {
17
17
  const hrefState = (0, react_1.useMemo)(() => getHrefState(href), [href]);
18
18
  const index = hrefState?.index ?? 0;
19
+ let isProtected = false;
19
20
  if (hrefState?.routes[index]?.name === constants_1.INTERNAL_SLOT_NAME) {
20
- return <PreviewForRootHrefState hrefState={hrefState} href={href}/>;
21
+ let routerState = hrefState;
22
+ let rnState = router_store_1.store.state;
23
+ while (routerState && rnState) {
24
+ const routerRoute = routerState.routes[0];
25
+ // When the route we want to show is not present in react-navigation state
26
+ // Then most likely it is a protected route
27
+ if (rnState.stale === false && !rnState.routeNames?.includes(routerRoute.name)) {
28
+ isProtected = true;
29
+ break;
30
+ }
31
+ const rnIndex = rnState.routes.findIndex((route) => route.name === routerRoute.name);
32
+ if (rnIndex === -1) {
33
+ break;
34
+ }
35
+ routerState = routerRoute.state;
36
+ rnState = rnState.routes[rnIndex]?.state;
37
+ }
38
+ if (!isProtected) {
39
+ return <PreviewForRootHrefState hrefState={hrefState} href={href}/>;
40
+ }
21
41
  }
22
- const isInternalRoute = hrefState?.routes[index]?.name === constants_1.NOT_FOUND_ROUTE_NAME ||
23
- hrefState?.routes[index]?.name === constants_1.SITEMAP_ROUTE_NAME;
24
42
  const pathname = href.toString();
25
43
  const segments = pathname.split('/').filter(Boolean);
26
44
  return (<PreviewRouteContext_1.PreviewRouteContext.Provider value={{
@@ -28,7 +46,7 @@ function HrefPreview({ href }) {
28
46
  pathname,
29
47
  segments,
30
48
  }}>
31
- {isInternalRoute ? <PreviewForInternalRoutes /> : null}
49
+ <PreviewForInternalRoutes />
32
50
  </PreviewRouteContext_1.PreviewRouteContext.Provider>);
33
51
  }
34
52
  function PreviewForRootHrefState({ hrefState, href }) {
@@ -1 +1 @@
1
- {"version":3,"file":"HrefPreview.js","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAsBb,kCAyBC;AA7CD,qDAIkC;AAClC,iCAAgC;AAChC,+CAA0C;AAE1C,+DAA4D;AAE5D,+CAA+F;AAE/F,kEAAwD;AACxD,oDAAkE;AAClE,uCAA0C;AAE1C,uDAAoD;AACpD,iDAA8D;AAC9D,wCAA8C;AAE9C,SAAgB,WAAW,CAAC,EAAE,IAAI,EAAkB;IAClD,MAAM,SAAS,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,SAAS,EAAE,KAAK,IAAI,CAAC,CAAC;IAEpC,IAAI,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,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qBAAqB,CAAC,KAAK,CAAC;IACjC,QAAQ,EAAE,qBAAqB,CAAC,UAAU,CAAC;IAC3C,kBAAkB,EAAE,qBAAqB,CAAC,oBAAoB,CAAC;IAC/D,OAAO,EAAE,qBAAqB,CAAC,SAAS,CAAC;IACzC,KAAK,EAAE,GAAG,EAAE;QACV,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,mBAAmB;IACnB,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAC7C,QAAQ,EAAE,GAAG,EAAE;QACb,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO;YACL,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;YACR,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["'use client';\n\nimport {\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n} from '@react-navigation/native';\nimport { useMemo } from 'react';\nimport { Text, View } from 'react-native';\n\nimport { PreviewRouteContext } from './PreviewRouteContext';\nimport { RouteNode } from '../../Route';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../../constants';\nimport { type ResultState } from '../../exports';\nimport { store } from '../../global-state/router-store';\nimport { getRootStackRouteNames } from '../../global-state/utils';\nimport { usePathname } from '../../hooks';\nimport { Href, UnknownOutputParams } from '../../types';\nimport { useNavigation } from '../../useNavigation';\nimport { getQualifiedRouteComponent } from '../../useScreens';\nimport { getPathFromState } from '../linking';\n\nexport function HrefPreview({ href }: { href: Href }) {\n const hrefState = useMemo(() => getHrefState(href), [href]);\n const index = hrefState?.index ?? 0;\n\n if (hrefState?.routes[index]?.name === INTERNAL_SLOT_NAME) {\n return <PreviewForRootHrefState hrefState={hrefState} href={href} />;\n }\n\n const isInternalRoute =\n hrefState?.routes[index]?.name === NOT_FOUND_ROUTE_NAME ||\n hrefState?.routes[index]?.name === SITEMAP_ROUTE_NAME;\n\n const pathname = href.toString();\n const segments = pathname.split('/').filter(Boolean);\n\n return (\n <PreviewRouteContext.Provider\n value={{\n params: {},\n pathname,\n segments,\n }}>\n {isInternalRoute ? <PreviewForInternalRoutes /> : null}\n </PreviewRouteContext.Provider>\n );\n}\n\nfunction PreviewForRootHrefState({ hrefState, href }: { hrefState: ResultState; href: Href }) {\n const navigation = useNavigation();\n const { routeNode, params, state } = getParamsAndNodeFromHref(hrefState);\n\n const path = state ? getPathFromState(state) : undefined;\n\n const value = useMemo(\n () => ({\n params,\n pathname: href.toString(),\n segments: path?.split('/').filter(Boolean) || [],\n }),\n [params, href]\n );\n\n // This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.\n // This check ensures TypeScript type safety as well.\n if (!routeNode) {\n return null;\n }\n\n const Component = getQualifiedRouteComponent(routeNode);\n\n return (\n <PreviewRouteContext value={value}>\n {/* Using NavigationContext to override useNavigation */}\n <NavigationContext value={navigationPropWithWarnings}>\n <Component navigation={navigation} />\n </NavigationContext>\n </PreviewRouteContext>\n );\n}\n\nfunction PreviewForInternalRoutes() {\n const pathname = usePathname();\n return (\n <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', gap: 8 }}>\n <Text style={{ fontWeight: '600', fontSize: 24 }}>Invalid preview</Text>\n <Text style={{ fontWeight: '200', fontSize: 14 }}>{pathname}</Text>\n </View>\n );\n}\n\nfunction getHrefState(href: Href) {\n const hrefState = store.getStateForHref(href as any);\n return hrefState;\n}\n\nfunction getParamsAndNodeFromHref(hrefState: ResultState) {\n const index = hrefState?.index ?? 0;\n if (hrefState?.routes[index] && hrefState.routes[index].name !== INTERNAL_SLOT_NAME) {\n const name = hrefState.routes[index].name;\n if (name === SITEMAP_ROUTE_NAME || name === NOT_FOUND_ROUTE_NAME) {\n console.log(store.routeNode);\n console.log(hrefState);\n }\n const error = `Expo Router Error: Expected navigation state to begin with one of [${getRootStackRouteNames().join(', ')}] routes`;\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(error);\n } else {\n console.warn(error);\n }\n }\n const initialState = hrefState?.routes[index]?.state;\n let state = initialState;\n let routeNode: RouteNode | undefined | null = store.routeNode;\n\n const params: UnknownOutputParams = {};\n\n while (state && routeNode) {\n const route = state.routes[state.index || state.routes.length - 1];\n Object.assign(params, route.params);\n state = route.state;\n routeNode = routeNode.children.find((child) => child.route === route.name);\n }\n\n return { params, routeNode, state: initialState };\n}\n\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `navigation.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst navigationPropWithWarnings: NavigationProp<ParamListBase> = {\n setParams: createNOOPWithWarning('setParams'),\n setOptions: createNOOPWithWarning('setOptions'),\n addListener: (() => () => {}) as NavigationProp<ParamListBase>['addListener'],\n removeListener: () => {},\n isFocused: () => true,\n canGoBack: () => false,\n dispatch: createNOOPWithWarning('dispatch'),\n navigate: createNOOPWithWarning('navigate'),\n goBack: createNOOPWithWarning('goBack'),\n reset: createNOOPWithWarning('reset'),\n push: createNOOPWithWarning('push'),\n pop: createNOOPWithWarning('pop'),\n popToTop: createNOOPWithWarning('popToTop'),\n navigateDeprecated: createNOOPWithWarning('navigateDeprecated'),\n preload: createNOOPWithWarning('preload'),\n getId: () => {\n displayWarningForProp('getId');\n return '';\n },\n // @ts-expect-error\n getParent: createNOOPWithWarning('getParent'),\n getState: () => {\n displayWarningForProp('getState');\n return {\n key: '',\n index: 0,\n routeNames: [],\n routes: [],\n type: '',\n stale: false,\n };\n },\n};\n"]}
1
+ {"version":3,"file":"HrefPreview.js","sourceRoot":"","sources":["../../../src/link/preview/HrefPreview.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAsBb,kCAyCC;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AS,CAAC;IACzC,KAAK,EAAE,GAAG,EAAE;QACV,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,mBAAmB;IACnB,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC;IAC7C,QAAQ,EAAE,GAAG,EAAE;QACb,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO;YACL,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,CAAC;YACR,UAAU,EAAE,EAAE;YACd,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["'use client';\n\nimport {\n NavigationContext,\n type NavigationProp,\n type ParamListBase,\n} from '@react-navigation/native';\nimport { useMemo } from 'react';\nimport { Text, View } from 'react-native';\n\nimport { PreviewRouteContext } from './PreviewRouteContext';\nimport { RouteNode } from '../../Route';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../../constants';\nimport { type ResultState } from '../../exports';\nimport { store } from '../../global-state/router-store';\nimport { getRootStackRouteNames } from '../../global-state/utils';\nimport { usePathname } from '../../hooks';\nimport { Href, UnknownOutputParams } from '../../types';\nimport { useNavigation } from '../../useNavigation';\nimport { getQualifiedRouteComponent } from '../../useScreens';\nimport { getPathFromState } from '../linking';\n\nexport function HrefPreview({ href }: { href: Href }) {\n const hrefState = useMemo(() => getHrefState(href), [href]);\n const index = hrefState?.index ?? 0;\n\n let isProtected = false;\n if (hrefState?.routes[index]?.name === INTERNAL_SLOT_NAME) {\n let routerState: typeof hrefState | undefined = hrefState;\n let rnState = store.state;\n while (routerState && rnState) {\n const routerRoute: ResultState['routes'][number] = routerState.routes[0];\n // When the route we want to show is not present in react-navigation state\n // Then most likely it is a protected route\n if (rnState.stale === false && !rnState.routeNames?.includes(routerRoute.name)) {\n isProtected = true;\n break;\n }\n const rnIndex = rnState.routes.findIndex((route) => route.name === routerRoute.name);\n if (rnIndex === -1) {\n break;\n }\n routerState = routerRoute.state;\n rnState = rnState.routes[rnIndex]?.state;\n }\n if (!isProtected) {\n return <PreviewForRootHrefState hrefState={hrefState} href={href} />;\n }\n }\n\n const pathname = href.toString();\n const segments = pathname.split('/').filter(Boolean);\n\n return (\n <PreviewRouteContext.Provider\n value={{\n params: {},\n pathname,\n segments,\n }}>\n <PreviewForInternalRoutes />\n </PreviewRouteContext.Provider>\n );\n}\n\nfunction PreviewForRootHrefState({ hrefState, href }: { hrefState: ResultState; href: Href }) {\n const navigation = useNavigation();\n const { routeNode, params, state } = getParamsAndNodeFromHref(hrefState);\n\n const path = state ? getPathFromState(state) : undefined;\n\n const value = useMemo(\n () => ({\n params,\n pathname: href.toString(),\n segments: path?.split('/').filter(Boolean) || [],\n }),\n [params, href]\n );\n\n // This can happen in a theoretical case where the state is not yet initialized or is incorrectly initialized.\n // This check ensures TypeScript type safety as well.\n if (!routeNode) {\n return null;\n }\n\n const Component = getQualifiedRouteComponent(routeNode);\n\n return (\n <PreviewRouteContext value={value}>\n {/* Using NavigationContext to override useNavigation */}\n <NavigationContext value={navigationPropWithWarnings}>\n <Component navigation={navigation} />\n </NavigationContext>\n </PreviewRouteContext>\n );\n}\n\nfunction PreviewForInternalRoutes() {\n const pathname = usePathname();\n return (\n <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', gap: 8 }}>\n <Text style={{ fontWeight: '600', fontSize: 24 }}>Invalid preview</Text>\n <Text style={{ fontWeight: '200', fontSize: 14 }}>{pathname}</Text>\n </View>\n );\n}\n\nfunction getHrefState(href: Href) {\n const hrefState = store.getStateForHref(href as any);\n return hrefState;\n}\n\nfunction getParamsAndNodeFromHref(hrefState: ResultState) {\n const index = hrefState?.index ?? 0;\n if (hrefState?.routes[index] && hrefState.routes[index].name !== INTERNAL_SLOT_NAME) {\n const name = hrefState.routes[index].name;\n if (name === SITEMAP_ROUTE_NAME || name === NOT_FOUND_ROUTE_NAME) {\n console.log(store.routeNode);\n console.log(hrefState);\n }\n const error = `Expo Router Error: Expected navigation state to begin with one of [${getRootStackRouteNames().join(', ')}] routes`;\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(error);\n } else {\n console.warn(error);\n }\n }\n const initialState = hrefState?.routes[index]?.state;\n let state = initialState;\n let routeNode: RouteNode | undefined | null = store.routeNode;\n\n const params: UnknownOutputParams = {};\n\n while (state && routeNode) {\n const route = state.routes[state.index || state.routes.length - 1];\n Object.assign(params, route.params);\n state = route.state;\n routeNode = routeNode.children.find((child) => child.route === route.name);\n }\n\n return { params, routeNode, state: initialState };\n}\n\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `navigation.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst navigationPropWithWarnings: NavigationProp<ParamListBase> = {\n setParams: createNOOPWithWarning('setParams'),\n setOptions: createNOOPWithWarning('setOptions'),\n addListener: (() => () => {}) as NavigationProp<ParamListBase>['addListener'],\n removeListener: () => {},\n isFocused: () => true,\n canGoBack: () => false,\n dispatch: createNOOPWithWarning('dispatch'),\n navigate: createNOOPWithWarning('navigate'),\n goBack: createNOOPWithWarning('goBack'),\n reset: createNOOPWithWarning('reset'),\n push: createNOOPWithWarning('push'),\n pop: createNOOPWithWarning('pop'),\n popToTop: createNOOPWithWarning('popToTop'),\n navigateDeprecated: createNOOPWithWarning('navigateDeprecated'),\n preload: createNOOPWithWarning('preload'),\n getId: () => {\n displayWarningForProp('getId');\n return '';\n },\n // @ts-expect-error\n getParent: createNOOPWithWarning('getParent'),\n getState: () => {\n displayWarningForProp('getState');\n return {\n key: '',\n index: 0,\n routeNames: [],\n routes: [],\n type: '',\n stale: false,\n };\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useNextScreenId.d.ts","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,wBAAgB,eAAe,IAAI;IACjC;QAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE;IACxD,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;CACrB,CA0CA"}
1
+ {"version":3,"file":"useNextScreenId.d.ts","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,wBAAgB,eAAe,IAAI;IACjC;QAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,OAAO,EAAE,CAAA;KAAE;IACxD,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI;CACrB,CAyCA"}
@@ -19,7 +19,6 @@ function useNextScreenId() {
19
19
  if (currentHref.current && state) {
20
20
  const preloadedRoute = (0, utils_1.getPreloadedRouteFromRootStateByHref)(currentHref.current, state);
21
21
  const routeKey = preloadedRoute?.key;
22
- console.log('routeKey', routeKey);
23
22
  const tabPathFromRootState = (0, utils_1.getTabPathFromRootStateByHref)(currentHref.current, state);
24
23
  // Without this timeout react-native does not have enough time to mount the new screen
25
24
  // and thus it will not be found on the native side
@@ -1 +1 @@
1
- {"version":3,"file":"useNextScreenId.js","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":";;AASA,0CA6CC;AAtDD,iCAAiE;AAEjE,6DAA6D;AAE7D,mCAA8F;AAC9F,kEAAwD;AACxD,uCAAwC;AAGxC,SAAgB,eAAe;IAI7B,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B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AE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAC1B,CAAC,IAAU,EAAQ,EAAE;QACnB,0CAA0C;QAC1C,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7B,CAAC,EACD,CAAC,MAAM,CAAC,QAAQ,CAAC,CAClB,CAAC;IACF,OAAO,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useLinkPreviewContext } from './LinkPreviewContext';\nimport { TabPath } from './native';\nimport { getPreloadedRouteFromRootStateByHref, getTabPathFromRootStateByHref } from './utils';\nimport { store } from '../../global-state/router-store';\nimport { useRouter } from '../../hooks';\nimport { Href } from '../../types';\n\nexport function useNextScreenId(): [\n { nextScreenId: string | undefined; tabPath: TabPath[] },\n (href: Href) => void,\n] {\n const router = useRouter();\n const { setOpenPreviewKey } = useLinkPreviewContext();\n const [internalNextScreenId, internalSetNextScreenId] = useState<string | undefined>();\n const currentHref = useRef<Href | undefined>(undefined);\n const [tabPath, setTabPath] = useState<TabPath[]>([]);\n\n useEffect(() => {\n // When screen is prefetched, then the root state is updated with the preloaded route.\n return store.navigationRef.addListener('state', ({ data: { state } }) => {\n // If we have the current href, it means that we prefetched the route\n if (currentHref.current && state) {\n const preloadedRoute = getPreloadedRouteFromRootStateByHref(currentHref.current, state);\n const routeKey = preloadedRoute?.key;\n console.log('routeKey', routeKey);\n const tabPathFromRootState = getTabPathFromRootStateByHref(currentHref.current, state);\n // Without this timeout react-native does not have enough time to mount the new screen\n // and thus it will not be found on the native side\n if (routeKey || tabPathFromRootState.length) {\n setTimeout(() => {\n internalSetNextScreenId(routeKey);\n setOpenPreviewKey(routeKey);\n setTabPath(tabPathFromRootState);\n });\n }\n // We got the preloaded state, so we can reset the currentHref\n // to prevent unnecessary processing\n currentHref.current = undefined;\n }\n });\n }, []);\n\n const prefetch = useCallback(\n (href: Href): void => {\n // Resetting the nextScreenId to undefined\n internalSetNextScreenId(undefined);\n router.prefetch(href);\n currentHref.current = href;\n },\n [router.prefetch]\n );\n return [{ nextScreenId: internalNextScreenId, tabPath }, prefetch];\n}\n"]}
1
+ {"version":3,"file":"useNextScreenId.js","sourceRoot":"","sources":["../../../src/link/preview/useNextScreenId.ts"],"names":[],"mappings":";;AASA,0CA4CC;AArDD,iCAAiE;AAEjE,6DAA6D;AAE7D,mCAA8F;AAC9F,kEAAwD;AACxD,uCAAwC;AAGxC,SAAgB,eAAe;IAI7B,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAA,0CAAqB,GAAE,CAAC;IACtD,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,IAAA,gBAAQ,GAAsB,CAAC;IACvF,MAAM,WAAW,GAAG,IAAA,cAAM,EAAmB,SAAS,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAY,EAAE,CAAC,CAAC;IAEtD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,sFAAsF;QACtF,OAAO,oBAAK,CAAC,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACtE,qEAAqE;YACrE,IAAI,WAAW,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC;gBACjC,MAAM,cAAc,GAAG,IAAA,4CAAoC,EAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBACxF,MAAM,QAAQ,GAAG,cAAc,EAAE,GAAG,CAAC;gBACrC,MAAM,oBAAoB,GAAG,IAAA,qCAA6B,EAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBACvF,sFAAsF;gBACtF,mDAAmD;gBACnD,IAAI,QAAQ,IAAI,oBAAoB,CAAC,MAAM,EAAE,CAAC;oBAC5C,UAAU,CAAC,GAAG,EAAE;wBACd,uBAAuB,CAAC,QAAQ,CAAC,CAAC;wBAClC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;wBAC5B,UAAU,CAAC,oBAAoB,CAAC,CAAC;oBACnC,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,8DAA8D;gBAC9D,oCAAoC;gBACpC,WAAW,CAAC,OAAO,GAAG,SAAS,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAC1B,CAAC,IAAU,EAAQ,EAAE;QACnB,0CAA0C;QAC1C,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;IAC7B,CAAC,EACD,CAAC,MAAM,CAAC,QAAQ,CAAC,CAClB,CAAC;IACF,OAAO,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACrE,CAAC","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useLinkPreviewContext } from './LinkPreviewContext';\nimport { TabPath } from './native';\nimport { getPreloadedRouteFromRootStateByHref, getTabPathFromRootStateByHref } from './utils';\nimport { store } from '../../global-state/router-store';\nimport { useRouter } from '../../hooks';\nimport { Href } from '../../types';\n\nexport function useNextScreenId(): [\n { nextScreenId: string | undefined; tabPath: TabPath[] },\n (href: Href) => void,\n] {\n const router = useRouter();\n const { setOpenPreviewKey } = useLinkPreviewContext();\n const [internalNextScreenId, internalSetNextScreenId] = useState<string | undefined>();\n const currentHref = useRef<Href | undefined>(undefined);\n const [tabPath, setTabPath] = useState<TabPath[]>([]);\n\n useEffect(() => {\n // When screen is prefetched, then the root state is updated with the preloaded route.\n return store.navigationRef.addListener('state', ({ data: { state } }) => {\n // If we have the current href, it means that we prefetched the route\n if (currentHref.current && state) {\n const preloadedRoute = getPreloadedRouteFromRootStateByHref(currentHref.current, state);\n const routeKey = preloadedRoute?.key;\n const tabPathFromRootState = getTabPathFromRootStateByHref(currentHref.current, state);\n // Without this timeout react-native does not have enough time to mount the new screen\n // and thus it will not be found on the native side\n if (routeKey || tabPathFromRootState.length) {\n setTimeout(() => {\n internalSetNextScreenId(routeKey);\n setOpenPreviewKey(routeKey);\n setTabPath(tabPathFromRootState);\n });\n }\n // We got the preloaded state, so we can reset the currentHref\n // to prevent unnecessary processing\n currentHref.current = undefined;\n }\n });\n }, []);\n\n const prefetch = useCallback(\n (href: Href): void => {\n // Resetting the nextScreenId to undefined\n internalSetNextScreenId(undefined);\n router.prefetch(href);\n currentHref.current = href;\n },\n [router.prefetch]\n );\n return [{ nextScreenId: internalNextScreenId, tabPath }, prefetch];\n}\n"]}
@@ -6,8 +6,8 @@ const native_1 = require("@react-navigation/native");
6
6
  const react_native_1 = require("react-native");
7
7
  const ModalComponent_1 = require("./ModalComponent");
8
8
  const utils_1 = require("./utils");
9
- const ModalStackRouteDrawer_web_1 = require("./web/ModalStackRouteDrawer.web");
10
- const TransparentModalStackRouteDrawer_web_1 = require("./web/TransparentModalStackRouteDrawer.web");
9
+ const ModalStackRouteDrawer_1 = require("./web/ModalStackRouteDrawer");
10
+ const TransparentModalStackRouteDrawer_1 = require("./web/TransparentModalStackRouteDrawer");
11
11
  const utils_2 = require("./web/utils");
12
12
  const ModalsRenderer = ({ children, modalConfigs, onDismissed, onShow, }) => {
13
13
  return (<div style={{ flex: 1, display: 'flex' }}>
@@ -21,8 +21,8 @@ function Modal({ config, onDismissed }) {
21
21
  const presentation = (0, utils_1.getStackPresentationType)(config);
22
22
  const isTransparentModal = (0, utils_2.isTransparentModalPresentation)({ presentation });
23
23
  const SelectedModalComponent = isTransparentModal
24
- ? TransparentModalStackRouteDrawer_web_1.TransparentModalStackRouteDrawer
25
- : ModalStackRouteDrawer_web_1.ModalStackRouteDrawer;
24
+ ? TransparentModalStackRouteDrawer_1.TransparentModalStackRouteDrawer
25
+ : ModalStackRouteDrawer_1.ModalStackRouteDrawer;
26
26
  return (<SelectedModalComponent routeKey={config.uniqueId} onDismiss={onDismissed} themeColors={colors} key={config.uniqueId} options={{
27
27
  presentation,
28
28
  animation: (0, utils_1.getStackAnimationType)(config),
@@ -1 +1 @@
1
- {"version":3,"file":"ModalsRenderer.web.js","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.web.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,qDAAoD;AACpD,+CAAoC;AAEpC,qDAAkD;AAElD,mCAA0E;AAC1E,+EAAwE;AACxE,qGAA8F;AAC9F,uCAA6D;AAEtD,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,MAAM,GACc,EAAE,EAAE;IACxB,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CACvC;MAAA,CAAC,QAAQ,CACT;MAAA,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,CAAC,KAAK,CACJ,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CACrB,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,WAAW,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAClD,CACH,CAAC,CACJ;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,cAAc,kBAkBzB;AAOF,SAAS,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,EAAc;IAChD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,iBAAQ,GAAE,CAAC;IAE9B,MAAM,YAAY,GAAG,IAAA,gCAAwB,EAAC,MAAM,CAAC,CAAC;IACtD,MAAM,kBAAkB,GAAG,IAAA,sCAA8B,EAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IAE5E,MAAM,sBAAsB,GAAG,kBAAkB;QAC/C,CAAC,CAAC,uEAAgC;QAClC,CAAC,CAAC,iDAAqB,CAAC;IAE1B,OAAO,CACL,CAAC,sBAAsB,CACrB,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAC1B,SAAS,CAAC,CAAC,WAAW,CAAC,CACvB,WAAW,CAAC,CAAC,MAAM,CAAC,CACpB,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CACrB,OAAO,CAAC,CAAC;YACP,YAAY;YACZ,SAAS,EAAE,IAAA,6BAAqB,EAAC,MAAM,CAAC;YACxC,WAAW,EAAE,KAAK;YAClB,mBAAmB,EAAE,MAAM,CAAC,OAAO;SACpC,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,CAClB,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACvB;UAAA,CAAC,mBAAI,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CACxE;YAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;UAAA,EAAE,mBAAI,CACR;QAAA,EAAE,mBAAI,CAAC,CACR,CAAC,EACF,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useTheme } from '@react-navigation/native';\nimport { View } from 'react-native';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalConfig, ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\nimport { ModalStackRouteDrawer } from './web/ModalStackRouteDrawer.web';\nimport { TransparentModalStackRouteDrawer } from './web/TransparentModalStackRouteDrawer.web';\nimport { isTransparentModalPresentation } from './web/utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n return (\n <div style={{ flex: 1, display: 'flex' }}>\n {children}\n {modalConfigs.map((config) => (\n <Modal\n key={config.uniqueId}\n config={config}\n onDismissed={() => onDismissed?.(config.uniqueId)}\n />\n ))}\n </div>\n );\n};\n\ninterface ModalProps {\n config: ModalConfig;\n onDismissed: () => void;\n}\n\nfunction Modal({ config, onDismissed }: ModalProps) {\n const { colors } = useTheme();\n\n const presentation = getStackPresentationType(config);\n const isTransparentModal = isTransparentModalPresentation({ presentation });\n\n const SelectedModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n <SelectedModalComponent\n routeKey={config.uniqueId}\n onDismiss={onDismissed}\n themeColors={colors}\n key={config.uniqueId}\n options={{\n presentation,\n animation: getStackAnimationType(config),\n headerShown: false,\n sheetAllowedDetents: config.detents,\n }}\n renderScreen={() => (\n <View style={{ flex: 1 }}>\n <View {...config.viewProps} style={[{ flex: 1 }, config.viewProps?.style]}>\n <ModalComponent modalConfig={config} />\n </View>\n </View>\n )}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"ModalsRenderer.web.js","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.web.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,qDAAoD;AACpD,+CAAoC;AAEpC,qDAAkD;AAElD,mCAA0E;AAC1E,uEAAoE;AACpE,6FAA0F;AAC1F,uCAA6D;AAEtD,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,MAAM,GACc,EAAE,EAAE;IACxB,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CA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CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CACvB;UAAA,CAAC,mBAAI,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CACxE;YAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;UAAA,EAAE,mBAAI,CACR;QAAA,EAAE,mBAAI,CAAC,CACR,CAAC,EACF,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useTheme } from '@react-navigation/native';\nimport { View } from 'react-native';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalConfig, ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\nimport { ModalStackRouteDrawer } from './web/ModalStackRouteDrawer';\nimport { TransparentModalStackRouteDrawer } from './web/TransparentModalStackRouteDrawer';\nimport { isTransparentModalPresentation } from './web/utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n return (\n <div style={{ flex: 1, display: 'flex' }}>\n {children}\n {modalConfigs.map((config) => (\n <Modal\n key={config.uniqueId}\n config={config}\n onDismissed={() => onDismissed?.(config.uniqueId)}\n />\n ))}\n </div>\n );\n};\n\ninterface ModalProps {\n config: ModalConfig;\n onDismissed: () => void;\n}\n\nfunction Modal({ config, onDismissed }: ModalProps) {\n const { colors } = useTheme();\n\n const presentation = getStackPresentationType(config);\n const isTransparentModal = isTransparentModalPresentation({ presentation });\n\n const SelectedModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n <SelectedModalComponent\n routeKey={config.uniqueId}\n onDismiss={onDismissed}\n themeColors={colors}\n key={config.uniqueId}\n options={{\n presentation,\n animation: getStackAnimationType(config),\n headerShown: false,\n sheetAllowedDetents: config.detents,\n }}\n renderScreen={() => (\n <View style={{ flex: 1 }}>\n <View {...config.viewProps} style={[{ flex: 1 }, config.viewProps?.style]}>\n <ModalComponent modalConfig={config} />\n </View>\n </View>\n )}\n />\n );\n}\n"]}
@@ -22,4 +22,4 @@ declare const RouterModalScreen: (props: import("../..").ScreenProps<object, Rea
22
22
  stale: false;
23
23
  }>, import("@react-navigation/native").EventMapBase>) => null;
24
24
  export { RouterModal, RouterModalScreen };
25
- //# sourceMappingURL=ModalStack.web.d.ts.map
25
+ //# sourceMappingURL=ModalStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStack.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EAOd,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAsB,MAAM,OAAO,CAAC;AAgG3C,QAAA,MAAM,WAAW;;;;;;;;;;;CAAkD,CAAC;AACpE,QAAA,MAAM,iBAAiB;;;;;;;;6DAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
@@ -38,8 +38,8 @@ exports.RouterModalScreen = exports.RouterModal = void 0;
38
38
  const native_1 = require("@react-navigation/native");
39
39
  const native_stack_1 = require("@react-navigation/native-stack");
40
40
  const react_1 = __importStar(require("react"));
41
- const ModalStackRouteDrawer_web_1 = require("./ModalStackRouteDrawer.web");
42
- const TransparentModalStackRouteDrawer_web_1 = require("./TransparentModalStackRouteDrawer.web");
41
+ const ModalStackRouteDrawer_1 = require("./ModalStackRouteDrawer");
42
+ const TransparentModalStackRouteDrawer_1 = require("./TransparentModalStackRouteDrawer");
43
43
  const utils_1 = require("./utils");
44
44
  const withLayoutContext_1 = require("../../layouts/withLayoutContext");
45
45
  function ModalStackNavigator({ initialRouteName, children, screenOptions, }) {
@@ -72,8 +72,8 @@ const ModalStackView = ({ state, navigation, descriptors, describe }) => {
72
72
  overlayRoutes.map((route) => {
73
73
  const isTransparentModal = (0, utils_1.isTransparentModalPresentation)(descriptors[route.key].options);
74
74
  const ModalComponent = isTransparentModal
75
- ? TransparentModalStackRouteDrawer_web_1.TransparentModalStackRouteDrawer
76
- : ModalStackRouteDrawer_web_1.ModalStackRouteDrawer;
75
+ ? TransparentModalStackRouteDrawer_1.TransparentModalStackRouteDrawer
76
+ : ModalStackRouteDrawer_1.ModalStackRouteDrawer;
77
77
  return (<ModalComponent key={route.key} routeKey={route.key} options={descriptors[route.key].options} renderScreen={descriptors[route.key].render} onDismiss={dismiss} themeColors={colors}/>);
78
78
  })}
79
79
  </div>);
@@ -83,4 +83,4 @@ const RouterModal = (0, withLayoutContext_1.withLayoutContext)(createModalStack(
83
83
  exports.RouterModal = RouterModal;
84
84
  const RouterModalScreen = RouterModal.Screen;
85
85
  exports.RouterModalScreen = RouterModalScreen;
86
- //# sourceMappingURL=ModalStack.web.js.map
86
+ //# sourceMappingURL=ModalStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStack.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACb,qDASkC;AAClC,iEAIwC;AACxC,+CAA2C;AAE3C,mEAAgE;AAChE,yFAAsF;AAEtF,mCAIiB;AAEjB,uEAAoE;AAEpE,SAAS,mBAAmB,CAAC,EAC3B,gBAAgB,EAChB,QAAQ,EACR,aAAa,GACY;IACzB,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,GAAG,IAAA,6BAAoB,EAM1F,oBAAW,EAAE;QACb,QAAQ;QACR,aAAa;QACb,gBAAgB;KACjB,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,iBAAiB,CAChB;MAAA,CAAC,cAAc,CACb,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,UAAU,CAAC,CAAC,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d,KAAK,CAAC,CAAC,aAAa,CAAC,CACrB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAErB;MAAA,CAAC,KAAK;YACJ,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC1B,MAAM,kBAAkB,GAAG,IAAA,sCAA8B,EAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;gBAE1F,MAAM,cAAc,GAAG,kBAAkB;oBACvC,CAAC,CAAC,mEAAgC;oBAClC,CAAC,CAAC,6CAAqB,CAAC;gBAE1B,OAAO,CACL,CAAC,cAAc,CACb,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CACf,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CACpB,OAAO,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAyC,CAAC,CAC1E,YAAY,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAC5C,SAAS,CAAC,CAAC,OAAO,CAAC,CACnB,WAAW,CAAC,CAAC,MAAM,CAAC,EACpB,CACH,CAAC;YACJ,CAAC,CAAC,CACN;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AACrE,MAAM,WAAW,GAAG,IAAA,qCAAiB,EAAC,gBAAgB,EAAE,CAAC,SAAS,CAAC,CAAC;AAG3D,kCAAW;AAFpB,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAC;AAEvB,8CAAiB","sourcesContent":["'use client';\nimport {\n createNavigatorFactory,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouter,\n StackRouterOptions,\n useNavigationBuilder,\n useTheme,\n} from '@react-navigation/native';\nimport {\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n NativeStackView,\n} from '@react-navigation/native-stack';\nimport React, { useCallback } from 'react';\n\nimport { ModalStackRouteDrawer } from './ModalStackRouteDrawer';\nimport { TransparentModalStackRouteDrawer } from './TransparentModalStackRouteDrawer';\nimport { ModalStackNavigatorProps, ModalStackViewProps } from './types';\nimport {\n convertStackStateToNonModalState,\n findLastNonModalIndex,\n isTransparentModalPresentation,\n} from './utils';\nimport { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\nimport { withLayoutContext } from '../../layouts/withLayoutContext';\n\nfunction ModalStackNavigator({\n initialRouteName,\n children,\n screenOptions,\n}: ModalStackNavigatorProps) {\n const { state, navigation, descriptors, NavigationContent, describe } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptions,\n NativeStackNavigationEventMap\n >(StackRouter, {\n children,\n screenOptions,\n initialRouteName,\n });\n\n return (\n <NavigationContent>\n <ModalStackView\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n </NavigationContent>\n );\n}\n\nconst ModalStackView = ({ state, navigation, descriptors, describe }: ModalStackViewProps) => {\n const isWeb = process.env.EXPO_OS === 'web';\n const { colors } = useTheme();\n\n const { routes: filteredRoutes, index: nonModalIndex } = convertStackStateToNonModalState(\n state,\n descriptors,\n isWeb\n );\n\n const newStackState = { ...state, routes: filteredRoutes, index: nonModalIndex };\n\n const dismiss = useCallback(() => {\n navigation.goBack();\n }, [navigation]);\n\n const overlayRoutes = React.useMemo(() => {\n if (!isWeb) return [];\n const idx = findLastNonModalIndex(state, descriptors);\n return state.routes.slice(idx + 1);\n }, [isWeb, state, descriptors]);\n\n return (\n <div style={{ flex: 1, display: 'flex' }}>\n <NativeStackView\n state={newStackState}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n {isWeb &&\n overlayRoutes.map((route) => {\n const isTransparentModal = isTransparentModalPresentation(descriptors[route.key].options);\n\n const ModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n <ModalComponent\n key={route.key}\n routeKey={route.key}\n options={descriptors[route.key].options as ExtendedStackNavigationOptions}\n renderScreen={descriptors[route.key].render}\n onDismiss={dismiss}\n themeColors={colors}\n />\n );\n })}\n </div>\n );\n};\n\nconst createModalStack = createNavigatorFactory(ModalStackNavigator);\nconst RouterModal = withLayoutContext(createModalStack().Navigator);\nconst RouterModalScreen = RouterModal.Screen;\n\nexport { RouterModal, RouterModalScreen };\n"]}
@@ -11,4 +11,4 @@ declare function ModalStackRouteDrawer({ routeKey, options, renderScreen, onDism
11
11
  };
12
12
  }): React.JSX.Element;
13
13
  export { ModalStackRouteDrawer };
14
- //# sourceMappingURL=ModalStackRouteDrawer.web.d.ts.map
14
+ //# sourceMappingURL=ModalStackRouteDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStackRouteDrawer.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E,iBAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,8BAA8B,CAAC;IACxC,YAAY,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD,qBAsMA;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -160,4 +160,4 @@ function ModalStackRouteDrawer({ routeKey, options, renderScreen, onDismiss, the
160
160
  </vaul_1.Drawer.Portal>
161
161
  </vaul_1.Drawer.Root>);
162
162
  }
163
- //# sourceMappingURL=ModalStackRouteDrawer.web.js.map
163
+ //# sourceMappingURL=ModalStackRouteDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModalStackRouteDrawer.js","sourceRoot":"","sources":["../../../src/modal/web/ModalStackRouteDrawer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AA6NJ,sDAAqB;AA5N9B,kDAA0B;AAC1B,+BAA8B;AAE9B,gEAAwC;AAExC,mCAAuC;AAGvC,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GAOZ;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,4EAA4E;IAC5E,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,SAAS,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,OAAO,GAAG,CAAC,SAAS,CAAC;IAE3B,6BAA6B;IAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAE5C,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,mBAAmB,GAAG,cAAc,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE1F,IAAI,UAAU,GAAoC,mBAAmB;QACnE,CAAC,CAAE,OAA+B;QAClC,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,eAAK,CAAC,QAAQ,CACpC,mBAAmB,IAAI,cAAc,CAA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ACrC,KAAK,CAAC,CAAC;YACL,aAAa,EAAE,MAAM;YACrB,uGAAuG;YACvG,GAAG,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SAC1D,CAAC,CACF;UAAA,CAAC,GAAG,CACF,SAAS,CAAC,CAAC,qBAAW,CAAC,KAAK,CAAC,CAC7B,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CACnD,KAAK,CAAC,CAAC,cAAc,CAAC,CACtB;YAAA,CAAC,oHAAoH,CACrH;YAAA,CAAC,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,MAAM,CAAC,EACzE;YAAA,CAAC,aAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,MAAM,CAAC,EAC3D;YAAA,CAAC,+BAA+B,CAChC;YAAA,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,CAC9D;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,aAAM,CAAC,OAAO,CAClB;MAAA,EAAE,aAAM,CAAC,MAAM,CACjB;IAAA,EAAE,aAAM,CAAC,IAAI,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\nimport { Drawer } from 'vaul';\n\nimport modalStyles from './modalStyles';\nimport { CSSWithVars } from './types';\nimport { useIsDesktop } from './utils';\nimport { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\n\nfunction ModalStackRouteDrawer({\n routeKey,\n options,\n renderScreen,\n onDismiss,\n themeColors,\n}: {\n routeKey: string;\n options: ExtendedStackNavigationOptions;\n renderScreen: () => React.ReactNode;\n onDismiss: () => void;\n themeColors: { card: string; background: string };\n}) {\n const [open, setOpen] = React.useState(true);\n // Determine sheet vs. modal with an SSR-safe hook. The first render (during\n // hydration) always assumes mobile/sheet to match the server markup; an\n // effect then updates the state after mount if the viewport is desktop.\n const isDesktop = useIsDesktop();\n const isSheet = !isDesktop;\n\n // Resolve snap points logic.\n const allowed = options.sheetAllowedDetents;\n\n const isArrayDetents = Array.isArray(allowed);\n const useCustomSnapPoints = isArrayDetents && !(allowed.length === 1 && allowed[0] === 1);\n\n let snapPoints: (number | string)[] | undefined = useCustomSnapPoints\n ? (allowed as (number | string)[])\n : undefined;\n\n if (!isSheet) {\n snapPoints = [1];\n }\n\n const [snap, setSnap] = React.useState<number | string | null>(\n useCustomSnapPoints && isArrayDetents ? allowed[0] : 1\n );\n\n // Update the snap value when custom snap points change.\n React.useEffect(() => {\n if (isSheet) {\n const next = useCustomSnapPoints && isArrayDetents ? allowed[0] : 1;\n setSnap(next);\n } else {\n // Desktop modal always fixed snap at 1\n setSnap(1);\n }\n }, [isSheet, useCustomSnapPoints, isArrayDetents, allowed]);\n\n // Map react-native-screens ios sheet undimmed logic to Vaul's fadeFromIndex\n const fadeFromIndex = isSheet\n ? options.sheetLargestUndimmedDetentIndex === 'last'\n ? (snapPoints?.length ?? 0)\n : typeof options.sheetLargestUndimmedDetentIndex === 'number'\n ? options.sheetLargestUndimmedDetentIndex + 1\n : 0\n : 0;\n\n // --- Styling -----------------------------------------------------------\n\n // Using CSS variables so defaults live in CSS and can be overridden via props.\n const modalStyleVars: CSSWithVars = {\n backgroundColor: themeColors.background,\n };\n\n if (!isSheet) {\n if (options.webModalStyle?.width) {\n modalStyleVars['--expo-router-modal-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n modalStyleVars['--expo-router-modal-max-width'] =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n\n // Also set explicit width so browsers that ignore CSS vars in `width` prop still work.\n modalStyleVars.width =\n typeof options.webModalStyle.width === 'number'\n ? `${options.webModalStyle.width}px`\n : options.webModalStyle.width;\n }\n\n // Min width override\n if (options.webModalStyle?.minWidth) {\n const mw =\n typeof options.webModalStyle.minWidth === 'number'\n ? `${options.webModalStyle.minWidth}px`\n : options.webModalStyle.minWidth;\n modalStyleVars['--expo-router-modal-min-width'] = mw;\n modalStyleVars.minWidth = mw;\n }\n\n if (options.webModalStyle?.height) {\n const h =\n typeof options.webModalStyle.height === 'number'\n ? `${options.webModalStyle.height}px`\n : options.webModalStyle.height;\n modalStyleVars['--expo-router-modal-height'] = h;\n modalStyleVars.maxHeight = h;\n modalStyleVars.height = h;\n modalStyleVars.minHeight = h;\n }\n\n // Separate min-height override (takes precedence over modalHeight)\n if (options.webModalStyle?.minHeight) {\n const mh =\n typeof options.webModalStyle.minHeight === 'number'\n ? `${options.webModalStyle.minHeight}px`\n : options.webModalStyle.minHeight;\n modalStyleVars['--expo-router-modal-min-height'] = mh;\n modalStyleVars.minHeight = mh;\n }\n }\n\n const fitToContents = options.sheetAllowedDetents === 'fitToContents';\n\n if (fitToContents) {\n modalStyleVars.height = 'auto';\n modalStyleVars.minHeight = 'auto';\n\n // TODO:(@Hirbod) Clarify if we should limit maxHeight to sheets only\n // Allow sheet to grow with content but never exceed viewport height\n // dvh is important, otherwise it will scale over the visible viewport height\n modalStyleVars.maxHeight = '100dvh';\n }\n\n // Apply corner radius (default 10px)\n const radiusValue = options.sheetCornerRadius ?? 10;\n const radiusCss = typeof radiusValue === 'number' ? `${radiusValue}px` : radiusValue;\n\n if (options.webModalStyle?.border) {\n modalStyleVars['--expo-router-modal-border'] = options.webModalStyle.border;\n }\n\n if (isSheet) {\n // Only top corners for mobile sheet\n modalStyleVars.borderTopLeftRadius = radiusCss;\n modalStyleVars.borderTopRightRadius = radiusCss;\n\n // Only apply CSS var override if a custom corner radius was provided\n if (options.sheetCornerRadius) {\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n }\n } else {\n // All corners for desktop modal\n if (options.sheetCornerRadius) {\n modalStyleVars['--expo-router-modal-border-radius'] = radiusCss;\n }\n }\n // --- End Styling -----------------------------------------------------------\n\n const handleOpenChange = (open: boolean) => {\n if (!open) onDismiss();\n };\n\n // Props that only make sense for sheets\n const sheetProps = isSheet\n ? {\n snapPoints: snapPoints as (number | string)[],\n activeSnapPoint: snap,\n setActiveSnapPoint: setSnap,\n fadeFromIndex,\n }\n : {};\n\n return (\n <Drawer.Root\n key={`${routeKey}-${isSheet ? 'sheet' : 'modal'}`}\n open={open}\n dismissible={options.gestureEnabled ?? true}\n onAnimationEnd={handleOpenChange}\n shouldScaleBackground\n autoFocus\n onOpenChange={setOpen}\n {...sheetProps}>\n <Drawer.Portal>\n <Drawer.Overlay\n className={modalStyles.overlay}\n style={\n options.webModalStyle?.overlayBackground\n ? ({\n '--expo-router-modal-overlay-background': options.webModalStyle.overlayBackground,\n } as React.CSSProperties)\n : undefined\n }\n />\n <Drawer.Content\n aria-describedby=\"modal-description\"\n className={modalStyles.drawerContent}\n style={{\n pointerEvents: 'none',\n // This needs to be limited to sheets, otherwise it will position the modal at the bottom of the screen\n ...(isSheet && fitToContents ? { height: 'auto' } : null),\n }}>\n <div\n className={modalStyles.modal}\n data-presentation={isSheet ? 'formSheet' : 'modal'}\n style={modalStyleVars}>\n {/* TODO:(@Hirbod) Figure out how to add title and description to the modal for screen readers in a meaningful way */}\n <Drawer.Title about=\"\" aria-describedby=\"\" className={modalStyles.srOnly} />\n <Drawer.Description about=\"\" className={modalStyles.srOnly} />\n {/* Render the screen content */}\n <div className={modalStyles.modalBody}>{renderScreen()}</div>\n </div>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n );\n}\n\nexport { ModalStackRouteDrawer };\n"]}
@@ -7,4 +7,4 @@ declare function TransparentModalStackRouteDrawer({ routeKey, options, renderScr
7
7
  onDismiss: () => void;
8
8
  }): React.JSX.Element;
9
9
  export { TransparentModalStackRouteDrawer };
10
- //# sourceMappingURL=TransparentModalStackRouteDrawer.web.d.ts.map
10
+ //# sourceMappingURL=TransparentModalStackRouteDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransparentModalStackRouteDrawer.d.ts","sourceRoot":"","sources":["../../../src/modal/web/TransparentModalStackRouteDrawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E,iBAAS,gCAAgC,CAAC,EACxC,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,8BAA8B,CAAC;IACxC,YAAY,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,qBAuBA;AAED,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
@@ -25,4 +25,4 @@ function TransparentModalStackRouteDrawer({ routeKey, options, renderScreen, onD
25
25
  </vaul_1.Drawer.Portal>
26
26
  </vaul_1.Drawer.Root>);
27
27
  }
28
- //# sourceMappingURL=TransparentModalStackRouteDrawer.web.js.map
28
+ //# sourceMappingURL=TransparentModalStackRouteDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransparentModalStackRouteDrawer.js","sourceRoot":"","sources":["../../../src/modal/web/TransparentModalStackRouteDrawer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AA0CJ,4EAAgC;AAzCzC,kDAA0B;AAC1B,+BAA8B;AAE9B,gEAAwC;AAGxC,SAAS,gCAAgC,CAAC,EACxC,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,GAMV;IACC,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAE,EAAE;QACzC,IAAI,CAAC,IAAI;YAAE,SAAS,EAAE,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,aAAM,CAAC,IAAI,CACV,WAAW,CACX,SAAS,CACT,GAAG,CAAC,CAAC,GAAG,QAAQ,cAAc,CAAC,CAC/B,WAAW,CAAC,CAAC,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC,CAC7C,cAAc,CAAC,CAAC,gBAAgB,CAAC,CACjC;MAAA,CAAC,aAAM,CAAC,MAAM,CACZ;QAAA,CAAC,aAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,wBAAwB,CAAC,CAC9D;UAAA,CAAC,oHAAoH,CACrH;UAAA,CAAC,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,MAAM,CAAC,EACzE;UAAA,CAAC,aAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,MAAM,CAAC,EAC3D;UAAA,CAAC,+BAA+B,CAChC;UAAA,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,qBAAW,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,CAC9D;QAAA,EAAE,aAAM,CAAC,OAAO,CAClB;MAAA,EAAE,aAAM,CAAC,MAAM,CACjB;IAAA,EAAE,aAAM,CAAC,IAAI,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport React from 'react';\nimport { Drawer } from 'vaul';\n\nimport modalStyles from './modalStyles';\nimport { ExtendedStackNavigationOptions } from '../../layouts/StackClient';\n\nfunction TransparentModalStackRouteDrawer({\n routeKey,\n options,\n renderScreen,\n onDismiss,\n}: {\n routeKey: string;\n options: ExtendedStackNavigationOptions;\n renderScreen: () => React.ReactNode;\n onDismiss: () => void;\n}) {\n const handleOpenChange = (open: boolean) => {\n if (!open) onDismiss();\n };\n\n return (\n <Drawer.Root\n defaultOpen\n autoFocus\n key={`${routeKey}-transparent`}\n dismissible={options.gestureEnabled ?? false}\n onAnimationEnd={handleOpenChange}>\n <Drawer.Portal>\n <Drawer.Content className={modalStyles.transparentDrawerContent}>\n {/* TODO:(@Hirbod) Figure out how to add title and description to the modal for screen readers in a meaningful way */}\n <Drawer.Title about=\"\" aria-describedby=\"\" className={modalStyles.srOnly} />\n <Drawer.Description about=\"\" className={modalStyles.srOnly} />\n {/* Render the screen content */}\n <div className={modalStyles.modalBody}>{renderScreen()}</div>\n </Drawer.Content>\n </Drawer.Portal>\n </Drawer.Root>\n );\n}\n\nexport { TransparentModalStackRouteDrawer };\n"]}
@@ -1,16 +1,8 @@
1
1
  import { ParamListBase, type EventMapBase } from '@react-navigation/native';
2
- import React, { PropsWithChildren } from 'react';
3
- import { NativeTabOptions, type NativeTabsViewProps } from './NativeTabsView';
4
- export interface NativeTabsNavigatorProps extends PropsWithChildren<Omit<NativeTabsViewProps, 'builder'>> {
5
- /**
6
- * The behavior when navigating back with the back button.
7
- *
8
- * @platform android
9
- */
10
- backBehavior?: 'none' | 'initialRoute' | 'history';
11
- }
12
- export declare function NativeTabsNavigator({ children, backBehavior, ...rest }: NativeTabsNavigatorProps): React.JSX.Element;
13
- export declare const NativeTabsNavigatorWithContext: React.ForwardRefExoticComponent<Omit<NativeTabsNavigatorProps, "children"> & Partial<Pick<NativeTabsNavigatorProps, "children">> & React.RefAttributes<unknown>> & {
2
+ import React from 'react';
3
+ import type { NativeTabOptions, NativeTabsProps } from './types';
4
+ export declare function NativeTabsNavigator({ children, backBehavior, ...rest }: NativeTabsProps): React.JSX.Element;
5
+ export declare const NativeTabsNavigatorWithContext: React.ForwardRefExoticComponent<Omit<NativeTabsProps, "children"> & Partial<Pick<NativeTabsProps, "children">> & React.RefAttributes<unknown>> & {
14
6
  Screen: (props: import("../..").ScreenProps<NativeTabOptions, Readonly<{
15
7
  key: string;
16
8
  index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,aAAa,EAIb,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,gBAAgB,EAAkB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG9F,MAAM,WAAW,wBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAC/D;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;CACpD;AAKD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,GAAG,IAAI,EACR,EAAE,wBAAwB,qBAa1B;AAID,eAAO,MAAM,8BAA8B;;;;;;;;;;;CAOzC,CAAC"}
1
+ {"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,aAAa,EAIb,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKjE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,GAAG,IAAI,EACR,EAAE,eAAe,qBAajB;AAID,eAAO,MAAM,8BAA8B;;;;;;;;;;;CAOzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeBottomTabsNavigator.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;AA8Bb,kDAiBC;AA7CD,qDAQkC;AAClC,kDAAiD;AAEjD,qEAAkE;AAClE,qDAA8F;AAC9F,6BAA0C;AAY1C,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C,SAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,GAAG,mBAAmB,EAClC,GAAG,IAAI,EACkB;IACzB,MAAM,OAAO,GAAG,IAAA,6BAAoB,EAMlC,+CAAsB,EAAE;QACxB,QAAQ;QACR,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,CAAC,+BAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,EAAG,CAAC;AACxD,CAAC;AAED,MAAM,wBAAwB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AAEhE,QAAA,8BAA8B,GAAG,IAAA,qBAAiB,EAK7D,wBAAwB,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;IAClD,OAAO,OAAO,CAAC;AACjB,CAAC,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, { PropsWithChildren } from 'react';\n\nimport { NativeBottomTabsRouter } from './NativeBottomTabsRouter';\nimport { NativeTabOptions, NativeTabsView, type NativeTabsViewProps } from './NativeTabsView';\nimport { withLayoutContext } from '../..';\n\nexport interface NativeTabsNavigatorProps\n extends PropsWithChildren<Omit<NativeTabsViewProps, 'builder'>> {\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n}\n\n// In Jetpack Compose, the default back behavior is to go back to the initial route.\nconst defaultBackBehavior = 'initialRoute';\n\nexport function NativeTabsNavigator({\n children,\n backBehavior = defaultBackBehavior,\n ...rest\n}: NativeTabsNavigatorProps) {\n const builder = 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 });\n\n return <NativeTabsView builder={builder} {...rest} />;\n}\n\nconst createNativeTabNavigator = createNavigatorFactory(NativeTabsNavigator);\n\nexport const NativeTabsNavigatorWithContext = withLayoutContext<\n NativeTabOptions,\n typeof NativeTabsNavigator,\n NavigationState,\n EventMapBase\n>(createNativeTabNavigator().Navigator, (screens) => {\n return screens;\n});\n"]}
1
+ {"version":3,"file":"NativeBottomTabsNavigator.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;AAqBb,kDAiBC;AApCD,qDAQkC;AAClC,kDAA0B;AAE1B,qEAAkE;AAClE,qDAAkD;AAClD,6BAA0C;AAG1C,oFAAoF;AACpF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C,SAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,GAAG,mBAAmB,EAClC,GAAG,IAAI,EACS;IAChB,MAAM,OAAO,GAAG,IAAA,6BAAoB,EAMlC,+CAAsB,EAAE;QACxB,QAAQ;QACR,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,CAAC,+BAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,EAAG,CAAC;AACxD,CAAC;AAED,MAAM,wBAAwB,GAAG,IAAA,+BAAsB,EAAC,mBAAmB,CAAC,CAAC;AAEhE,QAAA,8BAA8B,GAAG,IAAA,qBAAiB,EAK7D,wBAAwB,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;IAClD,OAAO,OAAO,CAAC;AACjB,CAAC,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 from 'react';\n\nimport { NativeBottomTabsRouter } from './NativeBottomTabsRouter';\nimport { NativeTabsView } from './NativeTabsView';\nimport { withLayoutContext } from '../..';\nimport type { NativeTabOptions, NativeTabsProps } from './types';\n\n// In Jetpack Compose, the default back behavior is to go back to the initial route.\nconst defaultBackBehavior = 'initialRoute';\n\nexport function NativeTabsNavigator({\n children,\n backBehavior = defaultBackBehavior,\n ...rest\n}: NativeTabsProps) {\n const builder = 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 });\n\n return <NativeTabsView builder={builder} {...rest} />;\n}\n\nconst createNativeTabNavigator = createNavigatorFactory(NativeTabsNavigator);\n\nexport const NativeTabsNavigatorWithContext = withLayoutContext<\n NativeTabOptions,\n typeof NativeTabsNavigator,\n NavigationState,\n EventMapBase\n>(createNativeTabNavigator().Navigator, (screens) => {\n return screens;\n});\n"]}
@@ -0,0 +1,47 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import type { ExtendedNativeTabOptions, NativeTabTriggerProps } from './types';
3
+ /**
4
+ * The component used to customize the native tab options both in the _layout file and from the tab screen.
5
+ *
6
+ * When used in the _layout file, you need to provide a `name` prop.
7
+ * When used in the tab screen, the `name` prop takes no effect.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * // In _layout file
12
+ * import { NativeTabs } from 'expo-router/unstable-native-tabs';
13
+ *
14
+ * export default function Layout() {
15
+ * return (
16
+ * <NativeTabs>
17
+ * <NativeTabs.Trigger name="home" />
18
+ * <NativeTabs.Trigger name="settings" />
19
+ * </NativeTabs>
20
+ * );
21
+ * }
22
+ * ```
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * // In a tab screen
27
+ * import { NativeTabs } from 'expo-router/unstable-native-tabs';
28
+ *
29
+ * export default function HomeScreen() {
30
+ * return (
31
+ * <View>
32
+ * <NativeTabs.Trigger>
33
+ * <Label>Home</Label>
34
+ * </NativeTabs.Trigger>
35
+ * <Text>This is home screen!</Text>
36
+ * </View>
37
+ * );
38
+ * }
39
+ *
40
+ * **Note:** You can use the alias `NativeTabs.Trigger` for this component.
41
+ */
42
+ export declare function NativeTabTrigger(props: NativeTabTriggerProps): null;
43
+ export declare function convertTabPropsToOptions({ options, hidden, children, disablePopToTop, disableScrollToTop, }: NativeTabTriggerProps): ExtendedNativeTabOptions;
44
+ export declare function isNativeTabTrigger(child: ReactNode, contextKey?: string): child is ReactElement<NativeTabTriggerProps & {
45
+ name: string;
46
+ }>;
47
+ //# sourceMappingURL=NativeTabTrigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeTabTrigger.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabTrigger.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAK/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,QAqB5D;AAED,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,MAAM,EACN,QAAQ,EACR,eAAe,EACf,kBAAkB,GACnB,EAAE,qBAAqB,4BAgEvB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,KAAK,IAAI,YAAY,CAAC,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA6BjE"}
@@ -1,15 +1,54 @@
1
1
  "use strict";
2
2
  'use client';
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TabTrigger = TabTrigger;
4
+ exports.NativeTabTrigger = NativeTabTrigger;
5
5
  exports.convertTabPropsToOptions = convertTabPropsToOptions;
6
- exports.isTab = isTab;
6
+ exports.isNativeTabTrigger = isNativeTabTrigger;
7
7
  const native_1 = require("@react-navigation/native");
8
8
  const react_1 = require("react");
9
9
  const utils_1 = require("./utils");
10
10
  const useSafeLayoutEffect_1 = require("../../views/useSafeLayoutEffect");
11
11
  const elements_1 = require("../common/elements");
12
- function TabTrigger(props) {
12
+ /**
13
+ * The component used to customize the native tab options both in the _layout file and from the tab screen.
14
+ *
15
+ * When used in the _layout file, you need to provide a `name` prop.
16
+ * When used in the tab screen, the `name` prop takes no effect.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * // In _layout file
21
+ * import { NativeTabs } from 'expo-router/unstable-native-tabs';
22
+ *
23
+ * export default function Layout() {
24
+ * return (
25
+ * <NativeTabs>
26
+ * <NativeTabs.Trigger name="home" />
27
+ * <NativeTabs.Trigger name="settings" />
28
+ * </NativeTabs>
29
+ * );
30
+ * }
31
+ * ```
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * // In a tab screen
36
+ * import { NativeTabs } from 'expo-router/unstable-native-tabs';
37
+ *
38
+ * export default function HomeScreen() {
39
+ * return (
40
+ * <View>
41
+ * <NativeTabs.Trigger>
42
+ * <Label>Home</Label>
43
+ * </NativeTabs.Trigger>
44
+ * <Text>This is home screen!</Text>
45
+ * </View>
46
+ * );
47
+ * }
48
+ *
49
+ * **Note:** You can use the alias `NativeTabs.Trigger` for this component.
50
+ */
51
+ function NativeTabTrigger(props) {
13
52
  const route = (0, native_1.useRoute)();
14
53
  const navigation = (0, native_1.useNavigation)();
15
54
  const isFocused = navigation.isFocused();
@@ -44,9 +83,20 @@ function convertTabPropsToOptions({ options, hidden, children, disablePopToTop,
44
83
  if (child.props.children) {
45
84
  acc.badgeValue = String(child.props.children);
46
85
  }
86
+ else if (!child.props.hidden) {
87
+ // If no value is provided, we set it to a space to show the badge
88
+ // Otherwise, the `react-native-screens` will interpret it as a hidden badge
89
+ // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172
90
+ acc.badgeValue = ' ';
91
+ }
47
92
  }
48
93
  else if ((0, utils_1.isChildOfType)(child, elements_1.Label)) {
49
- acc.title = child.props.children;
94
+ if (child.props.hidden) {
95
+ acc.title = '';
96
+ }
97
+ else {
98
+ acc.title = child.props.children;
99
+ }
50
100
  }
51
101
  else if ((0, utils_1.isChildOfType)(child, elements_1.Icon)) {
52
102
  if ('src' in child.props || 'selectedSrc' in child.props) {
@@ -83,8 +133,8 @@ function convertTabPropsToOptions({ options, hidden, children, disablePopToTop,
83
133
  return acc;
84
134
  }, { ...initialOptions });
85
135
  }
86
- function isTab(child, contextKey) {
87
- if ((0, react_1.isValidElement)(child) && child && child.type === TabTrigger) {
136
+ function isNativeTabTrigger(child, contextKey) {
137
+ if ((0, react_1.isValidElement)(child) && child && child.type === NativeTabTrigger) {
88
138
  if (typeof child.props === 'object' &&
89
139
  child.props &&
90
140
  'name' in child.props &&
@@ -100,4 +150,4 @@ function isTab(child, contextKey) {
100
150
  }
101
151
  return false;
102
152
  }
103
- //# sourceMappingURL=TabOptions.js.map
153
+ //# sourceMappingURL=NativeTabTrigger.js.map