expo-simple-gallery 0.2.0 → 0.3.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 (31) hide show
  1. package/build/ExpoSimpleGallery.types.d.ts +1 -0
  2. package/build/ExpoSimpleGallery.types.d.ts.map +1 -1
  3. package/build/ExpoSimpleGallery.types.js.map +1 -1
  4. package/build/ExpoSimpleGalleryModal.d.ts +1 -1
  5. package/build/ExpoSimpleGalleryModal.d.ts.map +1 -1
  6. package/build/ExpoSimpleGalleryModal.js +4 -4
  7. package/build/ExpoSimpleGalleryModal.js.map +1 -1
  8. package/build/ExpoSimpleGalleryModal.types.d.ts +2 -0
  9. package/build/ExpoSimpleGalleryModal.types.d.ts.map +1 -1
  10. package/build/ExpoSimpleGalleryModal.types.js.map +1 -1
  11. package/build/ExpoSimpleGalleryView.d.ts +1 -0
  12. package/build/ExpoSimpleGalleryView.d.ts.map +1 -1
  13. package/build/ExpoSimpleGalleryView.js +12 -7
  14. package/build/ExpoSimpleGalleryView.js.map +1 -1
  15. package/ios/ExpoSimpleGalleryModule.swift +0 -1
  16. package/ios/ExpoSimpleGalleryView.swift +62 -35
  17. package/ios/Gallery/GalleryGridView+Configuration.swift +29 -21
  18. package/ios/Gallery/GalleryGridView.swift +2 -2
  19. package/ios/GalleryImageViewerModule.swift +122 -11
  20. package/ios/GalleryImageViewerView.swift +51 -19
  21. package/ios/SwiftUIGalleryViewer/LivePhotoView.swift +30 -0
  22. package/ios/SwiftUIGalleryViewer/PageMediaView.swift +351 -0
  23. package/ios/SwiftUIGalleryViewer/SwiftUIGalleryHostView.swift +91 -0
  24. package/ios/SwiftUIGalleryViewer/SwiftUIGalleryView.swift +49 -0
  25. package/ios/SwiftUIGalleryViewer/VerticalPanGestureRecognizer.swift +103 -0
  26. package/ios/SwiftUIGalleryViewer/VideoPlayerView.swift +67 -0
  27. package/package.json +5 -5
  28. package/src/ExpoSimpleGallery.types.ts +2 -0
  29. package/src/ExpoSimpleGalleryModal.tsx +4 -2
  30. package/src/ExpoSimpleGalleryModal.types.ts +2 -0
  31. package/src/ExpoSimpleGalleryView.tsx +12 -7
@@ -60,6 +60,7 @@ export type ExpoSimpleGalleryViewProps = ViewProps & {
60
60
  initiallySelected?: (string | undefined)[];
61
61
  showMediaTypeIcon?: boolean;
62
62
  debugLabels?: boolean;
63
+ viewer?: 'UIKit' | 'SwiftUI';
63
64
  } & ExpoSimpleGalleryModuleEvents;
64
65
  export interface ExpoSimpleGalleryMethods {
65
66
  centerOnIndex: (index: number) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGallery.types.d.ts","sourceRoot":"","sources":["../src/ExpoSimpleGallery.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,iBAAiB,CAAC,EAAE,CAClB,KAAK,EAAE,oBAAoB,CAAC;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,KAChD,IAAI,CAAC;IACV,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACtE,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;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AAQ,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,EAAE,EAAE,CAE/D;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAEzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGallery.types.js","sourceRoot":"","sources":["../src/ExpoSimpleGallery.types.ts"],"names":[],"mappings":"AAkIA,MAAM,UAAU,aAAa,CAAI,KAAc;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAI,KAAQ;IAC9C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC","sourcesContent":["import type { ComponentType } from 'react';\nimport type { NativeSyntheticEvent, ViewProps, ViewStyle } from 'react-native';\nimport type { SFSymbol } from './SfSymbol.types';\n\nexport type GalleryItem = {\n uri: string;\n index: number;\n};\n\nexport type OnPreviewMenuOptionSelectedPayload = {\n uri: string;\n index: number;\n optionIndex: number;\n};\n\nexport type ExpoSimpleGalleryModuleEvents = {\n onSelectionChange?: (\n event: NativeSyntheticEvent<{ selected: string[] }>\n ) => void;\n onThumbnailPress?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onThumbnailLongPress?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onOverlayPreloadRequested?: (\n event: NativeSyntheticEvent<{ range: [number, number] }>\n ) => void;\n onSectionHeadersVisible?: (\n event: NativeSyntheticEvent<{ sections: number[] }>\n ) => void;\n onPreviewMenuOptionSelected?: (\n event: NativeSyntheticEvent<OnPreviewMenuOptionSelectedPayload>\n ) => void;\n};\n\nexport type ThumbnailOverlayComponentProps = {\n uri: string;\n index: number;\n selected: boolean;\n};\nexport type ThumbnailOverlayComponent =\n ComponentType<ThumbnailOverlayComponentProps>;\n\nexport type SectionHeaderComponentProps = {\n index: number;\n};\nexport type SectionHeaderComponent = ComponentType<SectionHeaderComponentProps>;\n\nexport type ThumbnailPressAction = 'select' | 'open' | 'preview' | 'none';\n\nexport type FullscreenViewOverlayComponentProps = {\n uri: string;\n index: number;\n selected: boolean;\n toggleSelection: (selected?: boolean) => void;\n};\nexport type FullscreenViewOverlayComponent =\n ComponentType<FullscreenViewOverlayComponentProps>;\n\nexport type ExpoSimpleGalleryViewProps = ViewProps & {\n assets: string[] | string[][];\n columnsCount?: number;\n\n thumbnailStyle?: Pick<\n ViewStyle,\n 'aspectRatio' | 'borderRadius' | 'borderWidth' | 'borderColor'\n >;\n thumbnailOverlayComponent?: ThumbnailOverlayComponent;\n\n thumbnailPressAction?: 'select' | 'open' | 'none';\n thumbnailLongPressAction?: 'select' | 'open' | 'preview' | 'none';\n thumbnailPanAction?: 'select' | 'none';\n\n fullscreenViewOverlayComponent?: FullscreenViewOverlayComponent;\n fullscreenViewOverlayStyle?: ViewStyle;\n\n sectionHeaderComponent?: SectionHeaderComponent;\n sectionHeaderStyle?: Pick<ViewStyle, 'height'>;\n\n contentContainerStyle?: Pick<\n ViewStyle,\n | 'padding'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'gap'\n >;\n\n children?: never;\n\n contextMenuOptions?: UIAction[];\n\n initiallySelected?: (string | undefined)[];\n\n showMediaTypeIcon?: boolean;\n\n debugLabels?: boolean;\n} & ExpoSimpleGalleryModuleEvents;\n\nexport interface ExpoSimpleGalleryMethods {\n centerOnIndex: (index: number) => Promise<void>;\n setSelected: (uris: string[]) => Promise<void>;\n setThumbnailPressAction: (\n action: ExpoSimpleGalleryViewProps['thumbnailPressAction']\n ) => Promise<void>;\n setThumbnailLongPressAction: (\n action: ExpoSimpleGalleryViewProps['thumbnailLongPressAction']\n ) => Promise<void>;\n setThumbnailPanAction: (\n action: ExpoSimpleGalleryViewProps['thumbnailPanAction']\n ) => Promise<void>;\n setContextMenuOptions: (options: UIAction[]) => void;\n openImageViewer: (index: number) => void;\n closeImageViewer: () => void;\n}\n\ntype UIMenuElementAttribute = 'disabled' | 'destructive' | 'hidden';\ntype UIMenuElementState = 'on' | 'off' | 'mixed';\n\nexport type UIAction = {\n title: string;\n /**\n * @see https://developer.apple.com/sf-symbols/\n */\n sfSymbol?: SFSymbol;\n action?: (item: GalleryItem) => void;\n attributes?: UIMenuElementAttribute[];\n state?: UIMenuElementState;\n};\n\nexport function isNestedArray<T>(value: unknown): value is T[][] {\n return Array.isArray(value) && Array.isArray(value[0]);\n}\n\nexport function isNotNullOrUndefined<T>(value: T): value is NonNullable<T> {\n return value !== null && value !== undefined;\n}\n"]}
1
+ {"version":3,"file":"ExpoSimpleGallery.types.js","sourceRoot":"","sources":["../src/ExpoSimpleGallery.types.ts"],"names":[],"mappings":"AAoIA,MAAM,UAAU,aAAa,CAAI,KAAc;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAI,KAAQ;IAC9C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC","sourcesContent":["import type { ComponentType } from 'react';\nimport type { NativeSyntheticEvent, ViewProps, ViewStyle } from 'react-native';\nimport type { SFSymbol } from './SfSymbol.types';\n\nexport type GalleryItem = {\n uri: string;\n index: number;\n};\n\nexport type OnPreviewMenuOptionSelectedPayload = {\n uri: string;\n index: number;\n optionIndex: number;\n};\n\nexport type ExpoSimpleGalleryModuleEvents = {\n onSelectionChange?: (\n event: NativeSyntheticEvent<{ selected: string[] }>\n ) => void;\n onThumbnailPress?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onThumbnailLongPress?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onOverlayPreloadRequested?: (\n event: NativeSyntheticEvent<{ range: [number, number] }>\n ) => void;\n onSectionHeadersVisible?: (\n event: NativeSyntheticEvent<{ sections: number[] }>\n ) => void;\n onPreviewMenuOptionSelected?: (\n event: NativeSyntheticEvent<OnPreviewMenuOptionSelectedPayload>\n ) => void;\n};\n\nexport type ThumbnailOverlayComponentProps = {\n uri: string;\n index: number;\n selected: boolean;\n};\nexport type ThumbnailOverlayComponent =\n ComponentType<ThumbnailOverlayComponentProps>;\n\nexport type SectionHeaderComponentProps = {\n index: number;\n};\nexport type SectionHeaderComponent = ComponentType<SectionHeaderComponentProps>;\n\nexport type ThumbnailPressAction = 'select' | 'open' | 'preview' | 'none';\n\nexport type FullscreenViewOverlayComponentProps = {\n uri: string;\n index: number;\n selected: boolean;\n toggleSelection: (selected?: boolean) => void;\n};\nexport type FullscreenViewOverlayComponent =\n ComponentType<FullscreenViewOverlayComponentProps>;\n\nexport type ExpoSimpleGalleryViewProps = ViewProps & {\n assets: string[] | string[][];\n columnsCount?: number;\n\n thumbnailStyle?: Pick<\n ViewStyle,\n 'aspectRatio' | 'borderRadius' | 'borderWidth' | 'borderColor'\n >;\n thumbnailOverlayComponent?: ThumbnailOverlayComponent;\n\n thumbnailPressAction?: 'select' | 'open' | 'none';\n thumbnailLongPressAction?: 'select' | 'open' | 'preview' | 'none';\n thumbnailPanAction?: 'select' | 'none';\n\n fullscreenViewOverlayComponent?: FullscreenViewOverlayComponent;\n fullscreenViewOverlayStyle?: ViewStyle;\n\n sectionHeaderComponent?: SectionHeaderComponent;\n sectionHeaderStyle?: Pick<ViewStyle, 'height'>;\n\n contentContainerStyle?: Pick<\n ViewStyle,\n | 'padding'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'gap'\n >;\n\n children?: never;\n\n contextMenuOptions?: UIAction[];\n\n initiallySelected?: (string | undefined)[];\n\n showMediaTypeIcon?: boolean;\n\n debugLabels?: boolean;\n\n viewer?: 'UIKit' | 'SwiftUI';\n} & ExpoSimpleGalleryModuleEvents;\n\nexport interface ExpoSimpleGalleryMethods {\n centerOnIndex: (index: number) => Promise<void>;\n setSelected: (uris: string[]) => Promise<void>;\n setThumbnailPressAction: (\n action: ExpoSimpleGalleryViewProps['thumbnailPressAction']\n ) => Promise<void>;\n setThumbnailLongPressAction: (\n action: ExpoSimpleGalleryViewProps['thumbnailLongPressAction']\n ) => Promise<void>;\n setThumbnailPanAction: (\n action: ExpoSimpleGalleryViewProps['thumbnailPanAction']\n ) => Promise<void>;\n setContextMenuOptions: (options: UIAction[]) => void;\n openImageViewer: (index: number) => void;\n closeImageViewer: () => void;\n}\n\ntype UIMenuElementAttribute = 'disabled' | 'destructive' | 'hidden';\ntype UIMenuElementState = 'on' | 'off' | 'mixed';\n\nexport type UIAction = {\n title: string;\n /**\n * @see https://developer.apple.com/sf-symbols/\n */\n sfSymbol?: SFSymbol;\n action?: (item: GalleryItem) => void;\n attributes?: UIMenuElementAttribute[];\n state?: UIMenuElementState;\n};\n\nexport function isNestedArray<T>(value: unknown): value is T[][] {\n return Array.isArray(value) && Array.isArray(value[0]);\n}\n\nexport function isNotNullOrUndefined<T>(value: T): value is NonNullable<T> {\n return value !== null && value !== undefined;\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  import type { GalleryModalProps } from './ExpoSimpleGalleryModal.types';
2
- export declare function GalleryModal({ visible, uris, initialIndex, onClose, overlayComponent: OverlayComponent, selectedUris, style, toggleSelection, }: GalleryModalProps): import("react").JSX.Element;
2
+ export declare function GalleryModal({ visible, uris, initialIndex, onClose, overlayComponent: OverlayComponent, selectedUris, style, toggleSelection, viewer, }: GalleryModalProps): import("react").JSX.Element;
3
3
  //# sourceMappingURL=ExpoSimpleGalleryModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGalleryModal.d.ts","sourceRoot":"","sources":["../src/ExpoSimpleGalleryModal.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAKxC,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,IAAI,EACJ,YAAgB,EAChB,OAAO,EACP,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EACZ,KAAK,EACL,eAAe,GAChB,EAAE,iBAAiB,+BA2DnB"}
1
+ {"version":3,"file":"ExpoSimpleGalleryModal.d.ts","sourceRoot":"","sources":["../src/ExpoSimpleGalleryModal.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,gCAAgC,CAAC;AAKxC,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,IAAI,EACJ,YAAgB,EAChB,OAAO,EACP,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EACZ,KAAK,EACL,eAAe,EACf,MAAgB,GACjB,EAAE,iBAAiB,+BA4DnB"}
@@ -1,8 +1,8 @@
1
- import { requireNativeView } from 'expo';
1
+ import { requireNativeViewManager } from 'expo-modules-core';
2
2
  import { useCallback, useMemo, useState } from 'react';
3
3
  import { Modal, StyleSheet, View, } from 'react-native';
4
- const GalleryViewer = requireNativeView('GalleryImageViewer');
5
- export function GalleryModal({ visible, uris, initialIndex = 0, onClose, overlayComponent: OverlayComponent, selectedUris, style, toggleSelection, }) {
4
+ const GalleryViewer = requireNativeViewManager('GalleryImageViewer');
5
+ export function GalleryModal({ visible, uris, initialIndex = 0, onClose, overlayComponent: OverlayComponent, selectedUris, style, toggleSelection, viewer = 'UIKit', }) {
6
6
  const [currentIndex, setCurrentIndex] = useState(initialIndex);
7
7
  const [currentUri, setCurrentUri] = useState(uris[initialIndex] || '');
8
8
  const selected = useMemo(() => selectedUris.has(currentUri), [selectedUris, currentUri]);
@@ -19,7 +19,7 @@ export function GalleryModal({ visible, uris, initialIndex = 0, onClose, overlay
19
19
  }, [currentUri, toggleSelection]);
20
20
  return (<Modal visible={visible} transparent={true} animationType="fade" onRequestClose={onClose}>
21
21
  <View style={[styles.container, style]}>
22
- <GalleryViewer style={styles.viewer} imageData={{ uris, startIndex: initialIndex }} onPageChange={handlePageChange} onDismissAttempt={handleDismissAttempt}/>
22
+ <GalleryViewer style={styles.viewer} imageData={{ uris, startIndex: initialIndex }} onPageChange={handlePageChange} onDismissAttempt={handleDismissAttempt} viewer={viewer}/>
23
23
 
24
24
  {OverlayComponent && (<View style={styles.overlayContainer} pointerEvents="box-none">
25
25
  <OverlayComponent index={currentIndex} uri={currentUri} selected={selected} toggleSelection={handleSelectionToggle}/>
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGalleryModal.js","sourceRoot":"","sources":["../src/ExpoSimpleGalleryModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAsB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,EACL,KAAK,EAEL,UAAU,EACV,IAAI,GACL,MAAM,cAAc,CAAC;AAOtB,MAAM,aAAa,GACjB,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAE1C,MAAM,UAAU,YAAY,CAAC,EAC3B,OAAO,EACP,IAAI,EACJ,YAAY,GAAG,CAAC,EAChB,OAAO,EACP,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EACZ,KAAK,EACL,eAAe,GACG;IAClB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC/D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,IA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,EAGzC;;QAAA,CAAC,gBAAgB,IAAI,CACnB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,UAAU,CAC5D;YAAA,CAAC,gBAAgB,CACf,KAAK,CAAC,CAAC,YAAY,CAAC,CACpB,GAAG,CAAC,CAAC,UAAU,CAAC,CAChB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,eAAe,CAAC,CAAC,qBAAqB,CAAC,EAE3C;UAAA,EAAE,IAAI,CAAC,CACR,CACH;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,eAAe,EAAE,OAAO;KACzB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,CAAC;KACR;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport { type ComponentType, useCallback, useMemo, useState } from 'react';\nimport {\n Modal,\n type NativeSyntheticEvent,\n StyleSheet,\n View,\n} from 'react-native';\nimport type { GalleryItem } from './ExpoSimpleGallery.types';\nimport type {\n GalleryModalProps,\n GalleryViewerProps,\n} from './ExpoSimpleGalleryModal.types';\n\nconst GalleryViewer: ComponentType<GalleryViewerProps> =\n requireNativeView('GalleryImageViewer');\n\nexport function GalleryModal({\n visible,\n uris,\n initialIndex = 0,\n onClose,\n overlayComponent: OverlayComponent,\n selectedUris,\n style,\n toggleSelection,\n}: GalleryModalProps) {\n const [currentIndex, setCurrentIndex] = useState(initialIndex);\n const [currentUri, setCurrentUri] = useState(uris[initialIndex] || '');\n const selected = useMemo(\n () => selectedUris.has(currentUri),\n [selectedUris, currentUri]\n );\n\n const handlePageChange = useCallback(\n (event: NativeSyntheticEvent<{ index: number; uri: string }>) => {\n const { index, uri } = event.nativeEvent;\n setCurrentIndex(index);\n setCurrentUri(uri);\n },\n []\n );\n\n const handleDismissAttempt = useCallback(\n (event: NativeSyntheticEvent<GalleryItem>) => {\n onClose(event);\n },\n [onClose]\n );\n\n const handleSelectionToggle = useCallback(\n (selected?: boolean) => {\n toggleSelection(currentUri, selected);\n },\n [currentUri, toggleSelection]\n );\n\n return (\n <Modal\n visible={visible}\n transparent={true}\n animationType=\"fade\"\n onRequestClose={onClose}\n >\n <View style={[styles.container, style]}>\n <GalleryViewer\n style={styles.viewer}\n imageData={{ uris, startIndex: initialIndex }}\n onPageChange={handlePageChange}\n onDismissAttempt={handleDismissAttempt}\n />\n\n {OverlayComponent && (\n <View style={styles.overlayContainer} pointerEvents=\"box-none\">\n <OverlayComponent\n index={currentIndex}\n uri={currentUri}\n selected={selected}\n toggleSelection={handleSelectionToggle}\n />\n </View>\n )}\n </View>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n },\n viewer: {\n flex: 1,\n },\n overlayContainer: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]}
1
+ {"version":3,"file":"ExpoSimpleGalleryModal.js","sourceRoot":"","sources":["../src/ExpoSimpleGalleryModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAsB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,EACL,KAAK,EAEL,UAAU,EACV,IAAI,GACL,MAAM,cAAc,CAAC;AAOtB,MAAM,aAAa,GACjB,wBAAwB,CAAC,oBAAoB,CAAC,CAAC;AAEjD,MAAM,UAAU,YAAY,CAAC,EAC3B,OAAO,EACP,IAAI,EACJ,YAAY,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AC,SAAS,EAAE,KAAK,CAAC,CAAC,CACrC;QAAA,CAAC,aAAa,CACZ,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CACrB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAC9C,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAC/B,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,CACvC,MAAM,CAAC,CAAC,MAAM,CAAC,EAGjB;;QAAA,CAAC,gBAAgB,IAAI,CACnB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,UAAU,CAC5D;YAAA,CAAC,gBAAgB,CACf,KAAK,CAAC,CAAC,YAAY,CAAC,CACpB,GAAG,CAAC,CAAC,UAAU,CAAC,CAChB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,eAAe,CAAC,CAAC,qBAAqB,CAAC,EAE3C;UAAA,EAAE,IAAI,CAAC,CACR,CACH;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,eAAe,EAAE,OAAO;KACzB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,CAAC;KACR;IACD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport { type ComponentType, useCallback, useMemo, useState } from 'react';\nimport {\n Modal,\n type NativeSyntheticEvent,\n StyleSheet,\n View,\n} from 'react-native';\nimport type { GalleryItem } from './ExpoSimpleGallery.types';\nimport type {\n GalleryModalProps,\n GalleryViewerProps,\n} from './ExpoSimpleGalleryModal.types';\n\nconst GalleryViewer: ComponentType<GalleryViewerProps> =\n requireNativeViewManager('GalleryImageViewer');\n\nexport function GalleryModal({\n visible,\n uris,\n initialIndex = 0,\n onClose,\n overlayComponent: OverlayComponent,\n selectedUris,\n style,\n toggleSelection,\n viewer = 'UIKit',\n}: GalleryModalProps) {\n const [currentIndex, setCurrentIndex] = useState(initialIndex);\n const [currentUri, setCurrentUri] = useState(uris[initialIndex] || '');\n const selected = useMemo(\n () => selectedUris.has(currentUri),\n [selectedUris, currentUri]\n );\n\n const handlePageChange = useCallback(\n (event: NativeSyntheticEvent<{ index: number; uri: string }>) => {\n const { index, uri } = event.nativeEvent;\n setCurrentIndex(index);\n setCurrentUri(uri);\n },\n []\n );\n\n const handleDismissAttempt = useCallback(\n (event: NativeSyntheticEvent<GalleryItem>) => {\n onClose(event);\n },\n [onClose]\n );\n\n const handleSelectionToggle = useCallback(\n (selected?: boolean) => {\n toggleSelection(currentUri, selected);\n },\n [currentUri, toggleSelection]\n );\n\n return (\n <Modal\n visible={visible}\n transparent={true}\n animationType=\"fade\"\n onRequestClose={onClose}\n >\n <View style={[styles.container, style]}>\n <GalleryViewer\n style={styles.viewer}\n imageData={{ uris, startIndex: initialIndex }}\n onPageChange={handlePageChange}\n onDismissAttempt={handleDismissAttempt}\n viewer={viewer}\n />\n\n {OverlayComponent && (\n <View style={styles.overlayContainer} pointerEvents=\"box-none\">\n <OverlayComponent\n index={currentIndex}\n uri={currentUri}\n selected={selected}\n toggleSelection={handleSelectionToggle}\n />\n </View>\n )}\n </View>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: 'black',\n },\n viewer: {\n flex: 1,\n },\n overlayContainer: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n },\n});\n"]}
@@ -9,6 +9,7 @@ export type GalleryViewerProps = {
9
9
  onImageLoaded?: (event: NativeSyntheticEvent<GalleryItem>) => void;
10
10
  onDismissAttempt?: (event: NativeSyntheticEvent<GalleryItem>) => void;
11
11
  style?: StyleProp<ViewStyle>;
12
+ viewer: 'UIKit' | 'SwiftUI';
12
13
  };
13
14
  export type GalleryModalProps = {
14
15
  visible: boolean;
@@ -19,5 +20,6 @@ export type GalleryModalProps = {
19
20
  selectedUris: Set<string>;
20
21
  style?: StyleProp<ViewStyle>;
21
22
  toggleSelection: (uri: string, selected?: boolean) => void;
23
+ viewer: 'UIKit' | 'SwiftUI';
22
24
  };
23
25
  //# sourceMappingURL=ExpoSimpleGalleryModal.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGalleryModal.types.d.ts","sourceRoot":"","sources":["../src/ExpoSimpleGalleryModal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EACV,8BAA8B,EAC9B,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAClE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnE,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EA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,EAAE,oBAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAClD,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGalleryModal.types.js","sourceRoot":"","sources":["../src/ExpoSimpleGalleryModal.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';\nimport type {\n FullscreenViewOverlayComponent,\n GalleryItem,\n} from './ExpoSimpleGallery.types';\n\nexport type GalleryViewerProps = {\n imageData: {\n uris: string[];\n startIndex: number;\n };\n onPageChange?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onImageLoaded?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onDismissAttempt?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n style?: StyleProp<ViewStyle>;\n};\n\nexport type GalleryModalProps = {\n visible: boolean;\n uris: string[];\n initialIndex: number;\n onClose: (event: NativeSyntheticEvent<GalleryItem>) => void;\n overlayComponent?: FullscreenViewOverlayComponent;\n selectedUris: Set<string>;\n style?: StyleProp<ViewStyle>;\n toggleSelection: (uri: string, selected?: boolean) => void;\n};\n"]}
1
+ {"version":3,"file":"ExpoSimpleGalleryModal.types.js","sourceRoot":"","sources":["../src/ExpoSimpleGalleryModal.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';\nimport type {\n FullscreenViewOverlayComponent,\n GalleryItem,\n} from './ExpoSimpleGallery.types';\n\nexport type GalleryViewerProps = {\n imageData: {\n uris: string[];\n startIndex: number;\n };\n onPageChange?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onImageLoaded?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n onDismissAttempt?: (event: NativeSyntheticEvent<GalleryItem>) => void;\n style?: StyleProp<ViewStyle>;\n viewer: 'UIKit' | 'SwiftUI';\n};\n\nexport type GalleryModalProps = {\n visible: boolean;\n uris: string[];\n initialIndex: number;\n onClose: (event: NativeSyntheticEvent<GalleryItem>) => void;\n overlayComponent?: FullscreenViewOverlayComponent;\n selectedUris: Set<string>;\n style?: StyleProp<ViewStyle>;\n toggleSelection: (uri: string, selected?: boolean) => void;\n viewer: 'UIKit' | 'SwiftUI';\n};\n"]}
@@ -18,6 +18,7 @@ declare const _default: import("react").ForwardRefExoticComponent<import("react-
18
18
  initiallySelected?: (string | undefined)[];
19
19
  showMediaTypeIcon?: boolean;
20
20
  debugLabels?: boolean;
21
+ viewer?: "UIKit" | "SwiftUI";
21
22
  } & import("./ExpoSimpleGallery.types").ExpoSimpleGalleryModuleEvents & RefAttributes<ExpoSimpleGalleryMethods>>;
22
23
  export default _default;
23
24
  //# sourceMappingURL=ExpoSimpleGalleryView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGalleryView.d.ts","sourceRoot":"","sources":["../src/ExpoSimpleGalleryView.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EAOnB,MAAM,OAAO,CAAC;AAOf,OAAO,EACL,KAAK,wBAAwB,EAM7B,KAAK,QAAQ,EACd,MAAM,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;AAanC,wBA8QE"}
1
+ {"version":3,"file":"ExpoSimpleGalleryView.d.ts","sourceRoot":"","sources":["../src/ExpoSimpleGalleryView.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EASnB,MAAM,OAAO,CAAC;AAOf,OAAO,EACL,KAAK,wBAAwB,EAI7B,KAAK,QAAQ,EAGd,MAAM,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;AAanC,wBAmRE"}
@@ -1,14 +1,14 @@
1
- import { requireNativeView } from 'expo';
1
+ import { requireNativeViewManager } from 'expo-modules-core';
2
2
  import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
3
3
  import { processColor, useWindowDimensions, } from 'react-native';
4
4
  import { isNestedArray, isNotNullOrUndefined, } from './ExpoSimpleGallery.types';
5
5
  import { GalleryModal } from './ExpoSimpleGalleryModal';
6
6
  import { MemoizedSectionHeader } from './components/MemoizedSectionHeader';
7
7
  import { MemoizedThumbnailOverlayComponent } from './components/MemoizedThumbnailOverlayComponent';
8
- const NativeView = requireNativeView('ExpoSimpleGallery');
8
+ const NativeView = requireNativeViewManager('ExpoSimpleGallery');
9
9
  const NativeViewMemoized = memo(NativeView);
10
10
  const OVERLAYS_BUFFER = 10;
11
- export default forwardRef(function ExpoSimpleGalleryView({ thumbnailOverlayComponent: ThumbnailOverlayComponent, fullscreenViewOverlayComponent: FullscreenOverlayComponent = () => null, sectionHeaderComponent: SectionHeaderComponent, sectionHeaderStyle, assets, thumbnailStyle, onSelectionChange, onOverlayPreloadRequested, onSectionHeadersVisible, debugLabels = false, onThumbnailPress, fullscreenViewOverlayStyle, onPreviewMenuOptionSelected, contextMenuOptions, initiallySelected, ...props }, forwardedRef) {
11
+ export default forwardRef(function ExpoSimpleGalleryView({ thumbnailOverlayComponent: ThumbnailOverlayComponent, fullscreenViewOverlayComponent: FullscreenOverlayComponent = () => null, sectionHeaderComponent: SectionHeaderComponent, sectionHeaderStyle, assets, thumbnailStyle, onSelectionChange, onOverlayPreloadRequested, onSectionHeadersVisible, debugLabels = false, onThumbnailPress, fullscreenViewOverlayStyle, onPreviewMenuOptionSelected, contextMenuOptions, initiallySelected, viewer = 'UIKit', ...props }, forwardedRef) {
12
12
  const { width } = useWindowDimensions();
13
13
  const { thumbnailWidth, thumbnailHeight, thumbnailStyleProcessed } = useThumbnailDimensions({
14
14
  thumbnailStyle,
@@ -78,10 +78,13 @@ export default forwardRef(function ExpoSimpleGalleryView({ thumbnailOverlayCompo
78
78
  onThumbnailPress?.(event);
79
79
  }, [onThumbnailPress, openImageViewer]);
80
80
  const handleModalClose = useCallback((event) => {
81
- internalRef.current?.centerOnIndex(event.nativeEvent.index);
81
+ const index = event.nativeEvent.index;
82
82
  setModalVisible(false);
83
+ internalRef.current?.centerOnIndex(index);
83
84
  }, []);
84
- const thumbnailOverlays = useMemo(() => assets.flat().map((uri, index) => ThumbnailOverlayComponent ? (<MemoizedThumbnailOverlayComponent key={uri} OverlayComponent={ThumbnailOverlayComponent} uri={uri} index={index} width={thumbnailWidth} height={thumbnailHeight} selected={selectedUris.has(uri)} debugLabels={debugLabels} isNull={!(index >= visibleRangeMin - OVERLAYS_BUFFER &&
85
+ const thumbnailOverlays = useMemo(() => assets.flat().map((uri, index) => ThumbnailOverlayComponent ? (<MemoizedThumbnailOverlayComponent
86
+ // biome-ignore lint/suspicious/noArrayIndexKey: we need to force re-render on order change
87
+ key={`${uri}-${index}`} OverlayComponent={ThumbnailOverlayComponent} uri={uri} index={index} width={thumbnailWidth} height={thumbnailHeight} selected={selectedUris.has(uri)} debugLabels={debugLabels} isNull={!(index >= visibleRangeMin - OVERLAYS_BUFFER &&
85
88
  index <= visibleRangeMax + OVERLAYS_BUFFER)}/>) : null), [
86
89
  assets,
87
90
  ThumbnailOverlayComponent,
@@ -126,7 +129,9 @@ export default forwardRef(function ExpoSimpleGalleryView({ thumbnailOverlayCompo
126
129
  internalRef.current?.setSelected([...newSet]);
127
130
  }, [selectedUris]);
128
131
  return (<>
129
- <NativeViewMemoized {...props} thumbnailStyle={thumbnailStyleProcessed} sectionHeaderStyle={sectionHeaderStyle} assets={assets} onSelectionChange={handleSelectionChange} onOverlayPreloadRequested={handleOverlayPreloadRequest} onSectionHeadersVisible={handleSectionHeadersVisible} onThumbnailPress={handleThumbnailPress} onPreviewMenuOptionSelected={handlePreviewMenuOptionSelected} contextMenuOptions={contextMenuOptions} onLayout={() => {
132
+ <NativeViewMemoized
133
+ // key={assets.length}
134
+ {...props} thumbnailStyle={thumbnailStyleProcessed} sectionHeaderStyle={sectionHeaderStyle} assets={assets} onSelectionChange={handleSelectionChange} onOverlayPreloadRequested={handleOverlayPreloadRequest} onSectionHeadersVisible={handleSectionHeadersVisible} onThumbnailPress={handleThumbnailPress} onPreviewMenuOptionSelected={handlePreviewMenuOptionSelected} contextMenuOptions={contextMenuOptions} onLayout={() => {
130
135
  if (initiallySelected) {
131
136
  internalRef.current?.setSelected(initiallySelected?.filter(isNotNullOrUndefined));
132
137
  }
@@ -134,7 +139,7 @@ export default forwardRef(function ExpoSimpleGalleryView({ thumbnailOverlayCompo
134
139
  {/* @ts-expect-error type of children is intentionally set to never | undefined */}
135
140
  {children}
136
141
  </NativeViewMemoized>
137
- <GalleryModal visible={modalVisible} uris={assets.flat()} initialIndex={initialIndex} onClose={handleModalClose} selectedUris={selectedUris} overlayComponent={FullscreenOverlayComponent} style={fullscreenViewOverlayStyle} toggleSelection={handleToggleSelection}/>
142
+ <GalleryModal visible={modalVisible} uris={assets.flat()} initialIndex={initialIndex} onClose={handleModalClose} selectedUris={selectedUris} overlayComponent={FullscreenOverlayComponent} style={fullscreenViewOverlayStyle} toggleSelection={handleToggleSelection} viewer={viewer}/>
138
143
  </>);
139
144
  });
140
145
  function useThumbnailDimensions({ thumbnailStyle, contentContainerStyle, columnsCount = 2, }) {
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoSimpleGalleryView.js","sourceRoot":"","sources":["../src/ExpoSimpleGalleryView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAEL,UAAU,EACV,IAAI,EAEJ,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,YAAY,EACZ,mBAAmB,G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C,EAAE,CAAC,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC1E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,uBAAuB,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport {\n type ComponentType,\n forwardRef,\n memo,\n type RefAttributes,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n type ColorValue,\n type NativeSyntheticEvent,\n processColor,\n useWindowDimensions,\n} from 'react-native';\nimport {\n type ExpoSimpleGalleryMethods,\n type ExpoSimpleGalleryViewProps,\n type GalleryItem,\n isNestedArray,\n isNotNullOrUndefined,\n type OnPreviewMenuOptionSelectedPayload,\n type UIAction,\n} from './ExpoSimpleGallery.types';\nimport { GalleryModal } from './ExpoSimpleGalleryModal';\nimport { MemoizedSectionHeader } from './components/MemoizedSectionHeader';\nimport { MemoizedThumbnailOverlayComponent } from './components/MemoizedThumbnailOverlayComponent';\n\nconst NativeView: ComponentType<\n ExpoSimpleGalleryViewProps & RefAttributes<ExpoSimpleGalleryMethods>\n> = requireNativeView('ExpoSimpleGallery');\n\nconst NativeViewMemoized = memo(NativeView);\n\nconst OVERLAYS_BUFFER = 10;\n\nexport default forwardRef<ExpoSimpleGalleryMethods, ExpoSimpleGalleryViewProps>(\n function ExpoSimpleGalleryView(\n {\n thumbnailOverlayComponent: ThumbnailOverlayComponent,\n fullscreenViewOverlayComponent: FullscreenOverlayComponent = () => null,\n sectionHeaderComponent: SectionHeaderComponent,\n sectionHeaderStyle,\n assets,\n thumbnailStyle,\n onSelectionChange,\n onOverlayPreloadRequested,\n onSectionHeadersVisible,\n debugLabels = false,\n onThumbnailPress,\n fullscreenViewOverlayStyle,\n onPreviewMenuOptionSelected,\n contextMenuOptions,\n initiallySelected,\n ...props\n }: ExpoSimpleGalleryViewProps,\n forwardedRef\n ) {\n const { width } = useWindowDimensions();\n const { thumbnailWidth, thumbnailHeight, thumbnailStyleProcessed } =\n useThumbnailDimensions({\n thumbnailStyle,\n contentContainerStyle: props.contentContainerStyle,\n columnsCount: props.columnsCount,\n });\n\n const openImageViewer = useCallback((index: number) => {\n setInitialIndex(index);\n setModalVisible(true);\n }, []);\n\n const thumbnailPressActionRef = useRef(props.thumbnailPressAction);\n useEffect(() => {\n thumbnailPressActionRef.current = props.thumbnailPressAction;\n }, [props.thumbnailPressAction]);\n\n const internalRef = useRef<ExpoSimpleGalleryMethods>(null);\n useImperativeHandle(forwardedRef, () => ({\n centerOnIndex: async (index: number) => {\n internalRef.current?.centerOnIndex(index);\n },\n setSelected: async (uris: string[]) => {\n internalRef.current?.setSelected(uris);\n },\n setThumbnailPressAction: async (\n action: ExpoSimpleGalleryViewProps['thumbnailPressAction']\n ) => {\n thumbnailPressActionRef.current = action;\n internalRef.current?.setThumbnailPressAction(action);\n },\n setThumbnailLongPressAction: async (\n action: ExpoSimpleGalleryViewProps['thumbnailLongPressAction']\n ) => {\n internalRef.current?.setThumbnailLongPressAction(action);\n },\n setThumbnailPanAction: async (\n action: ExpoSimpleGalleryViewProps['thumbnailPanAction']\n ) => {\n internalRef.current?.setThumbnailPanAction(action);\n },\n setContextMenuOptions: async (options: UIAction[]) => {\n internalRef.current?.setContextMenuOptions(options);\n },\n openImageViewer,\n closeImageViewer: () => {\n setModalVisible(false);\n },\n }));\n\n const [modalVisible, setModalVisible] = useState(false);\n const [initialIndex, setInitialIndex] = useState(0);\n\n const [selectedUris, setSelectedUris] = useState<Set<string>>(new Set());\n\n const [visibleRange, setVisibleRange] = useState<[number, number]>([0, 0]);\n const visibleRangeMin = useMemo(() => visibleRange[0], [visibleRange]);\n const visibleRangeMax = useMemo(() => visibleRange[1], [visibleRange]);\n\n const [visibleHeaders, setVisibleHeaders] = useState<number[]>([0]);\n const visibleHeadersRangeMin = useMemo(\n () => Math.min(...visibleHeaders),\n [visibleHeaders]\n );\n const visibleHeadersRangeMax = useMemo(\n () => Math.max(...visibleHeaders),\n [visibleHeaders]\n );\n\n const handleSelectionChange = useCallback(\n (event: NativeSyntheticEvent<{ selected: string[] }>) => {\n setSelectedUris(new Set(event.nativeEvent.selected));\n onSelectionChange?.(event);\n },\n [onSelectionChange]\n );\n\n const handleOverlayPreloadRequest = useCallback(\n (event: NativeSyntheticEvent<{ range: [number, number] }>) => {\n const [start, end] = event.nativeEvent.range;\n setVisibleRange([start, end]);\n onOverlayPreloadRequested?.(event);\n },\n [onOverlayPreloadRequested]\n );\n\n const handleSectionHeadersVisible = useCallback(\n (event: NativeSyntheticEvent<{ sections: number[] }>) => {\n setVisibleHeaders(event.nativeEvent.sections);\n onSectionHeadersVisible?.(event);\n },\n [onSectionHeadersVisible]\n );\n\n const handleThumbnailPress = useCallback(\n (event: NativeSyntheticEvent<GalleryItem>) => {\n if (thumbnailPressActionRef.current === 'open') {\n openImageViewer(event.nativeEvent.index);\n }\n onThumbnailPress?.(event);\n },\n [onThumbnailPress, openImageViewer]\n );\n\n const handleModalClose = useCallback(\n (event: NativeSyntheticEvent<GalleryItem>) => {\n internalRef.current?.centerOnIndex(event.nativeEvent.index);\n setModalVisible(false);\n },\n []\n );\n\n const thumbnailOverlays = useMemo(\n () =>\n assets.flat().map((uri, index) =>\n ThumbnailOverlayComponent ? (\n <MemoizedThumbnailOverlayComponent\n key={uri}\n OverlayComponent={ThumbnailOverlayComponent}\n uri={uri}\n index={index}\n width={thumbnailWidth}\n height={thumbnailHeight}\n selected={selectedUris.has(uri)}\n debugLabels={debugLabels}\n isNull={\n !(\n index >= visibleRangeMin - OVERLAYS_BUFFER &&\n index <= visibleRangeMax + OVERLAYS_BUFFER\n )\n }\n // isNull={false}\n />\n ) : null\n ),\n [\n assets,\n ThumbnailOverlayComponent,\n thumbnailWidth,\n thumbnailHeight,\n selectedUris,\n visibleRangeMin,\n visibleRangeMax,\n debugLabels,\n ]\n );\n\n const sectionHeaders = useMemo(() => {\n if (!SectionHeaderComponent || !isNestedArray(assets)) return null;\n return assets.map((group, index) => (\n <MemoizedSectionHeader\n key={JSON.stringify(group)}\n SectionHeader={SectionHeaderComponent}\n index={index}\n width={width}\n height={Number.parseFloat(\n (sectionHeaderStyle?.height ?? 0).toString()\n )}\n debugLabels={debugLabels}\n isNull={\n !(\n index >= visibleHeadersRangeMin - OVERLAYS_BUFFER &&\n index <= visibleHeadersRangeMax + OVERLAYS_BUFFER\n )\n }\n />\n ));\n }, [\n SectionHeaderComponent,\n assets,\n sectionHeaderStyle?.height,\n debugLabels,\n width,\n visibleHeadersRangeMin,\n visibleHeadersRangeMax,\n ]);\n\n const children = useMemo(\n () => [sectionHeaders, thumbnailOverlays],\n [sectionHeaders, thumbnailOverlays]\n );\n\n const handlePreviewMenuOptionSelected = useCallback(\n (event: NativeSyntheticEvent<OnPreviewMenuOptionSelectedPayload>) => {\n const action =\n contextMenuOptions?.[event.nativeEvent.optionIndex]?.action;\n action?.({\n uri: event.nativeEvent.uri,\n index: event.nativeEvent.index,\n });\n },\n [contextMenuOptions]\n );\n\n const handleToggleSelection = useCallback(\n (uri: string, selected?: boolean) => {\n const shouldSetSelected =\n selected === undefined ? !selectedUris.has(uri) : selected;\n const newSet = new Set(selectedUris);\n if (shouldSetSelected) {\n newSet.add(uri);\n } else {\n newSet.delete(uri);\n }\n internalRef.current?.setSelected([...newSet]);\n },\n [selectedUris]\n );\n\n return (\n <>\n <NativeViewMemoized\n {...props}\n thumbnailStyle={thumbnailStyleProcessed}\n sectionHeaderStyle={sectionHeaderStyle}\n assets={assets}\n onSelectionChange={handleSelectionChange}\n onOverlayPreloadRequested={handleOverlayPreloadRequest}\n onSectionHeadersVisible={handleSectionHeadersVisible}\n onThumbnailPress={handleThumbnailPress}\n onPreviewMenuOptionSelected={handlePreviewMenuOptionSelected}\n contextMenuOptions={contextMenuOptions}\n onLayout={() => {\n if (initiallySelected) {\n internalRef.current?.setSelected(\n initiallySelected?.filter(isNotNullOrUndefined)\n );\n }\n }}\n ref={internalRef}\n >\n {/* @ts-expect-error type of children is intentionally set to never | undefined */}\n {children}\n </NativeViewMemoized>\n <GalleryModal\n visible={modalVisible}\n uris={assets.flat()}\n initialIndex={initialIndex}\n onClose={handleModalClose}\n selectedUris={selectedUris}\n overlayComponent={FullscreenOverlayComponent}\n style={fullscreenViewOverlayStyle}\n toggleSelection={handleToggleSelection}\n />\n </>\n );\n }\n);\n\nfunction useThumbnailDimensions({\n thumbnailStyle,\n contentContainerStyle,\n columnsCount = 2,\n}: {\n thumbnailStyle: ExpoSimpleGalleryViewProps['thumbnailStyle'];\n contentContainerStyle: ExpoSimpleGalleryViewProps['contentContainerStyle'];\n columnsCount?: number;\n}) {\n const { width } = useWindowDimensions();\n const thumbnailStyleProcessed = useMemo(() => {\n if (!thumbnailStyle?.borderColor) return thumbnailStyle;\n const { borderColor } = thumbnailStyle;\n return {\n ...thumbnailStyle,\n borderColor: (processColor(borderColor) as ColorValue) ?? undefined,\n };\n }, [thumbnailStyle]);\n const { thumbnailWidth, thumbnailHeight } = useMemo(() => {\n const thumbnailAspectRatio =\n Number.parseFloat(\n (thumbnailStyleProcessed?.aspectRatio as string) ?? ''\n ) || 1;\n\n const thumbnailsSpacing = contentContainerStyle?.gap\n ? Number.parseInt(contentContainerStyle?.gap.toString())\n : 0;\n const paddingLeft =\n contentContainerStyle?.paddingLeft ??\n contentContainerStyle?.paddingHorizontal ??\n contentContainerStyle?.padding ??\n 0;\n const paddingRight =\n contentContainerStyle?.paddingRight ??\n contentContainerStyle?.paddingHorizontal ??\n contentContainerStyle?.padding ??\n 0;\n const padding =\n Number.parseFloat(paddingLeft as string) +\n Number.parseFloat(paddingRight as string);\n const thumbnailWidth =\n (width - padding - (columnsCount - 1) * thumbnailsSpacing) / columnsCount;\n const thumbnailHeight = thumbnailWidth / thumbnailAspectRatio;\n return { thumbnailWidth, thumbnailHeight };\n }, [width, thumbnailStyleProcessed, columnsCount, contentContainerStyle]);\n return { thumbnailWidth, thumbnailHeight, thumbnailStyleProcessed };\n}\n"]}
1
+ {"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,YAAY,GAChB,qBAAqB,EAAE,YAAY;YACnC,qBAAqB,EAAE,iBAAiB;YACxC,qBAAqB,EAAE,OAAO;YAC9B,CAAC,CAAC;QACJ,MAAM,OAAO,GACX,MAAM,CAAC,UAAU,CAAC,WAAqB,CAAC;YACxC,MAAM,CAAC,UAAU,CAAC,YAAsB,CAAC,CAAC;QAC5C,MAAM,cAAc,GAClB,CAAC,KAAK,GAAG,OAAO,GAAG,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG,iBAAiB,CAAC,GAAG,YAAY,CAAC;QAC5E,MAAM,eAAe,GAAG,cAAc,GAAG,oBAAoB,CAAC;QAC9D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;IAC7C,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC1E,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,uBAAuB,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport {\n type ComponentType,\n type RefAttributes,\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n type ColorValue,\n type NativeSyntheticEvent,\n processColor,\n useWindowDimensions,\n} from 'react-native';\nimport {\n type ExpoSimpleGalleryMethods,\n type ExpoSimpleGalleryViewProps,\n type GalleryItem,\n type OnPreviewMenuOptionSelectedPayload,\n type UIAction,\n isNestedArray,\n isNotNullOrUndefined,\n} from './ExpoSimpleGallery.types';\nimport { GalleryModal } from './ExpoSimpleGalleryModal';\nimport { MemoizedSectionHeader } from './components/MemoizedSectionHeader';\nimport { MemoizedThumbnailOverlayComponent } from './components/MemoizedThumbnailOverlayComponent';\n\nconst NativeView: ComponentType<\n ExpoSimpleGalleryViewProps & RefAttributes<ExpoSimpleGalleryMethods>\n> = requireNativeViewManager('ExpoSimpleGallery');\n\nconst NativeViewMemoized = memo(NativeView);\n\nconst OVERLAYS_BUFFER = 10;\n\nexport default forwardRef<ExpoSimpleGalleryMethods, ExpoSimpleGalleryViewProps>(\n function ExpoSimpleGalleryView(\n {\n thumbnailOverlayComponent: ThumbnailOverlayComponent,\n fullscreenViewOverlayComponent: FullscreenOverlayComponent = () => null,\n sectionHeaderComponent: SectionHeaderComponent,\n sectionHeaderStyle,\n assets,\n thumbnailStyle,\n onSelectionChange,\n onOverlayPreloadRequested,\n onSectionHeadersVisible,\n debugLabels = false,\n onThumbnailPress,\n fullscreenViewOverlayStyle,\n onPreviewMenuOptionSelected,\n contextMenuOptions,\n initiallySelected,\n viewer = 'UIKit',\n ...props\n }: ExpoSimpleGalleryViewProps,\n forwardedRef\n ) {\n const { width } = useWindowDimensions();\n const { thumbnailWidth, thumbnailHeight, thumbnailStyleProcessed } =\n useThumbnailDimensions({\n thumbnailStyle,\n contentContainerStyle: props.contentContainerStyle,\n columnsCount: props.columnsCount,\n });\n\n const openImageViewer = useCallback((index: number) => {\n setInitialIndex(index);\n setModalVisible(true);\n }, []);\n\n const thumbnailPressActionRef = useRef(props.thumbnailPressAction);\n useEffect(() => {\n thumbnailPressActionRef.current = props.thumbnailPressAction;\n }, [props.thumbnailPressAction]);\n\n const internalRef = useRef<ExpoSimpleGalleryMethods>(null);\n useImperativeHandle(forwardedRef, () => ({\n centerOnIndex: async (index: number) => {\n internalRef.current?.centerOnIndex(index);\n },\n setSelected: async (uris: string[]) => {\n internalRef.current?.setSelected(uris);\n },\n setThumbnailPressAction: async (\n action: ExpoSimpleGalleryViewProps['thumbnailPressAction']\n ) => {\n thumbnailPressActionRef.current = action;\n internalRef.current?.setThumbnailPressAction(action);\n },\n setThumbnailLongPressAction: async (\n action: ExpoSimpleGalleryViewProps['thumbnailLongPressAction']\n ) => {\n internalRef.current?.setThumbnailLongPressAction(action);\n },\n setThumbnailPanAction: async (\n action: ExpoSimpleGalleryViewProps['thumbnailPanAction']\n ) => {\n internalRef.current?.setThumbnailPanAction(action);\n },\n setContextMenuOptions: async (options: UIAction[]) => {\n internalRef.current?.setContextMenuOptions(options);\n },\n openImageViewer,\n closeImageViewer: () => {\n setModalVisible(false);\n },\n }));\n\n const [modalVisible, setModalVisible] = useState(false);\n const [initialIndex, setInitialIndex] = useState(0);\n\n const [selectedUris, setSelectedUris] = useState<Set<string>>(new Set());\n\n const [visibleRange, setVisibleRange] = useState<[number, number]>([0, 0]);\n const visibleRangeMin = useMemo(() => visibleRange[0], [visibleRange]);\n const visibleRangeMax = useMemo(() => visibleRange[1], [visibleRange]);\n\n const [visibleHeaders, setVisibleHeaders] = useState<number[]>([0]);\n const visibleHeadersRangeMin = useMemo(\n () => Math.min(...visibleHeaders),\n [visibleHeaders]\n );\n const visibleHeadersRangeMax = useMemo(\n () => Math.max(...visibleHeaders),\n [visibleHeaders]\n );\n\n const handleSelectionChange = useCallback(\n (event: NativeSyntheticEvent<{ selected: string[] }>) => {\n setSelectedUris(new Set(event.nativeEvent.selected));\n onSelectionChange?.(event);\n },\n [onSelectionChange]\n );\n\n const handleOverlayPreloadRequest = useCallback(\n (event: NativeSyntheticEvent<{ range: [number, number] }>) => {\n const [start, end] = event.nativeEvent.range;\n setVisibleRange([start, end]);\n onOverlayPreloadRequested?.(event);\n },\n [onOverlayPreloadRequested]\n );\n\n const handleSectionHeadersVisible = useCallback(\n (event: NativeSyntheticEvent<{ sections: number[] }>) => {\n setVisibleHeaders(event.nativeEvent.sections);\n onSectionHeadersVisible?.(event);\n },\n [onSectionHeadersVisible]\n );\n\n const handleThumbnailPress = useCallback(\n (event: NativeSyntheticEvent<GalleryItem>) => {\n if (thumbnailPressActionRef.current === 'open') {\n openImageViewer(event.nativeEvent.index);\n }\n onThumbnailPress?.(event);\n },\n [onThumbnailPress, openImageViewer]\n );\n\n const handleModalClose = useCallback(\n (event: NativeSyntheticEvent<GalleryItem>) => {\n const index = event.nativeEvent.index;\n setModalVisible(false);\n internalRef.current?.centerOnIndex(index);\n },\n []\n );\n\n const thumbnailOverlays = useMemo(\n () =>\n assets.flat().map((uri, index) =>\n ThumbnailOverlayComponent ? (\n <MemoizedThumbnailOverlayComponent\n // biome-ignore lint/suspicious/noArrayIndexKey: we need to force re-render on order change\n key={`${uri}-${index}`}\n OverlayComponent={ThumbnailOverlayComponent}\n uri={uri}\n index={index}\n width={thumbnailWidth}\n height={thumbnailHeight}\n selected={selectedUris.has(uri)}\n debugLabels={debugLabels}\n isNull={\n !(\n index >= visibleRangeMin - OVERLAYS_BUFFER &&\n index <= visibleRangeMax + OVERLAYS_BUFFER\n )\n }\n // isNull={false}\n />\n ) : null\n ),\n [\n assets,\n ThumbnailOverlayComponent,\n thumbnailWidth,\n thumbnailHeight,\n selectedUris,\n visibleRangeMin,\n visibleRangeMax,\n debugLabels,\n ]\n );\n\n const sectionHeaders = useMemo(() => {\n if (!SectionHeaderComponent || !isNestedArray(assets)) return null;\n return assets.map((group, index) => (\n <MemoizedSectionHeader\n key={JSON.stringify(group)}\n SectionHeader={SectionHeaderComponent}\n index={index}\n width={width}\n height={Number.parseFloat(\n (sectionHeaderStyle?.height ?? 0).toString()\n )}\n debugLabels={debugLabels}\n isNull={\n !(\n index >= visibleHeadersRangeMin - OVERLAYS_BUFFER &&\n index <= visibleHeadersRangeMax + OVERLAYS_BUFFER\n )\n }\n />\n ));\n }, [\n SectionHeaderComponent,\n assets,\n sectionHeaderStyle?.height,\n debugLabels,\n width,\n visibleHeadersRangeMin,\n visibleHeadersRangeMax,\n ]);\n\n const children = useMemo(\n () => [sectionHeaders, thumbnailOverlays],\n [sectionHeaders, thumbnailOverlays]\n );\n\n const handlePreviewMenuOptionSelected = useCallback(\n (event: NativeSyntheticEvent<OnPreviewMenuOptionSelectedPayload>) => {\n const action =\n contextMenuOptions?.[event.nativeEvent.optionIndex]?.action;\n action?.({\n uri: event.nativeEvent.uri,\n index: event.nativeEvent.index,\n });\n },\n [contextMenuOptions]\n );\n\n const handleToggleSelection = useCallback(\n (uri: string, selected?: boolean) => {\n const shouldSetSelected =\n selected === undefined ? !selectedUris.has(uri) : selected;\n const newSet = new Set(selectedUris);\n if (shouldSetSelected) {\n newSet.add(uri);\n } else {\n newSet.delete(uri);\n }\n internalRef.current?.setSelected([...newSet]);\n },\n [selectedUris]\n );\n\n return (\n <>\n <NativeViewMemoized\n // key={assets.length}\n {...props}\n thumbnailStyle={thumbnailStyleProcessed}\n sectionHeaderStyle={sectionHeaderStyle}\n assets={assets}\n onSelectionChange={handleSelectionChange}\n onOverlayPreloadRequested={handleOverlayPreloadRequest}\n onSectionHeadersVisible={handleSectionHeadersVisible}\n onThumbnailPress={handleThumbnailPress}\n onPreviewMenuOptionSelected={handlePreviewMenuOptionSelected}\n contextMenuOptions={contextMenuOptions}\n onLayout={() => {\n if (initiallySelected) {\n internalRef.current?.setSelected(\n initiallySelected?.filter(isNotNullOrUndefined)\n );\n }\n }}\n ref={internalRef}\n >\n {/* @ts-expect-error type of children is intentionally set to never | undefined */}\n {children}\n </NativeViewMemoized>\n <GalleryModal\n visible={modalVisible}\n uris={assets.flat()}\n initialIndex={initialIndex}\n onClose={handleModalClose}\n selectedUris={selectedUris}\n overlayComponent={FullscreenOverlayComponent}\n style={fullscreenViewOverlayStyle}\n toggleSelection={handleToggleSelection}\n viewer={viewer}\n />\n </>\n );\n }\n);\n\nfunction useThumbnailDimensions({\n thumbnailStyle,\n contentContainerStyle,\n columnsCount = 2,\n}: {\n thumbnailStyle: ExpoSimpleGalleryViewProps['thumbnailStyle'];\n contentContainerStyle: ExpoSimpleGalleryViewProps['contentContainerStyle'];\n columnsCount?: number;\n}) {\n const { width } = useWindowDimensions();\n const thumbnailStyleProcessed = useMemo(() => {\n if (!thumbnailStyle?.borderColor) return thumbnailStyle;\n const { borderColor } = thumbnailStyle;\n return {\n ...thumbnailStyle,\n borderColor: (processColor(borderColor) as ColorValue) ?? undefined,\n };\n }, [thumbnailStyle]);\n const { thumbnailWidth, thumbnailHeight } = useMemo(() => {\n const thumbnailAspectRatio =\n Number.parseFloat(\n (thumbnailStyleProcessed?.aspectRatio as string) ?? ''\n ) || 1;\n\n const thumbnailsSpacing = contentContainerStyle?.gap\n ? Number.parseInt(contentContainerStyle?.gap.toString())\n : 0;\n const paddingLeft =\n contentContainerStyle?.paddingLeft ??\n contentContainerStyle?.paddingHorizontal ??\n contentContainerStyle?.padding ??\n 0;\n const paddingRight =\n contentContainerStyle?.paddingRight ??\n contentContainerStyle?.paddingHorizontal ??\n contentContainerStyle?.padding ??\n 0;\n const padding =\n Number.parseFloat(paddingLeft as string) +\n Number.parseFloat(paddingRight as string);\n const thumbnailWidth =\n (width - padding - (columnsCount - 1) * thumbnailsSpacing) / columnsCount;\n const thumbnailHeight = thumbnailWidth / thumbnailAspectRatio;\n return { thumbnailWidth, thumbnailHeight };\n }, [width, thumbnailStyleProcessed, columnsCount, contentContainerStyle]);\n return { thumbnailWidth, thumbnailHeight, thumbnailStyleProcessed };\n}\n"]}
@@ -61,7 +61,6 @@ public class ExpoSimpleGalleryModule: Module {
61
61
  }
62
62
 
63
63
  AsyncFunction("centerOnIndex") { (view: ExpoSimpleGalleryView, index: Int) in
64
- print("AsyncFunction(centerOnIndex)")
65
64
  view.galleryView?.centerOnIndex(index)
66
65
  }.runOnQueue(.main)
67
66
 
@@ -40,38 +40,41 @@ final class ExpoSimpleGalleryView: ExpoView, ContextMenuActionsDelegate {
40
40
  }
41
41
 
42
42
  override func mountChildComponentView(_ childComponentView: UIView, index: Int) {
43
- DispatchQueue.main.async { [weak self] in
44
- guard let self else { return }
45
- guard childComponentView.superview == nil else { return }
46
- guard let label = childComponentView.accessibilityLabel else {
47
- self.callSuperMountChildComponentView(childComponentView, index: index)
43
+ // DispatchQueue.main.async { [weak self] in
44
+ // guard let self else { return }
45
+ guard childComponentView.superview == nil else { return }
46
+ guard let label = childComponentView.accessibilityLabel else {
47
+ self.callSuperMountChildComponentView(childComponentView, index: index)
48
+ return
49
+ }
50
+
51
+ if label.starts(with: "GalleryViewOverlay_") {
52
+ guard let id = Int(label.replacingOccurrences(of: "GalleryViewOverlay_", with: "")) else {
48
53
  return
49
54
  }
55
+ let component = ReactMountingComponent(view: childComponentView, index: index)
56
+ self.overlays["thumbnail"]?[id] = component
50
57
 
51
- if label.starts(with: "GalleryViewOverlay_") {
52
- guard let id = Int(label.replacingOccurrences(of: "GalleryViewOverlay_", with: "")) else { return }
53
- let component = ReactMountingComponent(view: childComponentView, index: index)
54
- self.overlays["thumbnail"]?[id] = component
58
+ if let cell = self.galleryView?.cell(withIndex: id) {
59
+ self.mount(to: cell, overlay: component)
60
+ }
61
+ } else if label.starts(with: "SectionHeaderOverlay_") {
62
+ guard let sectionId = Int(label.replacingOccurrences(of: "SectionHeaderOverlay_", with: ""))
63
+ else { return }
64
+ let component = ReactMountingComponent(view: childComponentView, index: index)
65
+ self.overlays["sectionHeader"]?[sectionId] = component
55
66
 
56
- if let cell = self.galleryView?.cell(withIndex: id) {
57
- self.mount(to: cell, overlay: component)
58
- }
59
- } else if label.starts(with: "SectionHeaderOverlay_") {
60
- guard let sectionId = Int(label.replacingOccurrences(of: "SectionHeaderOverlay_", with: "")) else { return }
61
- let component = ReactMountingComponent(view: childComponentView, index: index)
62
- self.overlays["sectionHeader"]?[sectionId] = component
63
-
64
- if let galleryView = self.galleryView, galleryView.isGroupedLayout {
65
- let indexPath = IndexPath(item: 0, section: sectionId)
66
- if let headerView = galleryView.supplementaryView(
67
- forElementKind: UICollectionView.elementKindSectionHeader,
68
- at: indexPath) as? GallerySectionHeaderView
69
- {
70
- self.mount(to: headerView, overlay: component)
71
- }
67
+ if let galleryView = self.galleryView, galleryView.isGroupedLayout {
68
+ let indexPath = IndexPath(item: 0, section: sectionId)
69
+ if let headerView = galleryView.supplementaryView(
70
+ forElementKind: UICollectionView.elementKindSectionHeader,
71
+ at: indexPath) as? GallerySectionHeaderView
72
+ {
73
+ self.mount(to: headerView, overlay: component)
72
74
  }
73
75
  }
74
76
  }
77
+ // }
75
78
  }
76
79
 
77
80
  override func unmountChildComponentView(_ childComponentView: UIView, index: Int) {
@@ -80,10 +83,13 @@ final class ExpoSimpleGalleryView: ExpoView, ContextMenuActionsDelegate {
80
83
  guard let label = childComponentView.accessibilityLabel else { return }
81
84
 
82
85
  if label.starts(with: "GalleryViewOverlay_") {
83
- guard let id = Int(label.replacingOccurrences(of: "GalleryViewOverlay_", with: "")) else { return }
86
+ guard let id = Int(label.replacingOccurrences(of: "GalleryViewOverlay_", with: "")) else {
87
+ return
88
+ }
84
89
  overlays["thumbnail"]?[id] = nil
85
90
  } else if label.starts(with: "SectionHeaderOverlay_") {
86
- guard let sectionId = Int(label.replacingOccurrences(of: "SectionHeaderOverlay_", with: "")) else { return }
91
+ guard let sectionId = Int(label.replacingOccurrences(of: "SectionHeaderOverlay_", with: ""))
92
+ else { return }
87
93
  overlays["sectionHeader"]?[sectionId] = nil
88
94
  }
89
95
  }
@@ -151,14 +157,29 @@ extension ExpoSimpleGalleryView: OverlayMountingDelegate {
151
157
  }
152
158
 
153
159
  func mount<T: OverlayContainer>(to container: T, overlay: ReactMountingComponent) {
154
- DispatchQueue.main.async { [weak self] in
155
- guard overlay.view.superview == nil else { return }
156
- guard self?.getMountedOverlayComponent(for: container)?.view != overlay.view else { return }
157
- // TODO: fix remounting after props (uris list) update
158
- container.overlayContainer.mountChildComponentView(overlay.view, index: overlay.index)
159
- // container.overlayContainer.addSubview(overlay.view)
160
- overlay.view.didMoveToSuperview()
160
+ // DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
161
+ // guard let self else { return }
162
+
163
+ // if overlay.view.superview == container.overlayContainer {
164
+ // // Already mounted, no need to remount
165
+ // return
166
+ // } else
167
+
168
+ if overlay.view.superview != nil {
169
+ // If the overlay is already mounted somewhere else, unmount it first
170
+ self.unmount(overlay: overlay)
171
+ }
172
+
173
+ // guard overlay.view.superview == nil else { return }
174
+ if self.getMountedOverlayComponent(for: container) != nil {
175
+ self.unmount(from: container)
161
176
  }
177
+ // guard self.getMountedOverlayComponent(for: container)?.view != overlay.view else { return }
178
+ // TODO: fix remounting after props (uris list) update
179
+ // container.overlayContainer.mountChildComponentView(overlay.view, index: overlay.index)
180
+ container.overlayContainer.addSubview(overlay.view)
181
+ overlay.view.didMoveToSuperview()
182
+ // }
162
183
  }
163
184
 
164
185
  func unmount<T: OverlayContainer>(from container: T) {
@@ -169,10 +190,16 @@ extension ExpoSimpleGalleryView: OverlayMountingDelegate {
169
190
  }
170
191
 
171
192
  func unmount(overlay: ReactMountingComponent) {
193
+ guard overlay.view.superview != nil else { return }
194
+ print("Unmounting overlay: \(overlay.view.accessibilityLabel ?? "unknown")")
195
+ print("Overlay index: \(overlay.index)")
196
+ print("Overlay parent: \(String(describing: overlay.view.superview))")
197
+ overlay.view.willMove(toSuperview: nil)
172
198
  overlay.view.removeFromSuperview()
173
199
  }
174
200
 
175
- func getMountedOverlayComponent<T: OverlayContainer>(for container: T) -> ReactMountingComponent? {
201
+ func getMountedOverlayComponent<T: OverlayContainer>(for container: T) -> ReactMountingComponent?
202
+ {
176
203
  let (index, view) =
177
204
  container.overlayContainer.subviews.enumerated().first(where: { $0.element is ExpoView }) ?? (
178
205
  0, nil
@@ -46,14 +46,18 @@ extension GalleryGridView {
46
46
 
47
47
  reloadData()
48
48
 
49
- if !uris.isEmpty {
50
- let visibleItems = indexPathsForVisibleItems.map { $0.item }
51
- if let minItem = visibleItems.min(), let maxItem = visibleItems.max() {
52
- let range = (minItem, maxItem)
53
- overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: range)
54
- } else {
55
- let initialRange = (0, min(uris.count - 1, 30))
56
- overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: initialRange)
49
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
50
+ guard let self = self else { return }
51
+
52
+ if !uris.isEmpty {
53
+ let visibleItems = self.indexPathsForVisibleItems.map { $0.item }
54
+ if let minItem = visibleItems.min(), let maxItem = visibleItems.max() {
55
+ let range = (minItem, maxItem)
56
+ self.overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: range)
57
+ } else {
58
+ let initialRange = (0, min(uris.count - 1, 30))
59
+ self.overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: initialRange)
60
+ }
57
61
  }
58
62
  }
59
63
  }
@@ -68,21 +72,25 @@ extension GalleryGridView {
68
72
 
69
73
  reloadData()
70
74
 
71
- if !uris.isEmpty {
72
- let visibleIndexPaths = indexPathsForVisibleItems
73
- let flatIndices = visibleIndexPaths.compactMap { indexPath -> Int? in
74
- // Find the corresponding flat index for this indexPath
75
- sectionData.firstIndex { dict in
76
- dict["sectionIndex"] == indexPath.section && dict["itemIndex"] == indexPath.item
75
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
76
+ guard let self = self else { return }
77
+
78
+ if !uris.isEmpty {
79
+ let visibleIndexPaths = self.indexPathsForVisibleItems
80
+ let flatIndices = visibleIndexPaths.compactMap { indexPath -> Int? in
81
+ // Find the corresponding flat index for this indexPath
82
+ sectionData.firstIndex { dict in
83
+ dict["sectionIndex"] == indexPath.section && dict["itemIndex"] == indexPath.item
84
+ }
77
85
  }
78
- }
79
86
 
80
- if let minItem = flatIndices.min(), let maxItem = flatIndices.max() {
81
- let range = (minItem, maxItem)
82
- overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: range)
83
- } else {
84
- let initialRange = (0, min(uris.count - 1, 30))
85
- overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: initialRange)
87
+ if let minItem = flatIndices.min(), let maxItem = flatIndices.max() {
88
+ let range = (minItem, maxItem)
89
+ self.overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: range)
90
+ } else {
91
+ let initialRange = (0, min(uris.count - 1, 30))
92
+ self.overlayPreloadingDelegate?.galleryGrid(self, prefetchOverlaysFor: initialRange)
93
+ }
86
94
  }
87
95
  }
88
96
  }
@@ -16,9 +16,9 @@ final class GalleryGridView: UICollectionView {
16
16
  weak var overlayMountingDelegate: OverlayMountingDelegate?
17
17
  weak var gestureEventDelegate: GestureEventDelegate?
18
18
  weak var contextMenuActionsDelegate: ContextMenuActionsDelegate?
19
-
19
+
20
20
  var contextMenuOptions: (Int, String) -> [UIAction] = { _, _ in [] }
21
-
21
+
22
22
  var selectedAssets = Set<String>()
23
23
  var lastVisitedIndexPath: IndexPath?
24
24
  var firstVisitedCellWasSelected = false