@ankhorage/surface 9.0.8 → 9.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/dist/features/bottom-sheet/BottomSheetFlatList.d.ts +3 -0
  4. package/dist/features/bottom-sheet/BottomSheetFlatList.d.ts.map +1 -0
  5. package/dist/features/bottom-sheet/BottomSheetFlatList.js +4 -0
  6. package/dist/features/bottom-sheet/BottomSheetFlatList.js.map +1 -0
  7. package/dist/features/bottom-sheet/BottomSheetFlatList.web.d.ts +4 -0
  8. package/dist/features/bottom-sheet/BottomSheetFlatList.web.d.ts.map +1 -0
  9. package/dist/features/bottom-sheet/BottomSheetFlatList.web.js +4 -0
  10. package/dist/features/bottom-sheet/BottomSheetFlatList.web.js.map +1 -0
  11. package/dist/features/bottom-sheet/BottomSheetProvider.web.d.ts +6 -0
  12. package/dist/features/bottom-sheet/BottomSheetProvider.web.d.ts.map +1 -0
  13. package/dist/features/bottom-sheet/BottomSheetProvider.web.js +88 -0
  14. package/dist/features/bottom-sheet/BottomSheetProvider.web.js.map +1 -0
  15. package/dist/features/bottom-sheet/BottomSheetScrollView.d.ts +3 -0
  16. package/dist/features/bottom-sheet/BottomSheetScrollView.d.ts.map +1 -0
  17. package/dist/features/bottom-sheet/BottomSheetScrollView.js +4 -0
  18. package/dist/features/bottom-sheet/BottomSheetScrollView.js.map +1 -0
  19. package/dist/features/bottom-sheet/BottomSheetScrollView.web.d.ts +4 -0
  20. package/dist/features/bottom-sheet/BottomSheetScrollView.web.d.ts.map +1 -0
  21. package/dist/features/bottom-sheet/BottomSheetScrollView.web.js +4 -0
  22. package/dist/features/bottom-sheet/BottomSheetScrollView.web.js.map +1 -0
  23. package/dist/features/bottom-sheet/BottomSheetSectionList.d.ts +3 -0
  24. package/dist/features/bottom-sheet/BottomSheetSectionList.d.ts.map +1 -0
  25. package/dist/features/bottom-sheet/BottomSheetSectionList.js +4 -0
  26. package/dist/features/bottom-sheet/BottomSheetSectionList.js.map +1 -0
  27. package/dist/features/bottom-sheet/BottomSheetSectionList.web.d.ts +4 -0
  28. package/dist/features/bottom-sheet/BottomSheetSectionList.web.d.ts.map +1 -0
  29. package/dist/features/bottom-sheet/BottomSheetSectionList.web.js +4 -0
  30. package/dist/features/bottom-sheet/BottomSheetSectionList.web.js.map +1 -0
  31. package/dist/features/bottom-sheet/BottomSheetView.d.ts +3 -0
  32. package/dist/features/bottom-sheet/BottomSheetView.d.ts.map +1 -0
  33. package/dist/features/bottom-sheet/BottomSheetView.js +4 -0
  34. package/dist/features/bottom-sheet/BottomSheetView.js.map +1 -0
  35. package/dist/features/bottom-sheet/BottomSheetView.web.d.ts +4 -0
  36. package/dist/features/bottom-sheet/BottomSheetView.web.d.ts.map +1 -0
  37. package/dist/features/bottom-sheet/BottomSheetView.web.js +4 -0
  38. package/dist/features/bottom-sheet/BottomSheetView.web.js.map +1 -0
  39. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.d.ts +3 -0
  40. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.d.ts.map +1 -0
  41. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.js +4 -0
  42. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.js.map +1 -0
  43. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.web.d.ts +4 -0
  44. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.web.d.ts.map +1 -0
  45. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.web.js +4 -0
  46. package/dist/features/bottom-sheet/BottomSheetVirtualizedList.web.js.map +1 -0
  47. package/dist/features/bottom-sheet/public.d.ts +5 -1
  48. package/dist/features/bottom-sheet/public.d.ts.map +1 -1
  49. package/dist/features/bottom-sheet/public.js +5 -1
  50. package/dist/features/bottom-sheet/public.js.map +1 -1
  51. package/package.json +3 -3
  52. package/src/features/bottom-sheet/BottomSheetFlatList.tsx +4 -0
  53. package/src/features/bottom-sheet/BottomSheetFlatList.web.tsx +4 -0
  54. package/src/features/bottom-sheet/BottomSheetProvider.web.tsx +132 -0
  55. package/src/features/bottom-sheet/BottomSheetScrollView.tsx +4 -0
  56. package/src/features/bottom-sheet/BottomSheetScrollView.web.tsx +4 -0
  57. package/src/features/bottom-sheet/BottomSheetSectionList.tsx +4 -0
  58. package/src/features/bottom-sheet/BottomSheetSectionList.web.tsx +4 -0
  59. package/src/features/bottom-sheet/BottomSheetView.tsx +4 -0
  60. package/src/features/bottom-sheet/BottomSheetView.web.tsx +4 -0
  61. package/src/features/bottom-sheet/BottomSheetVirtualizedList.tsx +4 -0
  62. package/src/features/bottom-sheet/BottomSheetVirtualizedList.web.tsx +4 -0
  63. package/src/features/bottom-sheet/public.test.ts +8 -5
  64. package/src/features/bottom-sheet/public.ts +5 -7
  65. package/src/features/bottom-sheet/webAdapters.test.tsx +33 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ankhorage/surface
2
2
 
3
+ ## 9.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 93ce233: Update Ankhorage dependencies: `@ankhorage/contracts`.
8
+
9
+ ## 9.0.9
10
+
11
+ ### Patch Changes
12
+
13
+ - 91caf32: Make the public bottom-sheet boundary portable on Web with React Native Web scrollables and a
14
+ Gorhom-free browser provider while preserving the native Gorhom implementation.
15
+
3
16
  ## 9.0.8
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/surface
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v9.0.8](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v9.0.10](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
7
 
8
8
  Cross-platform UI foundation for React Native and React Native Web. Provides theming, layout primitives, and core building blocks for modern apps.
9
9
 
@@ -0,0 +1,3 @@
1
+ /*** Exposes the native BottomSheet-aware FlatList implementation. */
2
+ export declare const BottomSheetFlatList: <T>(props: import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetFlatListProps<T>) => ReturnType<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetFlatListProps<never>, "ref"> & import("react").RefAttributes<import("@gorhom/bottom-sheet").BottomSheetFlatListMethods>>>>;
3
+ //# sourceMappingURL=BottomSheetFlatList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetFlatList.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetFlatList.tsx"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,0bAA4B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BottomSheetFlatList as GorhomBottomSheetFlatList } from '@gorhom/bottom-sheet';
2
+ /*** Exposes the native BottomSheet-aware FlatList implementation. */
3
+ export const BottomSheetFlatList = GorhomBottomSheetFlatList;
4
+ //# sourceMappingURL=BottomSheetFlatList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetFlatList.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAExF,qEAAqE;AACrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC","sourcesContent":["import { BottomSheetFlatList as GorhomBottomSheetFlatList } from '@gorhom/bottom-sheet';\n\n/*** Exposes the native BottomSheet-aware FlatList implementation. */\nexport const BottomSheetFlatList = GorhomBottomSheetFlatList;\n"]}
@@ -0,0 +1,4 @@
1
+ import { FlatList } from 'react-native';
2
+ /*** Exposes the portable React Native Web FlatList under the bottom-sheet contract. */
3
+ export declare const BottomSheetFlatList: typeof FlatList;
4
+ //# sourceMappingURL=BottomSheetFlatList.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetFlatList.web.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetFlatList.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,uFAAuF;AACvF,eAAO,MAAM,mBAAmB,iBAAW,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FlatList } from 'react-native';
2
+ /*** Exposes the portable React Native Web FlatList under the bottom-sheet contract. */
3
+ export const BottomSheetFlatList = FlatList;
4
+ //# sourceMappingURL=BottomSheetFlatList.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetFlatList.web.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetFlatList.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,uFAAuF;AACvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC","sourcesContent":["import { FlatList } from 'react-native';\n\n/*** Exposes the portable React Native Web FlatList under the bottom-sheet contract. */\nexport const BottomSheetFlatList = FlatList;\n"]}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /*** Installs the shared bottom-sheet controller with a React Native Web modal host. */
3
+ export declare function BottomSheetProvider({ children }: {
4
+ children: React.ReactNode;
5
+ }): React.JSX.Element;
6
+ //# sourceMappingURL=BottomSheetProvider.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetProvider.web.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetProvider.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAkC9E"}
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import { Modal, Pressable, StyleSheet, View, } from 'react-native';
3
+ import { Surface } from '../surface/public';
4
+ import { BottomSheetContext } from './BottomSheetContext';
5
+ /*** Installs the shared bottom-sheet controller with a React Native Web modal host. */
6
+ export function BottomSheetProvider({ children }) {
7
+ const activeRequestRef = React.useRef(null);
8
+ const [activeRequest, setActiveRequest] = React.useState(null);
9
+ const dismiss = React.useCallback(() => {
10
+ const request = activeRequestRef.current;
11
+ if (request === null)
12
+ return;
13
+ activeRequestRef.current = null;
14
+ setActiveRequest(null);
15
+ request.onDismiss?.();
16
+ }, []);
17
+ const present = React.useCallback((options) => {
18
+ activeRequestRef.current = options;
19
+ setActiveRequest(options);
20
+ }, []);
21
+ const controller = React.useMemo(() => ({ dismiss, present }), [dismiss, present]);
22
+ React.useEffect(() => {
23
+ if (activeRequest === null)
24
+ return;
25
+ activeRequest.onIndexChange?.(resolveInitialIndex(activeRequest));
26
+ }, [activeRequest]);
27
+ return (<BottomSheetContext value={controller}>
28
+ {children}
29
+ <BottomSheetWebHost activeRequest={activeRequest} dismiss={dismiss}/>
30
+ </BottomSheetContext>);
31
+ }
32
+ /*** Presents the active request as a bottom-aligned browser modal. */
33
+ function BottomSheetWebHost({ activeRequest, dismiss }) {
34
+ if (activeRequest === null)
35
+ return null;
36
+ return (<Modal animationType="slide" onRequestClose={dismiss} transparent visible>
37
+ <View style={styles.overlay}>
38
+ <Pressable accessibilityLabel="Close bottom sheet" disabled={activeRequest.dismissOnBackdropPress === false} onPress={activeRequest.dismissOnBackdropPress === false ? undefined : dismiss} style={styles.backdrop}/>
39
+ <Surface radius="l" style={[styles.sheet, resolveSheetSize(activeRequest)]} variant="raised">
40
+ {renderBottomSheetContent(activeRequest)}
41
+ </Surface>
42
+ </View>
43
+ </Modal>);
44
+ }
45
+ /*** Resolves the selected initial snap point into a portable Web height constraint. */
46
+ function resolveSheetSize(activeRequest) {
47
+ const snapPoint = activeRequest.snapPoints?.at(resolveInitialIndex(activeRequest));
48
+ if (snapPoint === undefined) {
49
+ return activeRequest.maxDynamicContentSize === undefined
50
+ ? undefined
51
+ : { maxHeight: activeRequest.maxDynamicContentSize };
52
+ }
53
+ return {
54
+ height: snapPoint,
55
+ maxHeight: activeRequest.maxDynamicContentSize,
56
+ };
57
+ }
58
+ /*** Resolves a safe initial index for callbacks and snap-point lookup. */
59
+ function resolveInitialIndex(activeRequest) {
60
+ const index = activeRequest.initialIndex ?? 0;
61
+ const lastIndex = Math.max(0, (activeRequest.snapPoints?.length ?? 1) - 1);
62
+ return Math.min(Math.max(index, 0), lastIndex);
63
+ }
64
+ /*** Preserves direct content mode and otherwise supplies the standard sheet content wrapper. */
65
+ function renderBottomSheetContent(activeRequest) {
66
+ return activeRequest.contentMode === 'direct' ? (activeRequest.content) : (<View>{activeRequest.content}</View>);
67
+ }
68
+ const styles = StyleSheet.create({
69
+ backdrop: {
70
+ backgroundColor: 'rgba(0, 0, 0, 0.32)',
71
+ bottom: 0,
72
+ left: 0,
73
+ position: 'absolute',
74
+ right: 0,
75
+ top: 0,
76
+ },
77
+ overlay: {
78
+ flex: 1,
79
+ justifyContent: 'flex-end',
80
+ },
81
+ sheet: {
82
+ maxHeight: '100%',
83
+ minHeight: 1,
84
+ overflow: 'hidden',
85
+ width: '100%',
86
+ },
87
+ });
88
+ //# sourceMappingURL=BottomSheetProvider.web.js.map
@@ -0,0 +1 @@
1
+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Q,EAAE;QACR,eAAe,EAAE,qBAAqB;QACtC,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;KACP;IACD,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;QACP,cAAc,EAAE,UAAU;KAC3B;IACD,KAAK,EAAE;QACL,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {\n type DimensionValue,\n Modal,\n Pressable,\n StyleSheet,\n View,\n type ViewStyle,\n} from 'react-native';\n\nimport type { BottomSheetController, BottomSheetPresentOptions } from '../../types/bottomSheet';\nimport { Surface } from '../surface/public';\nimport { BottomSheetContext } from './BottomSheetContext';\n\n/*** Installs the shared bottom-sheet controller with a React Native Web modal host. */\nexport function BottomSheetProvider({ children }: { children: React.ReactNode }) {\n const activeRequestRef = React.useRef<BottomSheetPresentOptions | null>(null);\n const [activeRequest, setActiveRequest] = React.useState<BottomSheetPresentOptions | null>(null);\n\n const dismiss = React.useCallback(() => {\n const request = activeRequestRef.current;\n if (request === null) return;\n\n activeRequestRef.current = null;\n setActiveRequest(null);\n request.onDismiss?.();\n }, []);\n\n const present = React.useCallback((options: BottomSheetPresentOptions) => {\n activeRequestRef.current = options;\n setActiveRequest(options);\n }, []);\n\n const controller = React.useMemo<BottomSheetController>(\n () => ({ dismiss, present }),\n [dismiss, present],\n );\n\n React.useEffect(() => {\n if (activeRequest === null) return;\n activeRequest.onIndexChange?.(resolveInitialIndex(activeRequest));\n }, [activeRequest]);\n\n return (\n <BottomSheetContext value={controller}>\n {children}\n <BottomSheetWebHost activeRequest={activeRequest} dismiss={dismiss} />\n </BottomSheetContext>\n );\n}\n\ninterface BottomSheetWebHostProps {\n readonly activeRequest: BottomSheetPresentOptions | null;\n readonly dismiss: () => void;\n}\n\n/*** Presents the active request as a bottom-aligned browser modal. */\nfunction BottomSheetWebHost({ activeRequest, dismiss }: BottomSheetWebHostProps) {\n if (activeRequest === null) return null;\n\n return (\n <Modal animationType=\"slide\" onRequestClose={dismiss} transparent visible>\n <View style={styles.overlay}>\n <Pressable\n accessibilityLabel=\"Close bottom sheet\"\n disabled={activeRequest.dismissOnBackdropPress === false}\n onPress={activeRequest.dismissOnBackdropPress === false ? undefined : dismiss}\n style={styles.backdrop}\n />\n <Surface\n radius=\"l\"\n style={[styles.sheet, resolveSheetSize(activeRequest)]}\n variant=\"raised\"\n >\n {renderBottomSheetContent(activeRequest)}\n </Surface>\n </View>\n </Modal>\n );\n}\n\n/*** Resolves the selected initial snap point into a portable Web height constraint. */\nfunction resolveSheetSize(activeRequest: BottomSheetPresentOptions): ViewStyle | undefined {\n const snapPoint = activeRequest.snapPoints?.at(resolveInitialIndex(activeRequest));\n if (snapPoint === undefined) {\n return activeRequest.maxDynamicContentSize === undefined\n ? undefined\n : { maxHeight: activeRequest.maxDynamicContentSize };\n }\n\n return {\n height: snapPoint as DimensionValue,\n maxHeight: activeRequest.maxDynamicContentSize,\n };\n}\n\n/*** Resolves a safe initial index for callbacks and snap-point lookup. */\nfunction resolveInitialIndex(activeRequest: BottomSheetPresentOptions): number {\n const index = activeRequest.initialIndex ?? 0;\n const lastIndex = Math.max(0, (activeRequest.snapPoints?.length ?? 1) - 1);\n return Math.min(Math.max(index, 0), lastIndex);\n}\n\n/*** Preserves direct content mode and otherwise supplies the standard sheet content wrapper. */\nfunction renderBottomSheetContent(activeRequest: BottomSheetPresentOptions): React.ReactNode {\n return activeRequest.contentMode === 'direct' ? (\n activeRequest.content\n ) : (\n <View>{activeRequest.content}</View>\n );\n}\n\nconst styles = StyleSheet.create({\n backdrop: {\n backgroundColor: 'rgba(0, 0, 0, 0.32)',\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n overlay: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n sheet: {\n maxHeight: '100%',\n minHeight: 1,\n overflow: 'hidden',\n width: '100%',\n },\n});\n"]}
@@ -0,0 +1,3 @@
1
+ /*** Exposes the native BottomSheet-aware ScrollView implementation. */
2
+ export declare const BottomSheetScrollView: (props: import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetScrollViewProps) => ReturnType<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetScrollViewProps, "ref"> & import("react").RefAttributes<import("@gorhom/bottom-sheet").BottomSheetScrollViewMethods>>>>;
3
+ //# sourceMappingURL=BottomSheetScrollView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetScrollView.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetScrollView.tsx"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,mbAA8B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BottomSheetScrollView as GorhomBottomSheetScrollView } from '@gorhom/bottom-sheet';
2
+ /*** Exposes the native BottomSheet-aware ScrollView implementation. */
3
+ export const BottomSheetScrollView = GorhomBottomSheetScrollView;
4
+ //# sourceMappingURL=BottomSheetScrollView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetScrollView.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,IAAI,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAE5F,uEAAuE;AACvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC","sourcesContent":["import { BottomSheetScrollView as GorhomBottomSheetScrollView } from '@gorhom/bottom-sheet';\n\n/*** Exposes the native BottomSheet-aware ScrollView implementation. */\nexport const BottomSheetScrollView = GorhomBottomSheetScrollView;\n"]}
@@ -0,0 +1,4 @@
1
+ import { ScrollView } from 'react-native';
2
+ /*** Exposes the portable React Native Web ScrollView under the bottom-sheet contract. */
3
+ export declare const BottomSheetScrollView: typeof ScrollView;
4
+ //# sourceMappingURL=BottomSheetScrollView.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetScrollView.web.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetScrollView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,yFAAyF;AACzF,eAAO,MAAM,qBAAqB,mBAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ScrollView } from 'react-native';
2
+ /*** Exposes the portable React Native Web ScrollView under the bottom-sheet contract. */
3
+ export const BottomSheetScrollView = ScrollView;
4
+ //# sourceMappingURL=BottomSheetScrollView.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetScrollView.web.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetScrollView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,yFAAyF;AACzF,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC","sourcesContent":["import { ScrollView } from 'react-native';\n\n/*** Exposes the portable React Native Web ScrollView under the bottom-sheet contract. */\nexport const BottomSheetScrollView = ScrollView;\n"]}
@@ -0,0 +1,3 @@
1
+ /*** Exposes the native BottomSheet-aware SectionList implementation. */
2
+ export declare const BottomSheetSectionList: <ItemT, SectionT = import("react-native").DefaultSectionT>(props: import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetSectionListProps<ItemT, SectionT>) => ReturnType<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetSectionListProps<never, import("react-native").DefaultSectionT>, "ref"> & import("react").RefAttributes<import("@gorhom/bottom-sheet").BottomSheetSectionListMethods>>>>;
3
+ //# sourceMappingURL=BottomSheetSectionList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetSectionList.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetSectionList.tsx"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,gjBAA+B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BottomSheetSectionList as GorhomBottomSheetSectionList } from '@gorhom/bottom-sheet';
2
+ /*** Exposes the native BottomSheet-aware SectionList implementation. */
3
+ export const BottomSheetSectionList = GorhomBottomSheetSectionList;
4
+ //# sourceMappingURL=BottomSheetSectionList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetSectionList.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetSectionList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,IAAI,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAE9F,wEAAwE;AACxE,MAAM,CAAC,MAAM,sBAAsB,GAAG,4BAA4B,CAAC","sourcesContent":["import { BottomSheetSectionList as GorhomBottomSheetSectionList } from '@gorhom/bottom-sheet';\n\n/*** Exposes the native BottomSheet-aware SectionList implementation. */\nexport const BottomSheetSectionList = GorhomBottomSheetSectionList;\n"]}
@@ -0,0 +1,4 @@
1
+ import { SectionList } from 'react-native';
2
+ /*** Exposes the portable React Native Web SectionList under the bottom-sheet contract. */
3
+ export declare const BottomSheetSectionList: typeof SectionList;
4
+ //# sourceMappingURL=BottomSheetSectionList.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetSectionList.web.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetSectionList.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,oBAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { SectionList } from 'react-native';
2
+ /*** Exposes the portable React Native Web SectionList under the bottom-sheet contract. */
3
+ export const BottomSheetSectionList = SectionList;
4
+ //# sourceMappingURL=BottomSheetSectionList.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetSectionList.web.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetSectionList.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAC","sourcesContent":["import { SectionList } from 'react-native';\n\n/*** Exposes the portable React Native Web SectionList under the bottom-sheet contract. */\nexport const BottomSheetSectionList = SectionList;\n"]}
@@ -0,0 +1,3 @@
1
+ /*** Exposes the native BottomSheet-aware View implementation. */
2
+ export declare const BottomSheetView: import("react").MemoExoticComponent<({ focusHook: useFocusHook, enableFooterMarginAdjustment, onLayout, style: _providedStyle, children, ...rest }: import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetView/types").BottomSheetViewProps) => React.JSX.Element>;
3
+ //# sourceMappingURL=BottomSheetView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetView.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetView.tsx"],"names":[],"mappings":"AAEA,iEAAiE;AACjE,eAAO,MAAM,eAAe,gRAAwB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BottomSheetView as GorhomBottomSheetView } from '@gorhom/bottom-sheet';
2
+ /*** Exposes the native BottomSheet-aware View implementation. */
3
+ export const BottomSheetView = GorhomBottomSheetView;
4
+ //# sourceMappingURL=BottomSheetView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetView.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,qBAAqB,CAAC","sourcesContent":["import { BottomSheetView as GorhomBottomSheetView } from '@gorhom/bottom-sheet';\n\n/*** Exposes the native BottomSheet-aware View implementation. */\nexport const BottomSheetView = GorhomBottomSheetView;\n"]}
@@ -0,0 +1,4 @@
1
+ import { View } from 'react-native';
2
+ /*** Exposes the portable React Native Web View under the bottom-sheet contract. */
3
+ export declare const BottomSheetView: typeof View;
4
+ //# sourceMappingURL=BottomSheetView.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetView.web.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,mFAAmF;AACnF,eAAO,MAAM,eAAe,aAAO,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { View } from 'react-native';
2
+ /*** Exposes the portable React Native Web View under the bottom-sheet contract. */
3
+ export const BottomSheetView = View;
4
+ //# sourceMappingURL=BottomSheetView.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetView.web.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC","sourcesContent":["import { View } from 'react-native';\n\n/*** Exposes the portable React Native Web View under the bottom-sheet contract. */\nexport const BottomSheetView = View;\n"]}
@@ -0,0 +1,3 @@
1
+ /*** Exposes the native BottomSheet-aware VirtualizedList implementation. */
2
+ export declare const BottomSheetVirtualizedList: <T>(props: import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetVirtualizedListProps<T>) => ReturnType<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetScrollable/types").BottomSheetVirtualizedListProps<never>, "ref"> & import("react").RefAttributes<import("@gorhom/bottom-sheet").BottomSheetVirtualizedListMethods>>>>;
3
+ //# sourceMappingURL=BottomSheetVirtualizedList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetVirtualizedList.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetVirtualizedList.tsx"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B,+cAAmC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BottomSheetVirtualizedList as GorhomBottomSheetVirtualizedList } from '@gorhom/bottom-sheet';
2
+ /*** Exposes the native BottomSheet-aware VirtualizedList implementation. */
3
+ export const BottomSheetVirtualizedList = GorhomBottomSheetVirtualizedList;
4
+ //# sourceMappingURL=BottomSheetVirtualizedList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetVirtualizedList.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetVirtualizedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,IAAI,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAEtG,4EAA4E;AAC5E,MAAM,CAAC,MAAM,0BAA0B,GAAG,gCAAgC,CAAC","sourcesContent":["import { BottomSheetVirtualizedList as GorhomBottomSheetVirtualizedList } from '@gorhom/bottom-sheet';\n\n/*** Exposes the native BottomSheet-aware VirtualizedList implementation. */\nexport const BottomSheetVirtualizedList = GorhomBottomSheetVirtualizedList;\n"]}
@@ -0,0 +1,4 @@
1
+ import { VirtualizedList } from 'react-native';
2
+ /*** Exposes the portable React Native Web VirtualizedList under the bottom-sheet contract. */
3
+ export declare const BottomSheetVirtualizedList: typeof VirtualizedList;
4
+ //# sourceMappingURL=BottomSheetVirtualizedList.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetVirtualizedList.web.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetVirtualizedList.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,8FAA8F;AAC9F,eAAO,MAAM,0BAA0B,wBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { VirtualizedList } from 'react-native';
2
+ /*** Exposes the portable React Native Web VirtualizedList under the bottom-sheet contract. */
3
+ export const BottomSheetVirtualizedList = VirtualizedList;
4
+ //# sourceMappingURL=BottomSheetVirtualizedList.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetVirtualizedList.web.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetVirtualizedList.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,8FAA8F;AAC9F,MAAM,CAAC,MAAM,0BAA0B,GAAG,eAAe,CAAC","sourcesContent":["import { VirtualizedList } from 'react-native';\n\n/*** Exposes the portable React Native Web VirtualizedList under the bottom-sheet contract. */\nexport const BottomSheetVirtualizedList = VirtualizedList;\n"]}
@@ -1,5 +1,9 @@
1
1
  export type { BottomSheetContentMode, BottomSheetController, BottomSheetPresentOptions, } from '../../types/bottomSheet';
2
+ export { BottomSheetFlatList } from './BottomSheetFlatList';
2
3
  export { BottomSheetProvider } from './BottomSheetProvider';
4
+ export { BottomSheetScrollView } from './BottomSheetScrollView';
5
+ export { BottomSheetSectionList } from './BottomSheetSectionList';
6
+ export { BottomSheetView } from './BottomSheetView';
7
+ export { BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';
3
8
  export { useBottomSheet } from './useBottomSheet';
4
- export { BottomSheetFlatList, BottomSheetScrollView, BottomSheetSectionList, BottomSheetView, BottomSheetVirtualizedList, } from '@gorhom/bottom-sheet';
5
9
  //# sourceMappingURL=public.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,4 +1,8 @@
1
+ export { BottomSheetFlatList } from './BottomSheetFlatList';
1
2
  export { BottomSheetProvider } from './BottomSheetProvider';
3
+ export { BottomSheetScrollView } from './BottomSheetScrollView';
4
+ export { BottomSheetSectionList } from './BottomSheetSectionList';
5
+ export { BottomSheetView } from './BottomSheetView';
6
+ export { BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';
2
7
  export { useBottomSheet } from './useBottomSheet';
3
- export { BottomSheetFlatList, BottomSheetScrollView, BottomSheetSectionList, BottomSheetView, BottomSheetVirtualizedList, } from '@gorhom/bottom-sheet';
4
8
  //# sourceMappingURL=public.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC","sourcesContent":["export type {\n BottomSheetContentMode,\n BottomSheetController,\n BottomSheetPresentOptions,\n} from '../../types/bottomSheet';\nexport { BottomSheetProvider } from './BottomSheetProvider';\nexport { useBottomSheet } from './useBottomSheet';\nexport {\n BottomSheetFlatList,\n BottomSheetScrollView,\n BottomSheetSectionList,\n BottomSheetView,\n BottomSheetVirtualizedList,\n} from '@gorhom/bottom-sheet';\n"]}
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/public.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export type {\n BottomSheetContentMode,\n BottomSheetController,\n BottomSheetPresentOptions,\n} from '../../types/bottomSheet';\nexport { BottomSheetFlatList } from './BottomSheetFlatList';\nexport { BottomSheetProvider } from './BottomSheetProvider';\nexport { BottomSheetScrollView } from './BottomSheetScrollView';\nexport { BottomSheetSectionList } from './BottomSheetSectionList';\nexport { BottomSheetView } from './BottomSheetView';\nexport { BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';\nexport { useBottomSheet } from './useBottomSheet';\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "9.0.8",
4
+ "version": "9.0.10",
5
5
  "description": "Stable UI foundation for React Native and React Native Web.",
6
6
  "homepage": "https://github.com/ankhorage/surface#readme",
7
7
  "bugs": {
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@ankhorage/color-theory": "^0.3.1",
47
- "@ankhorage/contracts": "^22.1.1",
47
+ "@ankhorage/contracts": "^22.1.2",
48
48
  "@ankhorage/utility": "^1.4.0",
49
49
  "@gorhom/bottom-sheet": "^5.2.13"
50
50
  },
@@ -107,7 +107,7 @@
107
107
  "version-packages": "ankhorage-changeset version"
108
108
  },
109
109
  "devDependencies": {
110
- "@ankhorage/devtools": "^1.17.2",
110
+ "@ankhorage/devtools": "^1.18.2",
111
111
  "@ankhorage/paradox": "^0.1.26",
112
112
  "@react-native-vector-icons/fontawesome": "^13.1.3",
113
113
  "@react-native-vector-icons/fontawesome5": "^13.1.3",
@@ -0,0 +1,4 @@
1
+ import { BottomSheetFlatList as GorhomBottomSheetFlatList } from '@gorhom/bottom-sheet';
2
+
3
+ /*** Exposes the native BottomSheet-aware FlatList implementation. */
4
+ export const BottomSheetFlatList = GorhomBottomSheetFlatList;
@@ -0,0 +1,4 @@
1
+ import { FlatList } from 'react-native';
2
+
3
+ /*** Exposes the portable React Native Web FlatList under the bottom-sheet contract. */
4
+ export const BottomSheetFlatList = FlatList;
@@ -0,0 +1,132 @@
1
+ import React from 'react';
2
+ import {
3
+ type DimensionValue,
4
+ Modal,
5
+ Pressable,
6
+ StyleSheet,
7
+ View,
8
+ type ViewStyle,
9
+ } from 'react-native';
10
+
11
+ import type { BottomSheetController, BottomSheetPresentOptions } from '../../types/bottomSheet';
12
+ import { Surface } from '../surface/public';
13
+ import { BottomSheetContext } from './BottomSheetContext';
14
+
15
+ /*** Installs the shared bottom-sheet controller with a React Native Web modal host. */
16
+ export function BottomSheetProvider({ children }: { children: React.ReactNode }) {
17
+ const activeRequestRef = React.useRef<BottomSheetPresentOptions | null>(null);
18
+ const [activeRequest, setActiveRequest] = React.useState<BottomSheetPresentOptions | null>(null);
19
+
20
+ const dismiss = React.useCallback(() => {
21
+ const request = activeRequestRef.current;
22
+ if (request === null) return;
23
+
24
+ activeRequestRef.current = null;
25
+ setActiveRequest(null);
26
+ request.onDismiss?.();
27
+ }, []);
28
+
29
+ const present = React.useCallback((options: BottomSheetPresentOptions) => {
30
+ activeRequestRef.current = options;
31
+ setActiveRequest(options);
32
+ }, []);
33
+
34
+ const controller = React.useMemo<BottomSheetController>(
35
+ () => ({ dismiss, present }),
36
+ [dismiss, present],
37
+ );
38
+
39
+ React.useEffect(() => {
40
+ if (activeRequest === null) return;
41
+ activeRequest.onIndexChange?.(resolveInitialIndex(activeRequest));
42
+ }, [activeRequest]);
43
+
44
+ return (
45
+ <BottomSheetContext value={controller}>
46
+ {children}
47
+ <BottomSheetWebHost activeRequest={activeRequest} dismiss={dismiss} />
48
+ </BottomSheetContext>
49
+ );
50
+ }
51
+
52
+ interface BottomSheetWebHostProps {
53
+ readonly activeRequest: BottomSheetPresentOptions | null;
54
+ readonly dismiss: () => void;
55
+ }
56
+
57
+ /*** Presents the active request as a bottom-aligned browser modal. */
58
+ function BottomSheetWebHost({ activeRequest, dismiss }: BottomSheetWebHostProps) {
59
+ if (activeRequest === null) return null;
60
+
61
+ return (
62
+ <Modal animationType="slide" onRequestClose={dismiss} transparent visible>
63
+ <View style={styles.overlay}>
64
+ <Pressable
65
+ accessibilityLabel="Close bottom sheet"
66
+ disabled={activeRequest.dismissOnBackdropPress === false}
67
+ onPress={activeRequest.dismissOnBackdropPress === false ? undefined : dismiss}
68
+ style={styles.backdrop}
69
+ />
70
+ <Surface
71
+ radius="l"
72
+ style={[styles.sheet, resolveSheetSize(activeRequest)]}
73
+ variant="raised"
74
+ >
75
+ {renderBottomSheetContent(activeRequest)}
76
+ </Surface>
77
+ </View>
78
+ </Modal>
79
+ );
80
+ }
81
+
82
+ /*** Resolves the selected initial snap point into a portable Web height constraint. */
83
+ function resolveSheetSize(activeRequest: BottomSheetPresentOptions): ViewStyle | undefined {
84
+ const snapPoint = activeRequest.snapPoints?.at(resolveInitialIndex(activeRequest));
85
+ if (snapPoint === undefined) {
86
+ return activeRequest.maxDynamicContentSize === undefined
87
+ ? undefined
88
+ : { maxHeight: activeRequest.maxDynamicContentSize };
89
+ }
90
+
91
+ return {
92
+ height: snapPoint as DimensionValue,
93
+ maxHeight: activeRequest.maxDynamicContentSize,
94
+ };
95
+ }
96
+
97
+ /*** Resolves a safe initial index for callbacks and snap-point lookup. */
98
+ function resolveInitialIndex(activeRequest: BottomSheetPresentOptions): number {
99
+ const index = activeRequest.initialIndex ?? 0;
100
+ const lastIndex = Math.max(0, (activeRequest.snapPoints?.length ?? 1) - 1);
101
+ return Math.min(Math.max(index, 0), lastIndex);
102
+ }
103
+
104
+ /*** Preserves direct content mode and otherwise supplies the standard sheet content wrapper. */
105
+ function renderBottomSheetContent(activeRequest: BottomSheetPresentOptions): React.ReactNode {
106
+ return activeRequest.contentMode === 'direct' ? (
107
+ activeRequest.content
108
+ ) : (
109
+ <View>{activeRequest.content}</View>
110
+ );
111
+ }
112
+
113
+ const styles = StyleSheet.create({
114
+ backdrop: {
115
+ backgroundColor: 'rgba(0, 0, 0, 0.32)',
116
+ bottom: 0,
117
+ left: 0,
118
+ position: 'absolute',
119
+ right: 0,
120
+ top: 0,
121
+ },
122
+ overlay: {
123
+ flex: 1,
124
+ justifyContent: 'flex-end',
125
+ },
126
+ sheet: {
127
+ maxHeight: '100%',
128
+ minHeight: 1,
129
+ overflow: 'hidden',
130
+ width: '100%',
131
+ },
132
+ });
@@ -0,0 +1,4 @@
1
+ import { BottomSheetScrollView as GorhomBottomSheetScrollView } from '@gorhom/bottom-sheet';
2
+
3
+ /*** Exposes the native BottomSheet-aware ScrollView implementation. */
4
+ export const BottomSheetScrollView = GorhomBottomSheetScrollView;
@@ -0,0 +1,4 @@
1
+ import { ScrollView } from 'react-native';
2
+
3
+ /*** Exposes the portable React Native Web ScrollView under the bottom-sheet contract. */
4
+ export const BottomSheetScrollView = ScrollView;
@@ -0,0 +1,4 @@
1
+ import { BottomSheetSectionList as GorhomBottomSheetSectionList } from '@gorhom/bottom-sheet';
2
+
3
+ /*** Exposes the native BottomSheet-aware SectionList implementation. */
4
+ export const BottomSheetSectionList = GorhomBottomSheetSectionList;
@@ -0,0 +1,4 @@
1
+ import { SectionList } from 'react-native';
2
+
3
+ /*** Exposes the portable React Native Web SectionList under the bottom-sheet contract. */
4
+ export const BottomSheetSectionList = SectionList;
@@ -0,0 +1,4 @@
1
+ import { BottomSheetView as GorhomBottomSheetView } from '@gorhom/bottom-sheet';
2
+
3
+ /*** Exposes the native BottomSheet-aware View implementation. */
4
+ export const BottomSheetView = GorhomBottomSheetView;
@@ -0,0 +1,4 @@
1
+ import { View } from 'react-native';
2
+
3
+ /*** Exposes the portable React Native Web View under the bottom-sheet contract. */
4
+ export const BottomSheetView = View;
@@ -0,0 +1,4 @@
1
+ import { BottomSheetVirtualizedList as GorhomBottomSheetVirtualizedList } from '@gorhom/bottom-sheet';
2
+
3
+ /*** Exposes the native BottomSheet-aware VirtualizedList implementation. */
4
+ export const BottomSheetVirtualizedList = GorhomBottomSheetVirtualizedList;
@@ -0,0 +1,4 @@
1
+ import { VirtualizedList } from 'react-native';
2
+
3
+ /*** Exposes the portable React Native Web VirtualizedList under the bottom-sheet contract. */
4
+ export const BottomSheetVirtualizedList = VirtualizedList;
@@ -1,9 +1,10 @@
1
1
  import { expect, test } from 'bun:test';
2
2
 
3
- test('bottom-sheet boundary exposes Gorhom integrated scrollables and direct content mode', async () => {
4
- const [publicSource, providerSource, typeSource] = await Promise.all([
3
+ test('bottom-sheet boundary owns portable platform adapters and direct content mode', async () => {
4
+ const [publicSource, providerSource, webProviderSource, typeSource] = await Promise.all([
5
5
  Bun.file('src/features/bottom-sheet/public.ts').text(),
6
6
  Bun.file('src/features/bottom-sheet/BottomSheetProvider.tsx').text(),
7
+ Bun.file('src/features/bottom-sheet/BottomSheetProvider.web.tsx').text(),
7
8
  Bun.file('src/types/bottomSheet.ts').text(),
8
9
  ]);
9
10
 
@@ -14,10 +15,12 @@ test('bottom-sheet boundary exposes Gorhom integrated scrollables and direct con
14
15
  'BottomSheetView',
15
16
  'BottomSheetVirtualizedList',
16
17
  ]) {
17
- expect(publicSource).toContain(name);
18
+ expect(publicSource).toContain(`from './${name}'`);
18
19
  }
19
20
 
21
+ expect(publicSource).not.toContain('@gorhom/bottom-sheet');
22
+ expect(providerSource).toContain("from '@gorhom/bottom-sheet'");
23
+ expect(webProviderSource).not.toContain('@gorhom/bottom-sheet');
24
+ expect(webProviderSource).toContain("activeRequest.contentMode === 'direct'");
20
25
  expect(typeSource).toContain("export type BottomSheetContentMode = 'view' | 'direct';");
21
- expect(providerSource).toContain("activeRequest.contentMode === 'direct'");
22
- expect(providerSource).toContain('maxDynamicContentSize={activeRequest.maxDynamicContentSize}');
23
26
  });
@@ -3,12 +3,10 @@ export type {
3
3
  BottomSheetController,
4
4
  BottomSheetPresentOptions,
5
5
  } from '../../types/bottomSheet';
6
+ export { BottomSheetFlatList } from './BottomSheetFlatList';
6
7
  export { BottomSheetProvider } from './BottomSheetProvider';
8
+ export { BottomSheetScrollView } from './BottomSheetScrollView';
9
+ export { BottomSheetSectionList } from './BottomSheetSectionList';
10
+ export { BottomSheetView } from './BottomSheetView';
11
+ export { BottomSheetVirtualizedList } from './BottomSheetVirtualizedList';
7
12
  export { useBottomSheet } from './useBottomSheet';
8
- export {
9
- BottomSheetFlatList,
10
- BottomSheetScrollView,
11
- BottomSheetSectionList,
12
- BottomSheetView,
13
- BottomSheetVirtualizedList,
14
- } from '@gorhom/bottom-sheet';
@@ -0,0 +1,33 @@
1
+ import { expect, mock, test } from 'bun:test';
2
+ import * as ReactNativeWeb from 'react-native-web';
3
+
4
+ await mock.module('react-native', () => ReactNativeWeb);
5
+
6
+ const [
7
+ { BottomSheetFlatList },
8
+ { BottomSheetProvider },
9
+ { BottomSheetScrollView },
10
+ { BottomSheetSectionList },
11
+ { BottomSheetView },
12
+ { BottomSheetVirtualizedList },
13
+ ] = await Promise.all([
14
+ import('./BottomSheetFlatList.web'),
15
+ import('./BottomSheetProvider.web'),
16
+ import('./BottomSheetScrollView.web'),
17
+ import('./BottomSheetSectionList.web'),
18
+ import('./BottomSheetView.web'),
19
+ import('./BottomSheetVirtualizedList.web'),
20
+ ]);
21
+
22
+ test('web bottom-sheet adapters load without Gorhom runtime components', () => {
23
+ for (const component of [
24
+ BottomSheetFlatList,
25
+ BottomSheetProvider,
26
+ BottomSheetScrollView,
27
+ BottomSheetSectionList,
28
+ BottomSheetView,
29
+ BottomSheetVirtualizedList,
30
+ ]) {
31
+ expect(component).toBeDefined();
32
+ }
33
+ });