@oxyhq/bloom 0.57.1 → 0.58.1
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.
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +15 -9
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +17 -23
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/overlay/index.js +56 -10
- package/lib/commonjs/overlay/index.js.map +1 -1
- package/lib/commonjs/provider/index.js +6 -0
- package/lib/commonjs/provider/index.js.map +1 -1
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js +27 -16
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +16 -10
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +17 -23
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/overlay/index.js +58 -11
- package/lib/module/overlay/index.js.map +1 -1
- package/lib/module/provider/index.js +6 -0
- package/lib/module/provider/index.js.map +1 -1
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js +27 -16
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/overlay/index.d.ts +33 -8
- package/lib/typescript/commonjs/overlay/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/provider/index.d.ts +6 -0
- package/lib/typescript/commonjs/provider/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/overlay/index.d.ts +33 -8
- package/lib/typescript/module/overlay/index.d.ts.map +1 -1
- package/lib/typescript/module/provider/index.d.ts +6 -0
- package/lib/typescript/module/provider/index.d.ts.map +1 -1
- package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/overlay-pointer-events.test.tsx +41 -0
- package/src/bottom-sheet/BottomSheetBase.tsx +18 -9
- package/src/dialog/Dialog.web.tsx +20 -24
- package/src/overlay/index.tsx +82 -17
- package/src/provider/index.tsx +6 -0
- package/src/zoomable-image-gallery/ZoomableImageGallery.tsx +32 -17
|
@@ -72,8 +72,9 @@ import type {
|
|
|
72
72
|
ZoomableImageGalleryProps,
|
|
73
73
|
} from './types';
|
|
74
74
|
|
|
75
|
-
const AnimatedBlurView = Animated.createAnimatedComponent(BlurView);
|
|
76
75
|
const AnimatedImage = Animated.createAnimatedComponent(Image);
|
|
76
|
+
// The shared overlay backdrop, driven by the viewer's open/drag progress.
|
|
77
|
+
const AnimatedBackdrop = Animated.createAnimatedComponent(Backdrop);
|
|
77
78
|
|
|
78
79
|
// Web-only interaction hints (no-ops on native): the zoom surfaces are
|
|
79
80
|
// tap-to-dismiss (`cursor: pointer`) and must not select text or drag the
|
|
@@ -172,6 +173,8 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
172
173
|
// (`handleDismiss` runs via `runOnJS` and from `Pressable.onPress`, where the
|
|
173
174
|
// state closure can be stale). Kept in lockstep by `setActiveIndexBoth`.
|
|
174
175
|
const activeIndexRef = useRef(0);
|
|
176
|
+
// True from the first dismiss request until the viewer is actually unmounted.
|
|
177
|
+
const dismissingRef = useRef(false);
|
|
175
178
|
|
|
176
179
|
// Single writer for the current index: updates state (drives indicator + open
|
|
177
180
|
// image) and the synchronous mirror together, and only when it changes.
|
|
@@ -238,6 +241,7 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
238
241
|
// every dismiss path (fly-back and fade-out fallback).
|
|
239
242
|
const finalizeDismiss = useCallback(() => {
|
|
240
243
|
setIsOpen(false);
|
|
244
|
+
dismissingRef.current = false;
|
|
241
245
|
scale.value = 1;
|
|
242
246
|
translateX.value = 0;
|
|
243
247
|
translateY.value = 0;
|
|
@@ -286,6 +290,12 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
286
290
|
}, [finalizeDismiss, opacity, scale]);
|
|
287
291
|
|
|
288
292
|
const handleDismiss = useCallback(() => {
|
|
293
|
+
// A press on the image reaches BOTH its tap gesture and the page beneath it
|
|
294
|
+
// (which owns the dismiss for the empty area around the image), so this can
|
|
295
|
+
// fire twice for one click. Latch it: a second call would start a second
|
|
296
|
+
// fly-back from an already-moving image.
|
|
297
|
+
if (dismissingRef.current) return;
|
|
298
|
+
dismissingRef.current = true;
|
|
289
299
|
// Collapse the pager back to the single open-image so the fly-back animates
|
|
290
300
|
// one image (the current one) rather than the whole scrolled strip.
|
|
291
301
|
setPagerReady(false);
|
|
@@ -334,6 +344,7 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
334
344
|
const open = useCallback(
|
|
335
345
|
(nextImages: GalleryImage[], index: number, rect?: MeasuredRect) => {
|
|
336
346
|
if (isOpen || nextImages.length === 0) return;
|
|
347
|
+
dismissingRef.current = false;
|
|
337
348
|
const safeIndex = Math.min(Math.max(index, 0), nextImages.length - 1);
|
|
338
349
|
const target = nextImages[safeIndex];
|
|
339
350
|
if (!target) return;
|
|
@@ -753,18 +764,12 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
753
764
|
did nothing on web while Escape still closed. `Backdrop` opts back
|
|
754
765
|
in via the `pointerEvents` PROP, the only form that reaches the DOM
|
|
755
766
|
(see `src/overlay`). */}
|
|
756
|
-
<
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
>
|
|
763
|
-
<Animated.View
|
|
764
|
-
style={[StyleSheet.absoluteFill, { backgroundColor: theme.colors.overlay }, backdropStyle]}
|
|
765
|
-
/>
|
|
766
|
-
</AnimatedBlurView>
|
|
767
|
-
</Backdrop>
|
|
767
|
+
<AnimatedBackdrop
|
|
768
|
+
onPress={handleDismiss}
|
|
769
|
+
accessibilityLabel="Close image viewer"
|
|
770
|
+
dimColor={theme.colors.overlay}
|
|
771
|
+
style={backdropStyle}
|
|
772
|
+
/>
|
|
768
773
|
|
|
769
774
|
<GestureDetector gesture={panGesture}>
|
|
770
775
|
<Animated.View
|
|
@@ -817,8 +822,16 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
817
822
|
// through the gesture, so it isn't wrapped in a Pressable.
|
|
818
823
|
if (idx === activeIndex) {
|
|
819
824
|
return (
|
|
820
|
-
<
|
|
825
|
+
<Pressable
|
|
821
826
|
key={`${img.uri}-${idx}`}
|
|
827
|
+
// The page fills the screen ON TOP of the backdrop (the
|
|
828
|
+
// pager below it needs pointer events to swipe), so a
|
|
829
|
+
// press on the empty area around the image can never
|
|
830
|
+
// reach the backdrop — the page dismisses it itself.
|
|
831
|
+
// Same outcome as tapping the image, which already
|
|
832
|
+
// dismisses through `singleTapDismissGesture`.
|
|
833
|
+
onPress={handleDismiss}
|
|
834
|
+
accessibilityLabel="Close image viewer"
|
|
822
835
|
style={[styles.page, { width: SCREEN_WIDTH, height: SCREEN_HEIGHT }, webPointerStyle]}
|
|
823
836
|
>
|
|
824
837
|
<GestureDetector gesture={activePageGesture}>
|
|
@@ -833,12 +846,14 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
833
846
|
{...(Platform.OS === 'web' ? { draggable: false } : {})}
|
|
834
847
|
/>
|
|
835
848
|
</GestureDetector>
|
|
836
|
-
</
|
|
849
|
+
</Pressable>
|
|
837
850
|
);
|
|
838
851
|
}
|
|
839
852
|
return (
|
|
840
|
-
<
|
|
853
|
+
<Pressable
|
|
841
854
|
key={`${img.uri}-${idx}`}
|
|
855
|
+
onPress={handleDismiss}
|
|
856
|
+
accessibilityLabel="Close image viewer"
|
|
842
857
|
style={[styles.page, { width: SCREEN_WIDTH, height: SCREEN_HEIGHT }]}
|
|
843
858
|
>
|
|
844
859
|
<Image
|
|
@@ -848,7 +863,7 @@ const ZoomableImageGalleryInner = React.forwardRef<ZoomableImageGalleryHandle, Z
|
|
|
848
863
|
transition={0}
|
|
849
864
|
{...(Platform.OS === 'web' ? { draggable: false } : {})}
|
|
850
865
|
/>
|
|
851
|
-
</
|
|
866
|
+
</Pressable>
|
|
852
867
|
);
|
|
853
868
|
})}
|
|
854
869
|
</ScrollView>
|