@planningcenter/chat-react-native 3.14.0-rc.2 → 3.14.0-rc.3

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.
@@ -9,9 +9,9 @@ import colorFunction from 'color';
9
9
  import { formatDatePreview } from '../../../utils/date';
10
10
  import { PlatformPressable } from '@react-navigation/elements';
11
11
  import { useTheme } from '../../../hooks';
12
- import { platformFontWeightMedium } from '../../../utils';
12
+ import { Haptic, platformFontWeightMedium } from '../../../utils';
13
13
  const { width: WINDOW_WIDTH, height: WINDOW_HEIGHT } = Dimensions.get('window');
14
- const DISMISS_PAN_THRESHOLD = 250;
14
+ const DISMISS_PAN_THRESHOLD = 175;
15
15
  const MIN_DISTANCE_FOR_PAN = 10; // Higher threshold gives pinching priority
16
16
  const SINGLE_FINGER_POINTER = 1; // Single-finger panning / tapping helps to avoid conflicts with pinching
17
17
  const DEFAULT_OPACITY = 1;
@@ -60,6 +60,7 @@ const LightboxGallery = ({ imageAttachments, initialImageIndex, metaProps, onReq
60
60
  const styles = useStyles();
61
61
  const insets = useSafeAreaInsets();
62
62
  const [currentImageIndex, setCurrentImageIndex] = useState(initialImageIndex);
63
+ const { soft: triggerMaxZoomHaptic, rigid: triggerDismissHaptic } = Haptic;
63
64
  // Get current image data
64
65
  const currentImage = imageAttachments[currentImageIndex];
65
66
  const { url, urlMedium, metadata = {} } = currentImage.attributes;
@@ -315,6 +316,12 @@ const LightboxGallery = ({ imageAttachments, initialImageIndex, metaProps, onReq
315
316
  // Zoom image in/out within scale limits
316
317
  const newScale = savedScale.value * e.scale;
317
318
  const newScaleClamped = Math.min(MAX_SCALE + MAX_SCALE_OVERSHOOT, Math.max(MIN_SCALE, newScale));
319
+ // Check if we just reached the minimum scale threshold
320
+ const previousScale = scale.value;
321
+ const reacjedMinScale = previousScale > MIN_SCALE && newScaleClamped <= MIN_SCALE;
322
+ if (reacjedMinScale) {
323
+ runOnJS(triggerDismissHaptic)();
324
+ }
318
325
  scale.value = newScaleClamped;
319
326
  // Calculate new translation to keep focal point under fingers
320
327
  const newTranslation = zoomToFocalPoint({
@@ -344,6 +351,9 @@ const LightboxGallery = ({ imageAttachments, initialImageIndex, metaProps, onReq
344
351
  }
345
352
  // Check if overshooting the max scale and clamp it
346
353
  const finalScale = currentScale > MAX_SCALE ? MAX_SCALE : currentScale;
354
+ if (finalScale === MAX_SCALE) {
355
+ runOnJS(triggerMaxZoomHaptic)();
356
+ }
347
357
  // Recalculate translation using focal point to always return to the same position when image is overshooting the max scale
348
358
  const newTranslation = zoomToFocalPoint({
349
359
  focalPointX: focalX.value,
@@ -436,6 +446,12 @@ const LightboxGallery = ({ imageAttachments, initialImageIndex, metaProps, onReq
436
446
  const halfThreshold = DISMISS_PAN_THRESHOLD / 2;
437
447
  const fadeDistance = Math.max(0, panDistance - halfThreshold);
438
448
  const fadeProgress = fadeDistance / halfThreshold;
449
+ // Check if we just crossed the dismiss threshold
450
+ const previousDistance = Math.abs(dismissY.value);
451
+ const crossedDismissThreshold = previousDistance < DISMISS_PAN_THRESHOLD && panDistance >= DISMISS_PAN_THRESHOLD;
452
+ if (crossedDismissThreshold) {
453
+ runOnJS(triggerDismissHaptic)();
454
+ }
439
455
  opacity.value = Math.max(0, DEFAULT_OPACITY - fadeProgress);
440
456
  dismissY.value = e.translationY;
441
457
  })
@@ -1 +1 @@
1
- {"version":3,"file":"image_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAA4B,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC/F,OAAO,EACL,SAAS,EACT,UAAU,EACV,KAAK,EACL,IAAI,EACJ,OAAO,EACP,UAAU,GAIX,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACpF,OAAO,EACL,QAAQ,EACR,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7B;QACD,qBAAqB,EAAE;YACrB,cAAc,EAAE,QAAQ;YACxB,MAAM,EAAE,CAAC;YACT,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,MAAM,GAAG,EAAE;SAC3B;QACD,yBAAyB,EAAE;YACzB,KAAK,EAAE,MAAM,CAAC,cAAc;YAC5B,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useMemo, useState, Dispatch, SetStateAction, useCallback, useRef } from 'react'\nimport {\n StatusBar,\n StyleSheet,\n Modal,\n View,\n Linking,\n Dimensions,\n NativeSyntheticEvent,\n NativeScrollEvent,\n ViewToken,\n} from 'react-native'\nimport { useSafeAreaInsets, SafeAreaProvider } from 'react-native-safe-area-context'\nimport {\n FlatList,\n Gesture,\n GestureDetector,\n GestureHandlerRootView,\n} from 'react-native-gesture-handler'\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useAnimatedReaction,\n useSharedValue,\n withSpring,\n withDecay,\n SharedValue,\n} from 'react-native-reanimated'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { IconButton, Image, Heading, Text } from '../../display'\nimport colorFunction from 'color'\nimport { formatDatePreview } from '../../../utils/date'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { useTheme } from '../../../hooks'\nimport { platformFontWeightMedium } from '../../../utils'\n\nconst { width: WINDOW_WIDTH, height: WINDOW_HEIGHT } = Dimensions.get('window')\nconst DISMISS_PAN_THRESHOLD = 250\nconst MIN_DISTANCE_FOR_PAN = 10 // Higher threshold gives pinching priority\nconst SINGLE_FINGER_POINTER = 1 // Single-finger panning / tapping helps to avoid conflicts with pinching\nconst DEFAULT_OPACITY = 1\nconst DEFAULT_TRANSLATE_X = 0\nconst DEFAULT_TRANSLATE_Y = 0\nconst DEFAULT_SCALE = 1\nconst MIN_SCALE = 0.5\nconst MAX_SCALE = 5\nconst MAX_SCALE_OVERSHOOT = 5\nconst DOUBLE_TAP_ZOOM_SCALE = 2\nconst DECAY_VELOCITY_FACTOR = 0.4\nconst RESET_SPRING_CONFIG = {\n damping: 20,\n stiffness: 150,\n}\n\nexport type MetaProps = {\n authorName: string\n createdAt: string\n}\n\nexport function ImageAttachment({\n attachment,\n imageAttachments,\n currentImageIndex,\n metaProps,\n onMessageAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n imageAttachments: DenormalizedMessageAttachmentResource[]\n currentImageIndex: number\n metaProps: MetaProps\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n}) {\n const { attributes } = attachment\n const { url, urlMedium, filename, metadata = {} } = attributes\n const { colors } = useTheme()\n\n const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height })\n const [visible, setVisible] = useState(false)\n\n // Force modal to remount with fresh state\n // Fixes a bug where dismissing the modal too quickly causes the Reanimated shared values (like toolbarVisible) to not reset.\n const [modalKey, setModalKey] = useState(0)\n\n return (\n <>\n <PlatformPressable\n style={styles.container}\n onPress={() => {\n setModalKey(prev => prev + 1)\n setVisible(true)\n }}\n onLongPress={() => onMessageAttachmentLongPress(attachment)}\n android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}\n accessibilityHint=\"Long press for more options\"\n >\n <Image\n source={{ uri: urlMedium || url }}\n style={styles.image}\n wrapperStyle={styles.attachmentImageWrapper}\n alt={filename}\n />\n </PlatformPressable>\n <LightboxModal\n key={modalKey}\n visible={visible}\n setModalVisible={setVisible}\n imageAttachments={imageAttachments}\n initialImageIndex={currentImageIndex}\n metaProps={metaProps}\n />\n </>\n )\n}\n\ninterface LightboxModalProps {\n visible: boolean\n setModalVisible: Dispatch<SetStateAction<boolean>>\n imageAttachments: DenormalizedMessageAttachmentResource[]\n initialImageIndex: number\n metaProps: MetaProps\n}\n\nconst LightboxModal = ({\n visible,\n setModalVisible,\n imageAttachments,\n initialImageIndex,\n metaProps,\n}: LightboxModalProps) => {\n const onRequestClose = useCallback(() => {\n setModalVisible(false)\n }, [setModalVisible])\n\n return (\n <Modal visible={visible} transparent animationType=\"fade\" onRequestClose={onRequestClose}>\n <SafeAreaProvider>\n <LightboxGallery\n imageAttachments={imageAttachments}\n initialImageIndex={initialImageIndex}\n metaProps={metaProps}\n onRequestClose={onRequestClose}\n />\n </SafeAreaProvider>\n </Modal>\n )\n}\n\ninterface LightboxGalleryProps {\n imageAttachments: DenormalizedMessageAttachmentResource[]\n initialImageIndex: number\n metaProps: MetaProps\n onRequestClose: () => void\n}\nconst LightboxGallery = ({\n imageAttachments,\n initialImageIndex,\n metaProps,\n onRequestClose,\n}: LightboxGalleryProps) => {\n const styles = useStyles()\n const insets = useSafeAreaInsets()\n const [currentImageIndex, setCurrentImageIndex] = useState(initialImageIndex)\n\n // Get current image data\n const currentImage = imageAttachments[currentImageIndex]\n const { url, urlMedium, metadata = {} } = currentImage.attributes\n const imageWidth = metadata.width\n const imageHeight = metadata.height\n\n // Calculate available space for image display\n const availableWindowWidth = WINDOW_WIDTH\n const availableWindowHeight = WINDOW_HEIGHT - insets.top - insets.bottom\n\n /* ============================\n ANIMATION VALUES\n ============================ */\n // Native State:\n const dismissY = useSharedValue(0) // vertical distance to dismiss modal\n const opacity = useSharedValue(DEFAULT_OPACITY) // opacity of modal\n const scale = useSharedValue(DEFAULT_SCALE) // zoom level of image\n const focalX = useSharedValue(0) // focal point of image between fingers\n const focalY = useSharedValue(0) // focal point of image between fingers\n const translateX = useSharedValue(DEFAULT_TRANSLATE_X) // horizontal distance to pan image\n const translateY = useSharedValue(DEFAULT_TRANSLATE_Y) // vertical distance to pan image\n const savedScale = useSharedValue(DEFAULT_SCALE) // previous zoom level\n const savedTranslateX = useSharedValue(DEFAULT_TRANSLATE_X) // previous horizontal position\n const savedTranslateY = useSharedValue(DEFAULT_TRANSLATE_Y) // previous vertical position\n const lightboxToolbarVisible = useSharedValue(1) // toolbar visibility state\n\n // React (JS) State:\n const [isStatusBarHidden, setIsStatusBarHidden] = useState(false)\n const [flatListScrollEnabled, setFlatListScrollEnabled] = useState(true)\n\n // Syncs toolbar useSharedValue state with React's state so that the status bar can be hidden/shown based on the toolbar's animation\n useAnimatedReaction(\n () => lightboxToolbarVisible.value,\n value => {\n runOnJS(setIsStatusBarHidden)(value === 0)\n }\n )\n\n /* ============================\n HANDLERS\n ============================ */\n const handleOpenInBrowser = useCallback(() => {\n Linking.openURL(urlMedium || url)\n }, [urlMedium, url])\n\n // Helper to enable or disable FlatList scroll state after gestures have ended\n const enableFlatListScroll = useCallback((enableScroll: boolean) => {\n setFlatListScrollEnabled(enableScroll)\n }, [])\n\n const resetDismissGestures = useCallback(() => {\n dismissY.value = withSpring(0, RESET_SPRING_CONFIG)\n opacity.value = withSpring(DEFAULT_OPACITY, RESET_SPRING_CONFIG)\n }, [dismissY, opacity])\n\n const resetAllGestures = useCallback(() => {\n resetDismissGestures()\n scale.value = withSpring(DEFAULT_SCALE, RESET_SPRING_CONFIG)\n translateX.value = withSpring(DEFAULT_TRANSLATE_X, RESET_SPRING_CONFIG)\n translateY.value = withSpring(DEFAULT_TRANSLATE_Y, RESET_SPRING_CONFIG)\n savedScale.value = DEFAULT_SCALE\n savedTranslateX.value = DEFAULT_TRANSLATE_X\n savedTranslateY.value = DEFAULT_TRANSLATE_Y\n lightboxToolbarVisible.value = withSpring(1, RESET_SPRING_CONFIG)\n enableFlatListScroll(true)\n }, [\n resetDismissGestures,\n scale,\n translateX,\n translateY,\n savedScale,\n savedTranslateX,\n savedTranslateY,\n lightboxToolbarVisible,\n enableFlatListScroll,\n ])\n\n const handleCloseModal = useCallback(() => {\n onRequestClose()\n resetAllGestures()\n }, [onRequestClose, resetAllGestures])\n\n /* ============================\n UTILITY WORKLET FUNCTIONS\n 'worklet' runs functions on the UI thread, instead of the JS thread for better performance.\n ============================ */\n const getImageContainedToWindowDimensions = () => {\n 'worklet'\n\n if (!imageWidth || !imageHeight) {\n return { width: availableWindowWidth, height: availableWindowHeight }\n }\n\n const imageAspectRatio = imageWidth / imageHeight\n const windowAspectRatio = availableWindowWidth / availableWindowHeight\n\n // Constrain image width if its wider than window\n if (imageAspectRatio > windowAspectRatio) {\n return {\n width: availableWindowWidth,\n height: availableWindowWidth / imageAspectRatio,\n }\n }\n\n // Constrain image height if its taller than window\n return {\n width: availableWindowHeight * imageAspectRatio,\n height: availableWindowHeight,\n }\n }\n\n const zoomToFocalPoint = ({\n focalPointX,\n focalPointY,\n targetScale,\n currentSavedScale,\n currentSavedTranslateX,\n currentSavedTranslateY,\n }: {\n focalPointX: number\n focalPointY: number\n targetScale: number\n currentSavedScale: number\n currentSavedTranslateX: number\n currentSavedTranslateY: number\n }) => {\n 'worklet'\n\n // How far the focal point is from the center of the window\n const windowCenterX = WINDOW_WIDTH / 2\n const windowCenterY = WINDOW_HEIGHT / 2\n\n // Position of focal point relative to current image position\n const focalRelativeX = focalPointX - windowCenterX - currentSavedTranslateX\n const focalRelativeY = focalPointY - windowCenterY - currentSavedTranslateY\n\n // Calculate new translation to keep focal point under fingers\n const scaleRatio = targetScale / currentSavedScale\n const newTranslateX = currentSavedTranslateX + focalRelativeX * (1 - scaleRatio)\n const newTranslateY = currentSavedTranslateY + focalRelativeY * (1 - scaleRatio)\n\n return {\n translateX: newTranslateX,\n translateY: newTranslateY,\n }\n }\n\n const getMaxTranslationLimits = (currentScale: number) => {\n 'worklet'\n\n const { width: containedImageWidth, height: containedImageHeight } =\n getImageContainedToWindowDimensions()\n\n // Image dimensions after scaling/zooming\n const scaledWidth = containedImageWidth * currentScale\n const scaledHeight = containedImageHeight * currentScale\n\n // How much the scaled image exceeds the window container\n const excessWidth = scaledWidth - availableWindowWidth\n const excessHeight = scaledHeight - availableWindowHeight\n\n // How far the image can move in each direction before hitting window edges\n const maxTranslateX = Math.max(DEFAULT_TRANSLATE_X, excessWidth / 2)\n const maxTranslateY = Math.max(DEFAULT_TRANSLATE_Y, excessHeight / 2)\n\n return { maxTranslateX, maxTranslateY }\n }\n\n const clampDecay = (currentScale: number): { x: [number, number]; y: [number, number] } => {\n 'worklet'\n\n const { maxTranslateX, maxTranslateY } = getMaxTranslationLimits(currentScale)\n\n return {\n x: [-maxTranslateX, maxTranslateX],\n y: [-maxTranslateY, maxTranslateY],\n }\n }\n\n const clampTranslation = ({\n x,\n y,\n currentScale,\n }: {\n x: number\n y: number\n currentScale: number\n }) => {\n 'worklet'\n\n const { maxTranslateX, maxTranslateY } = getMaxTranslationLimits(currentScale)\n\n return {\n x: Math.min(maxTranslateX, Math.max(-maxTranslateX, x)),\n y: Math.min(maxTranslateY, Math.max(-maxTranslateY, y)),\n }\n }\n\n const isImageAtVerticalBoundry = (currentScale: number) => {\n 'worklet'\n\n const { height: containedImageHeight } = getImageContainedToWindowDimensions()\n\n // Calculate how much the image can exceed the window container\n const scaledHeight = containedImageHeight * currentScale\n const excessHeight = scaledHeight - availableWindowHeight\n const maxTranslateY = Math.max(DEFAULT_TRANSLATE_Y, excessHeight / 2)\n\n const currentTranslateY = translateY.value\n const panPositionTolerance = 1 // buffer to account for translateY being at a subpixel position\n\n const atTopBoundry = currentTranslateY >= maxTranslateY - panPositionTolerance\n const atBottomBoundry = currentTranslateY <= -maxTranslateY + panPositionTolerance\n\n return atTopBoundry || atBottomBoundry\n }\n\n /* ============================\n UTILITY FLATLIST FUNCTIONS\n Supports the image gallery layout and swipe functionality.\n ============================ */\n\n // Use refs to avoid re-rendering FlatList callbacks...\n const stableCurrentImageIndexRef = useRef(currentImageIndex)\n const stableImageAttachmentsLengthRef = useRef(imageAttachments.length)\n // ...while still ensuring they are updated with the latest values\n stableCurrentImageIndexRef.current = currentImageIndex\n stableImageAttachmentsLengthRef.current = imageAttachments.length\n\n // Used in tandem with FlatList's initialScrollIndex to quickly calculate the position and size of each image before they load.\n const getItemLayout = useCallback(\n (_: unknown, index: number) => ({\n length: WINDOW_WIDTH,\n offset: WINDOW_WIDTH * index,\n index,\n }),\n []\n )\n\n // Captures the current image's index after the FlatList finishes its scroll animation.\n // Used in tandem with onViewableItemsChanged to ensure the final value for currentImageIndex is set.\n const onMomentumScrollEnd = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {\n // Calculate the index of the image that is currently visible\n const imageOffsetX = event.nativeEvent.contentOffset.x\n const newImageIndex = Math.round(imageOffsetX / WINDOW_WIDTH)\n\n // Check if the image index has changed and the FlatList didn't scroll past the first or last image\n const didImageIndexChange = newImageIndex !== stableCurrentImageIndexRef.current\n const isImageIndexWithinBounds =\n newImageIndex >= 0 && newImageIndex < stableImageAttachmentsLengthRef.current\n\n if (didImageIndexChange && isImageIndexWithinBounds) {\n setCurrentImageIndex(newImageIndex)\n }\n }, [])\n\n // Supplements onMomentumScrollEnd by capturing the current image's index while the FlatList is actively scrolling.\n // Used in tandem with viewabilityConfig to trigger when the image is 50% visible in the window.\n const onViewableItemsChanged = useCallback(\n ({ viewableItems }: { viewableItems: ViewToken<DenormalizedMessageAttachmentResource>[] }) => {\n if (viewableItems.length === 0) return\n\n // Use the first viewable item which is enforced by the FlatList's pagingEnabled prop that allows only two images to be visible at a time when scrolling.\n const firstViewableItem = viewableItems[0]\n const newIndex = firstViewableItem.index\n\n if (newIndex !== null && newIndex !== stableCurrentImageIndexRef.current) {\n setCurrentImageIndex(newIndex)\n }\n },\n []\n )\n\n /* ============================\n GESTURES\n ============================ */\n const singleTapGesture = Gesture.Tap()\n .minPointers(SINGLE_FINGER_POINTER)\n .numberOfTaps(1)\n .onStart(() => {\n lightboxToolbarVisible.value = withSpring(\n lightboxToolbarVisible.value > 0.5 ? 0 : 1,\n RESET_SPRING_CONFIG\n )\n })\n\n const doubleTapGesture = Gesture.Tap()\n .minPointers(SINGLE_FINGER_POINTER)\n .numberOfTaps(2)\n .onStart(e => {\n const isZoomedIn = scale.value > DEFAULT_SCALE\n if (isZoomedIn) {\n runOnJS(resetAllGestures)()\n } else {\n // Hide toolbar when starting to zoom\n lightboxToolbarVisible.value = withSpring(0, RESET_SPRING_CONFIG)\n\n // Zoom to 2x at tap location\n const newTranslation = zoomToFocalPoint({\n focalPointX: e.x,\n focalPointY: e.y,\n targetScale: DOUBLE_TAP_ZOOM_SCALE,\n currentSavedScale: savedScale.value,\n currentSavedTranslateX: savedTranslateX.value,\n currentSavedTranslateY: savedTranslateY.value,\n })\n\n // Apply clamping to ensure image edges remain within window boundaries\n const clampedTranslate = clampTranslation({\n x: newTranslation.translateX,\n y: newTranslation.translateY,\n currentScale: DOUBLE_TAP_ZOOM_SCALE,\n })\n\n // Animate to new scale and translation\n scale.value = withSpring(DOUBLE_TAP_ZOOM_SCALE, RESET_SPRING_CONFIG)\n translateX.value = withSpring(clampedTranslate.x, RESET_SPRING_CONFIG)\n translateY.value = withSpring(clampedTranslate.y, RESET_SPRING_CONFIG)\n\n // Update saved state for next gesture\n savedScale.value = DOUBLE_TAP_ZOOM_SCALE\n savedTranslateX.value = clampedTranslate.x\n savedTranslateY.value = clampedTranslate.y\n\n // Disable FlatList scroll since image is now zoomed\n runOnJS(enableFlatListScroll)(false)\n }\n })\n\n const pinchGesture = Gesture.Pinch()\n .onStart(e => {\n focalX.value = e.focalX\n focalY.value = e.focalY\n\n // Hide toolbar when starting to zoom\n lightboxToolbarVisible.value = withSpring(0, RESET_SPRING_CONFIG)\n\n // Ensure that pinch accounts for the decay animation and starts from the true current position.\n savedTranslateX.value = translateX.value\n savedTranslateY.value = translateY.value\n })\n .onUpdate(e => {\n // Zoom image in/out within scale limits\n const newScale = savedScale.value * e.scale\n const newScaleClamped = Math.min(\n MAX_SCALE + MAX_SCALE_OVERSHOOT,\n Math.max(MIN_SCALE, newScale)\n )\n scale.value = newScaleClamped\n\n // Calculate new translation to keep focal point under fingers\n const newTranslation = zoomToFocalPoint({\n focalPointX: focalX.value,\n focalPointY: focalY.value,\n targetScale: newScaleClamped,\n currentSavedScale: savedScale.value,\n currentSavedTranslateX: savedTranslateX.value,\n currentSavedTranslateY: savedTranslateY.value,\n })\n\n // Apply translation without clamping to ensure focal point doesn't jump during gesture\n translateX.value = newTranslation.translateX\n translateY.value = newTranslation.translateY\n })\n .onEnd(() => {\n const currentScale = scale.value\n\n // Dismiss modal if fully zoomed out\n if (currentScale <= MIN_SCALE) {\n runOnJS(handleCloseModal)()\n return\n }\n\n // Reset all gestures if image is near default scale\n const isNearDefaultScale = currentScale <= DEFAULT_SCALE + 0.1\n if (isNearDefaultScale) {\n runOnJS(resetAllGestures)()\n return\n }\n\n // Check if overshooting the max scale and clamp it\n const finalScale = currentScale > MAX_SCALE ? MAX_SCALE : currentScale\n\n // Recalculate translation using focal point to always return to the same position when image is overshooting the max scale\n const newTranslation = zoomToFocalPoint({\n focalPointX: focalX.value,\n focalPointY: focalY.value,\n targetScale: finalScale,\n currentSavedScale: savedScale.value,\n currentSavedTranslateX: savedTranslateX.value,\n currentSavedTranslateY: savedTranslateY.value,\n })\n\n // Ensure image edges remain within window boundaries\n const clampedTranslate = clampTranslation({\n x: newTranslation.translateX,\n y: newTranslation.translateY,\n currentScale: finalScale,\n })\n\n // Animate to position and scale limits with a spring\n scale.value = withSpring(finalScale, RESET_SPRING_CONFIG)\n translateX.value = withSpring(clampedTranslate.x, RESET_SPRING_CONFIG)\n translateY.value = withSpring(clampedTranslate.y, RESET_SPRING_CONFIG)\n\n // Save state for next gesture\n savedScale.value = finalScale\n savedTranslateX.value = clampedTranslate.x\n savedTranslateY.value = clampedTranslate.y\n\n // Disable FlatList scroll since image is still zoomed\n runOnJS(enableFlatListScroll)(false)\n })\n\n const panGesture = Gesture.Pan()\n .minDistance(MIN_DISTANCE_FOR_PAN)\n .minPointers(SINGLE_FINGER_POINTER)\n .maxPointers(SINGLE_FINGER_POINTER)\n .onStart(() => {\n // Only start pan if image is zoomed in - prevents conflicts with FlatList\n if (scale.value <= DEFAULT_SCALE) return\n\n // Update saved position to current animated position\n // This ensures smooth continuation if decay is running\n savedTranslateX.value = translateX.value\n savedTranslateY.value = translateY.value\n })\n .onUpdate(e => {\n // Only pan if image is zoomed in - prevents conflicts with FlatList\n if (scale.value <= DEFAULT_SCALE) return\n\n const newTranslateX = savedTranslateX.value + e.translationX\n const newTranslateY = savedTranslateY.value + e.translationY\n\n // Ensure image edges remain within window boundaries\n const clampedTranslate = clampTranslation({\n x: newTranslateX,\n y: newTranslateY,\n currentScale: scale.value,\n })\n translateX.value = clampedTranslate.x\n translateY.value = clampedTranslate.y\n })\n .onEnd(e => {\n // Prevents saving pan position if image is zoomed out while panning\n if (scale.value <= DEFAULT_SCALE) return\n\n const clampDecayBounds = clampDecay(scale.value)\n\n translateX.value = withDecay(\n {\n velocity: e.velocityX * DECAY_VELOCITY_FACTOR,\n clamp: clampDecayBounds.x,\n deceleration: 0.996,\n },\n finished => {\n if (finished) {\n savedTranslateX.value = translateX.value\n }\n }\n )\n\n translateY.value = withDecay(\n {\n velocity: e.velocityY * DECAY_VELOCITY_FACTOR,\n clamp: clampDecayBounds.y,\n deceleration: 0.996,\n },\n finished => {\n if (finished) {\n savedTranslateY.value = translateY.value\n }\n }\n )\n })\n\n const panToDismissModalGesture = Gesture.Pan()\n .onUpdate(e => {\n const atDefaultScale = scale.value === DEFAULT_SCALE\n\n // Calculate zoom conditions for dismissing modal\n const atVerticalBoundry = isImageAtVerticalBoundry(scale.value)\n const panDirectionIsPrimarilyVertical = Math.abs(e.translationY) > Math.abs(e.translationX)\n const canDismissWhileZoomed = atVerticalBoundry && panDirectionIsPrimarilyVertical\n\n if (!(atDefaultScale || canDismissWhileZoomed)) return\n\n // Fade image if its been panned past 50% of the dismiss threshold\n const panDistance = Math.abs(e.translationY)\n const halfThreshold = DISMISS_PAN_THRESHOLD / 2\n const fadeDistance = Math.max(0, panDistance - halfThreshold)\n const fadeProgress = fadeDistance / halfThreshold\n\n opacity.value = Math.max(0, DEFAULT_OPACITY - fadeProgress)\n dismissY.value = e.translationY\n })\n .onEnd(() => {\n const exceededDismissThreshold = Math.abs(dismissY.value) > DISMISS_PAN_THRESHOLD\n\n if (exceededDismissThreshold) {\n runOnJS(handleCloseModal)()\n } else {\n runOnJS(resetDismissGestures)()\n }\n })\n\n /* ==============================\n COMPOSE GESTURES\n ================================= */\n // Race between pinch and pan ensures only one is active at a time, preserving focal point logic\n const pinchOrPanGestures = Gesture.Race(pinchGesture, panGesture)\n\n // Exclusive race ensures single tap doesn't interfere with double tap\n const tapGestures = Gesture.Exclusive(doubleTapGesture, singleTapGesture)\n\n // Race between tap gestures and pinch/pan\n const transformImageGestures = Gesture.Race(tapGestures, pinchOrPanGestures)\n\n // Dismiss can work simultaneously with all gestures\n const composedGesture = Gesture.Simultaneous(transformImageGestures, panToDismissModalGesture)\n\n return (\n <>\n <StatusBar\n barStyle=\"light-content\"\n hidden={isStatusBarHidden}\n animated\n showHideTransition=\"slide\"\n />\n <GestureHandlerRootView>\n <GestureDetector gesture={composedGesture}>\n <FlatList\n data={imageAttachments}\n renderItem={({ item, index }) => (\n <GestureImage\n item={item}\n gesturesEnabled={index === currentImageIndex}\n scale={scale}\n translateX={translateX}\n translateY={translateY}\n dismissY={dismissY}\n opacity={opacity}\n />\n )}\n keyExtractor={(item, index) => `${item.id}-${index}`}\n horizontal\n pagingEnabled\n scrollEnabled={flatListScrollEnabled}\n showsHorizontalScrollIndicator={false}\n initialScrollIndex={initialImageIndex}\n getItemLayout={getItemLayout}\n onMomentumScrollEnd={onMomentumScrollEnd}\n onViewableItemsChanged={onViewableItemsChanged}\n viewabilityConfig={{\n itemVisiblePercentThreshold: 50, // 50% of the image must be visible in the window to be considered viewable\n }}\n style={styles.gallery}\n contentContainerStyle={styles.galleryContentContainer}\n />\n </GestureDetector>\n </GestureHandlerRootView>\n <LightboxToolbarHeader\n metaProps={metaProps}\n lightboxToolbarVisible={lightboxToolbarVisible}\n isStatusBarHidden={isStatusBarHidden}\n handleOpenInBrowser={handleOpenInBrowser}\n handleCloseModal={handleCloseModal}\n />\n {imageAttachments.length > 1 && (\n <LightboxToolbarFooter\n lightboxToolbarVisible={lightboxToolbarVisible}\n totalImages={imageAttachments.length}\n currentImageIndex={currentImageIndex}\n />\n )}\n </>\n )\n}\n\ninterface GestureImageProps {\n item: DenormalizedMessageAttachmentResource\n gesturesEnabled: boolean\n scale: SharedValue<number>\n translateX: SharedValue<number>\n translateY: SharedValue<number>\n dismissY: SharedValue<number>\n opacity: SharedValue<number>\n}\n\nconst GestureImage = ({\n item,\n gesturesEnabled,\n scale,\n translateX,\n translateY,\n dismissY,\n opacity,\n}: GestureImageProps) => {\n const styles = useStyles()\n const { url: itemUrl, urlMedium: itemUrlMedium } = item.attributes\n\n const animatedImageStyles = useAnimatedStyle(() => {\n return {\n transform: [\n { translateX: gesturesEnabled ? translateX.value : DEFAULT_TRANSLATE_X },\n { translateY: gesturesEnabled ? translateY.value + dismissY.value : DEFAULT_TRANSLATE_Y },\n { scale: gesturesEnabled ? scale.value : DEFAULT_SCALE },\n ],\n opacity: opacity.value,\n }\n })\n\n return (\n <TouchEventIsolator>\n <Image\n source={{ uri: itemUrlMedium || itemUrl }}\n style={styles.gestureImage}\n animatedImageStyle={animatedImageStyles}\n loadingBackgroundStyles={styles.gestureImageLoading}\n resizeMode=\"contain\"\n alt=\"\"\n />\n </TouchEventIsolator>\n )\n}\n\nconst TouchEventIsolator = ({ children }: { children: React.ReactNode }) => {\n const styles = useStyles()\n\n return (\n <View style={styles.touchEventIsolator} onStartShouldSetResponder={() => true}>\n {children}\n </View>\n )\n}\n\ninterface LightboxToolbarHeaderProps {\n metaProps: MetaProps\n lightboxToolbarVisible: SharedValue<number>\n isStatusBarHidden: boolean\n handleOpenInBrowser: () => void\n handleCloseModal: () => void\n}\n\nconst LightboxToolbarHeader = ({\n metaProps,\n lightboxToolbarVisible,\n isStatusBarHidden,\n handleOpenInBrowser,\n handleCloseModal,\n}: LightboxToolbarHeaderProps) => {\n const styles = useStyles()\n const { authorName, createdAt } = metaProps\n\n const animatedHeaderStyles = useAnimatedStyle(() => ({\n opacity: lightboxToolbarVisible.value,\n transform: [\n { translateY: (1 - lightboxToolbarVisible.value) * -20 }, // slide up when hiding\n ],\n }))\n\n return (\n <Animated.View\n style={[styles.lightboxToolbar, styles.lightboxToolbarHeader, animatedHeaderStyles]}\n accessibilityRole=\"toolbar\"\n >\n <View style={styles.lightboxToolbarHeaderMetaContainer}>\n <Heading variant=\"h3\" style={styles.lightboxToolbarHeaderTitle} numberOfLines={1}>\n {authorName}\n </Heading>\n <Text variant=\"tertiary\" style={styles.lightboxToolbarHeaderSubtitle}>\n {formatDatePreview(createdAt)}\n </Text>\n </View>\n <IconButton\n onPress={handleOpenInBrowser}\n disabled={isStatusBarHidden}\n name=\"general.newWindow\"\n accessibilityRole=\"link\"\n accessibilityLabel=\"Open image in browser\"\n accessibilityHint=\"Image can be downloaded and shared through the browser.\"\n style={styles.lightboxToolbarButton}\n iconStyle={styles.lightboxToolbarButtonIcon}\n size=\"lg\"\n />\n <IconButton\n onPress={handleCloseModal}\n disabled={isStatusBarHidden}\n name=\"general.x\"\n accessibilityLabel=\"Close image\"\n style={styles.lightboxToolbarButton}\n iconStyle={styles.lightboxToolbarButtonIcon}\n size=\"lg\"\n />\n </Animated.View>\n )\n}\n\ninterface LightboxToolbarFooterProps {\n lightboxToolbarVisible: SharedValue<number>\n totalImages: number\n currentImageIndex: number\n}\n\nconst LightboxToolbarFooter = ({\n lightboxToolbarVisible,\n totalImages,\n currentImageIndex,\n}: LightboxToolbarFooterProps) => {\n const styles = useStyles()\n\n const animatedFooterStyles = useAnimatedStyle(() => ({\n opacity: lightboxToolbarVisible.value,\n transform: [\n { translateY: (1 - lightboxToolbarVisible.value) * 20 }, // slide down when showing\n ],\n }))\n\n return (\n <Animated.View\n style={[styles.lightboxToolbar, styles.lightboxToolbarFooter, animatedFooterStyles]}\n accessibilityRole=\"toolbar\"\n >\n <Text style={styles.lightboxToolbarFooterText}>\n {currentImageIndex + 1} of {totalImages}\n </Text>\n </Animated.View>\n )\n}\n\ninterface UseStylesProps {\n imageWidth?: number\n imageHeight?: number\n}\n\nconst useStyles = ({ imageWidth = 100, imageHeight = 100 }: UseStylesProps = {}) => {\n const { top, bottom } = useSafeAreaInsets()\n const backgroundColor = tokens.colorNeutral7\n const transparentBackgroundColor = useMemo(\n () => colorFunction(backgroundColor).alpha(0.8).toString(),\n [backgroundColor]\n )\n\n return StyleSheet.create({\n container: {\n maxWidth: '100%',\n },\n touchEventIsolator: {\n flex: 1,\n },\n attachmentImageWrapper: {\n width: '100%',\n minWidth: 200,\n aspectRatio: imageWidth / imageHeight,\n },\n image: {\n borderRadius: 8,\n },\n gallery: {\n backgroundColor,\n },\n galleryContentContainer: {\n paddingTop: top,\n paddingBottom: bottom,\n },\n gestureImage: {\n height: '100%',\n width: WINDOW_WIDTH,\n backgroundColor: 'transparent',\n },\n gestureImageLoading: {\n backgroundColor,\n },\n lightboxToolbar: {\n width: '100%',\n position: 'absolute',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 20,\n paddingHorizontal: 16,\n backgroundColor: transparentBackgroundColor,\n },\n lightboxToolbarButton: {\n backgroundColor,\n height: 40,\n width: 40,\n borderRadius: 50,\n borderWidth: 1,\n borderColor: tokens.colorNeutral24,\n },\n lightboxToolbarButtonIcon: {\n color: tokens.colorNeutral88,\n },\n lightboxToolbarHeader: {\n top: 0,\n paddingTop: top + 16,\n paddingBottom: 8,\n },\n lightboxToolbarHeaderMetaContainer: {\n flex: 1,\n },\n lightboxToolbarHeaderTitle: {\n marginRight: 'auto',\n flexShrink: 1,\n color: tokens.colorNeutral88,\n },\n lightboxToolbarHeaderSubtitle: {\n color: tokens.colorNeutral68,\n },\n lightboxToolbarFooter: {\n justifyContent: 'center',\n bottom: 0,\n paddingTop: 8,\n paddingBottom: bottom + 16,\n },\n lightboxToolbarFooterText: {\n color: tokens.colorNeutral88,\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"image_attachment.js","sourceRoot":"","sources":["../../../../src/components/conversation/attachments/image_attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAA4B,WAAW,EA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Ref } from 'react'\nimport {\n StatusBar,\n StyleSheet,\n Modal,\n View,\n Linking,\n Dimensions,\n NativeSyntheticEvent,\n NativeScrollEvent,\n ViewToken,\n} from 'react-native'\nimport { useSafeAreaInsets, SafeAreaProvider } from 'react-native-safe-area-context'\nimport {\n FlatList,\n Gesture,\n GestureDetector,\n GestureHandlerRootView,\n} from 'react-native-gesture-handler'\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useAnimatedReaction,\n useSharedValue,\n withSpring,\n withDecay,\n SharedValue,\n} from 'react-native-reanimated'\nimport { tokens } from '../../../vendor/tapestry/tokens'\nimport { IconButton, Image, Heading, Text } from '../../display'\nimport colorFunction from 'color'\nimport { formatDatePreview } from '../../../utils/date'\nimport { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'\nimport { PlatformPressable } from '@react-navigation/elements'\nimport { useTheme } from '../../../hooks'\nimport { Haptic, platformFontWeightMedium } from '../../../utils'\n\nconst { width: WINDOW_WIDTH, height: WINDOW_HEIGHT } = Dimensions.get('window')\nconst DISMISS_PAN_THRESHOLD = 175\nconst MIN_DISTANCE_FOR_PAN = 10 // Higher threshold gives pinching priority\nconst SINGLE_FINGER_POINTER = 1 // Single-finger panning / tapping helps to avoid conflicts with pinching\nconst DEFAULT_OPACITY = 1\nconst DEFAULT_TRANSLATE_X = 0\nconst DEFAULT_TRANSLATE_Y = 0\nconst DEFAULT_SCALE = 1\nconst MIN_SCALE = 0.5\nconst MAX_SCALE = 5\nconst MAX_SCALE_OVERSHOOT = 5\nconst DOUBLE_TAP_ZOOM_SCALE = 2\nconst DECAY_VELOCITY_FACTOR = 0.4\nconst RESET_SPRING_CONFIG = {\n damping: 20,\n stiffness: 150,\n}\n\nexport type MetaProps = {\n authorName: string\n createdAt: string\n}\n\nexport function ImageAttachment({\n attachment,\n imageAttachments,\n currentImageIndex,\n metaProps,\n onMessageAttachmentLongPress,\n}: {\n attachment: DenormalizedMessageAttachmentResource\n imageAttachments: DenormalizedMessageAttachmentResource[]\n currentImageIndex: number\n metaProps: MetaProps\n onMessageAttachmentLongPress: (attachment: DenormalizedMessageAttachmentResource) => void\n}) {\n const { attributes } = attachment\n const { url, urlMedium, filename, metadata = {} } = attributes\n const { colors } = useTheme()\n\n const styles = useStyles({ imageWidth: metadata.width, imageHeight: metadata.height })\n const [visible, setVisible] = useState(false)\n\n // Force modal to remount with fresh state\n // Fixes a bug where dismissing the modal too quickly causes the Reanimated shared values (like toolbarVisible) to not reset.\n const [modalKey, setModalKey] = useState(0)\n\n return (\n <>\n <PlatformPressable\n style={styles.container}\n onPress={() => {\n setModalKey(prev => prev + 1)\n setVisible(true)\n }}\n onLongPress={() => onMessageAttachmentLongPress(attachment)}\n android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}\n accessibilityHint=\"Long press for more options\"\n >\n <Image\n source={{ uri: urlMedium || url }}\n style={styles.image}\n wrapperStyle={styles.attachmentImageWrapper}\n alt={filename}\n />\n </PlatformPressable>\n <LightboxModal\n key={modalKey}\n visible={visible}\n setModalVisible={setVisible}\n imageAttachments={imageAttachments}\n initialImageIndex={currentImageIndex}\n metaProps={metaProps}\n />\n </>\n )\n}\n\ninterface LightboxModalProps {\n visible: boolean\n setModalVisible: Dispatch<SetStateAction<boolean>>\n imageAttachments: DenormalizedMessageAttachmentResource[]\n initialImageIndex: number\n metaProps: MetaProps\n}\n\nconst LightboxModal = ({\n visible,\n setModalVisible,\n imageAttachments,\n initialImageIndex,\n metaProps,\n}: LightboxModalProps) => {\n const onRequestClose = useCallback(() => {\n setModalVisible(false)\n }, [setModalVisible])\n\n return (\n <Modal visible={visible} transparent animationType=\"fade\" onRequestClose={onRequestClose}>\n <SafeAreaProvider>\n <LightboxGallery\n imageAttachments={imageAttachments}\n initialImageIndex={initialImageIndex}\n metaProps={metaProps}\n onRequestClose={onRequestClose}\n />\n </SafeAreaProvider>\n </Modal>\n )\n}\n\ninterface LightboxGalleryProps {\n imageAttachments: DenormalizedMessageAttachmentResource[]\n initialImageIndex: number\n metaProps: MetaProps\n onRequestClose: () => void\n}\nconst LightboxGallery = ({\n imageAttachments,\n initialImageIndex,\n metaProps,\n onRequestClose,\n}: LightboxGalleryProps) => {\n const styles = useStyles()\n const insets = useSafeAreaInsets()\n const [currentImageIndex, setCurrentImageIndex] = useState(initialImageIndex)\n const { soft: triggerMaxZoomHaptic, rigid: triggerDismissHaptic } = Haptic\n\n // Get current image data\n const currentImage = imageAttachments[currentImageIndex]\n const { url, urlMedium, metadata = {} } = currentImage.attributes\n const imageWidth = metadata.width\n const imageHeight = metadata.height\n\n // Calculate available space for image display\n const availableWindowWidth = WINDOW_WIDTH\n const availableWindowHeight = WINDOW_HEIGHT - insets.top - insets.bottom\n\n /* ============================\n ANIMATION VALUES\n ============================ */\n // Native State:\n const dismissY = useSharedValue(0) // vertical distance to dismiss modal\n const opacity = useSharedValue(DEFAULT_OPACITY) // opacity of modal\n const scale = useSharedValue(DEFAULT_SCALE) // zoom level of image\n const focalX = useSharedValue(0) // focal point of image between fingers\n const focalY = useSharedValue(0) // focal point of image between fingers\n const translateX = useSharedValue(DEFAULT_TRANSLATE_X) // horizontal distance to pan image\n const translateY = useSharedValue(DEFAULT_TRANSLATE_Y) // vertical distance to pan image\n const savedScale = useSharedValue(DEFAULT_SCALE) // previous zoom level\n const savedTranslateX = useSharedValue(DEFAULT_TRANSLATE_X) // previous horizontal position\n const savedTranslateY = useSharedValue(DEFAULT_TRANSLATE_Y) // previous vertical position\n const lightboxToolbarVisible = useSharedValue(1) // toolbar visibility state\n\n // React (JS) State:\n const [isStatusBarHidden, setIsStatusBarHidden] = useState(false)\n const [flatListScrollEnabled, setFlatListScrollEnabled] = useState(true)\n\n // Syncs toolbar useSharedValue state with React's state so that the status bar can be hidden/shown based on the toolbar's animation\n useAnimatedReaction(\n () => lightboxToolbarVisible.value,\n value => {\n runOnJS(setIsStatusBarHidden)(value === 0)\n }\n )\n\n /* ============================\n HANDLERS\n ============================ */\n const handleOpenInBrowser = useCallback(() => {\n Linking.openURL(urlMedium || url)\n }, [urlMedium, url])\n\n // Helper to enable or disable FlatList scroll state after gestures have ended\n const enableFlatListScroll = useCallback((enableScroll: boolean) => {\n setFlatListScrollEnabled(enableScroll)\n }, [])\n\n const resetDismissGestures = useCallback(() => {\n dismissY.value = withSpring(0, RESET_SPRING_CONFIG)\n opacity.value = withSpring(DEFAULT_OPACITY, RESET_SPRING_CONFIG)\n }, [dismissY, opacity])\n\n const resetAllGestures = useCallback(() => {\n resetDismissGestures()\n scale.value = withSpring(DEFAULT_SCALE, RESET_SPRING_CONFIG)\n translateX.value = withSpring(DEFAULT_TRANSLATE_X, RESET_SPRING_CONFIG)\n translateY.value = withSpring(DEFAULT_TRANSLATE_Y, RESET_SPRING_CONFIG)\n savedScale.value = DEFAULT_SCALE\n savedTranslateX.value = DEFAULT_TRANSLATE_X\n savedTranslateY.value = DEFAULT_TRANSLATE_Y\n lightboxToolbarVisible.value = withSpring(1, RESET_SPRING_CONFIG)\n enableFlatListScroll(true)\n }, [\n resetDismissGestures,\n scale,\n translateX,\n translateY,\n savedScale,\n savedTranslateX,\n savedTranslateY,\n lightboxToolbarVisible,\n enableFlatListScroll,\n ])\n\n const handleCloseModal = useCallback(() => {\n onRequestClose()\n resetAllGestures()\n }, [onRequestClose, resetAllGestures])\n\n /* ============================\n UTILITY WORKLET FUNCTIONS\n 'worklet' runs functions on the UI thread, instead of the JS thread for better performance.\n ============================ */\n const getImageContainedToWindowDimensions = () => {\n 'worklet'\n\n if (!imageWidth || !imageHeight) {\n return { width: availableWindowWidth, height: availableWindowHeight }\n }\n\n const imageAspectRatio = imageWidth / imageHeight\n const windowAspectRatio = availableWindowWidth / availableWindowHeight\n\n // Constrain image width if its wider than window\n if (imageAspectRatio > windowAspectRatio) {\n return {\n width: availableWindowWidth,\n height: availableWindowWidth / imageAspectRatio,\n }\n }\n\n // Constrain image height if its taller than window\n return {\n width: availableWindowHeight * imageAspectRatio,\n height: availableWindowHeight,\n }\n }\n\n const zoomToFocalPoint = ({\n focalPointX,\n focalPointY,\n targetScale,\n currentSavedScale,\n currentSavedTranslateX,\n currentSavedTranslateY,\n }: {\n focalPointX: number\n focalPointY: number\n targetScale: number\n currentSavedScale: number\n currentSavedTranslateX: number\n currentSavedTranslateY: number\n }) => {\n 'worklet'\n\n // How far the focal point is from the center of the window\n const windowCenterX = WINDOW_WIDTH / 2\n const windowCenterY = WINDOW_HEIGHT / 2\n\n // Position of focal point relative to current image position\n const focalRelativeX = focalPointX - windowCenterX - currentSavedTranslateX\n const focalRelativeY = focalPointY - windowCenterY - currentSavedTranslateY\n\n // Calculate new translation to keep focal point under fingers\n const scaleRatio = targetScale / currentSavedScale\n const newTranslateX = currentSavedTranslateX + focalRelativeX * (1 - scaleRatio)\n const newTranslateY = currentSavedTranslateY + focalRelativeY * (1 - scaleRatio)\n\n return {\n translateX: newTranslateX,\n translateY: newTranslateY,\n }\n }\n\n const getMaxTranslationLimits = (currentScale: number) => {\n 'worklet'\n\n const { width: containedImageWidth, height: containedImageHeight } =\n getImageContainedToWindowDimensions()\n\n // Image dimensions after scaling/zooming\n const scaledWidth = containedImageWidth * currentScale\n const scaledHeight = containedImageHeight * currentScale\n\n // How much the scaled image exceeds the window container\n const excessWidth = scaledWidth - availableWindowWidth\n const excessHeight = scaledHeight - availableWindowHeight\n\n // How far the image can move in each direction before hitting window edges\n const maxTranslateX = Math.max(DEFAULT_TRANSLATE_X, excessWidth / 2)\n const maxTranslateY = Math.max(DEFAULT_TRANSLATE_Y, excessHeight / 2)\n\n return { maxTranslateX, maxTranslateY }\n }\n\n const clampDecay = (currentScale: number): { x: [number, number]; y: [number, number] } => {\n 'worklet'\n\n const { maxTranslateX, maxTranslateY } = getMaxTranslationLimits(currentScale)\n\n return {\n x: [-maxTranslateX, maxTranslateX],\n y: [-maxTranslateY, maxTranslateY],\n }\n }\n\n const clampTranslation = ({\n x,\n y,\n currentScale,\n }: {\n x: number\n y: number\n currentScale: number\n }) => {\n 'worklet'\n\n const { maxTranslateX, maxTranslateY } = getMaxTranslationLimits(currentScale)\n\n return {\n x: Math.min(maxTranslateX, Math.max(-maxTranslateX, x)),\n y: Math.min(maxTranslateY, Math.max(-maxTranslateY, y)),\n }\n }\n\n const isImageAtVerticalBoundry = (currentScale: number) => {\n 'worklet'\n\n const { height: containedImageHeight } = getImageContainedToWindowDimensions()\n\n // Calculate how much the image can exceed the window container\n const scaledHeight = containedImageHeight * currentScale\n const excessHeight = scaledHeight - availableWindowHeight\n const maxTranslateY = Math.max(DEFAULT_TRANSLATE_Y, excessHeight / 2)\n\n const currentTranslateY = translateY.value\n const panPositionTolerance = 1 // buffer to account for translateY being at a subpixel position\n\n const atTopBoundry = currentTranslateY >= maxTranslateY - panPositionTolerance\n const atBottomBoundry = currentTranslateY <= -maxTranslateY + panPositionTolerance\n\n return atTopBoundry || atBottomBoundry\n }\n\n /* ============================\n UTILITY FLATLIST FUNCTIONS\n Supports the image gallery layout and swipe functionality.\n ============================ */\n\n // Use refs to avoid re-rendering FlatList callbacks...\n const stableCurrentImageIndexRef = useRef(currentImageIndex)\n const stableImageAttachmentsLengthRef = useRef(imageAttachments.length)\n // ...while still ensuring they are updated with the latest values\n stableCurrentImageIndexRef.current = currentImageIndex\n stableImageAttachmentsLengthRef.current = imageAttachments.length\n\n // Used in tandem with FlatList's initialScrollIndex to quickly calculate the position and size of each image before they load.\n const getItemLayout = useCallback(\n (_: unknown, index: number) => ({\n length: WINDOW_WIDTH,\n offset: WINDOW_WIDTH * index,\n index,\n }),\n []\n )\n\n // Captures the current image's index after the FlatList finishes its scroll animation.\n // Used in tandem with onViewableItemsChanged to ensure the final value for currentImageIndex is set.\n const onMomentumScrollEnd = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {\n // Calculate the index of the image that is currently visible\n const imageOffsetX = event.nativeEvent.contentOffset.x\n const newImageIndex = Math.round(imageOffsetX / WINDOW_WIDTH)\n\n // Check if the image index has changed and the FlatList didn't scroll past the first or last image\n const didImageIndexChange = newImageIndex !== stableCurrentImageIndexRef.current\n const isImageIndexWithinBounds =\n newImageIndex >= 0 && newImageIndex < stableImageAttachmentsLengthRef.current\n\n if (didImageIndexChange && isImageIndexWithinBounds) {\n setCurrentImageIndex(newImageIndex)\n }\n }, [])\n\n // Supplements onMomentumScrollEnd by capturing the current image's index while the FlatList is actively scrolling.\n // Used in tandem with viewabilityConfig to trigger when the image is 50% visible in the window.\n const onViewableItemsChanged = useCallback(\n ({ viewableItems }: { viewableItems: ViewToken<DenormalizedMessageAttachmentResource>[] }) => {\n if (viewableItems.length === 0) return\n\n // Use the first viewable item which is enforced by the FlatList's pagingEnabled prop that allows only two images to be visible at a time when scrolling.\n const firstViewableItem = viewableItems[0]\n const newIndex = firstViewableItem.index\n\n if (newIndex !== null && newIndex !== stableCurrentImageIndexRef.current) {\n setCurrentImageIndex(newIndex)\n }\n },\n []\n )\n\n /* ============================\n GESTURES\n ============================ */\n const singleTapGesture = Gesture.Tap()\n .minPointers(SINGLE_FINGER_POINTER)\n .numberOfTaps(1)\n .onStart(() => {\n lightboxToolbarVisible.value = withSpring(\n lightboxToolbarVisible.value > 0.5 ? 0 : 1,\n RESET_SPRING_CONFIG\n )\n })\n\n const doubleTapGesture = Gesture.Tap()\n .minPointers(SINGLE_FINGER_POINTER)\n .numberOfTaps(2)\n .onStart(e => {\n const isZoomedIn = scale.value > DEFAULT_SCALE\n if (isZoomedIn) {\n runOnJS(resetAllGestures)()\n } else {\n // Hide toolbar when starting to zoom\n lightboxToolbarVisible.value = withSpring(0, RESET_SPRING_CONFIG)\n\n // Zoom to 2x at tap location\n const newTranslation = zoomToFocalPoint({\n focalPointX: e.x,\n focalPointY: e.y,\n targetScale: DOUBLE_TAP_ZOOM_SCALE,\n currentSavedScale: savedScale.value,\n currentSavedTranslateX: savedTranslateX.value,\n currentSavedTranslateY: savedTranslateY.value,\n })\n\n // Apply clamping to ensure image edges remain within window boundaries\n const clampedTranslate = clampTranslation({\n x: newTranslation.translateX,\n y: newTranslation.translateY,\n currentScale: DOUBLE_TAP_ZOOM_SCALE,\n })\n\n // Animate to new scale and translation\n scale.value = withSpring(DOUBLE_TAP_ZOOM_SCALE, RESET_SPRING_CONFIG)\n translateX.value = withSpring(clampedTranslate.x, RESET_SPRING_CONFIG)\n translateY.value = withSpring(clampedTranslate.y, RESET_SPRING_CONFIG)\n\n // Update saved state for next gesture\n savedScale.value = DOUBLE_TAP_ZOOM_SCALE\n savedTranslateX.value = clampedTranslate.x\n savedTranslateY.value = clampedTranslate.y\n\n // Disable FlatList scroll since image is now zoomed\n runOnJS(enableFlatListScroll)(false)\n }\n })\n\n const pinchGesture = Gesture.Pinch()\n .onStart(e => {\n focalX.value = e.focalX\n focalY.value = e.focalY\n\n // Hide toolbar when starting to zoom\n lightboxToolbarVisible.value = withSpring(0, RESET_SPRING_CONFIG)\n\n // Ensure that pinch accounts for the decay animation and starts from the true current position.\n savedTranslateX.value = translateX.value\n savedTranslateY.value = translateY.value\n })\n .onUpdate(e => {\n // Zoom image in/out within scale limits\n const newScale = savedScale.value * e.scale\n const newScaleClamped = Math.min(\n MAX_SCALE + MAX_SCALE_OVERSHOOT,\n Math.max(MIN_SCALE, newScale)\n )\n\n // Check if we just reached the minimum scale threshold\n const previousScale = scale.value\n const reacjedMinScale = previousScale > MIN_SCALE && newScaleClamped <= MIN_SCALE\n\n if (reacjedMinScale) {\n runOnJS(triggerDismissHaptic)()\n }\n\n scale.value = newScaleClamped\n\n // Calculate new translation to keep focal point under fingers\n const newTranslation = zoomToFocalPoint({\n focalPointX: focalX.value,\n focalPointY: focalY.value,\n targetScale: newScaleClamped,\n currentSavedScale: savedScale.value,\n currentSavedTranslateX: savedTranslateX.value,\n currentSavedTranslateY: savedTranslateY.value,\n })\n\n // Apply translation without clamping to ensure focal point doesn't jump during gesture\n translateX.value = newTranslation.translateX\n translateY.value = newTranslation.translateY\n })\n .onEnd(() => {\n const currentScale = scale.value\n\n // Dismiss modal if fully zoomed out\n if (currentScale <= MIN_SCALE) {\n runOnJS(handleCloseModal)()\n return\n }\n\n // Reset all gestures if image is near default scale\n const isNearDefaultScale = currentScale <= DEFAULT_SCALE + 0.1\n if (isNearDefaultScale) {\n runOnJS(resetAllGestures)()\n return\n }\n\n // Check if overshooting the max scale and clamp it\n const finalScale = currentScale > MAX_SCALE ? MAX_SCALE : currentScale\n\n if (finalScale === MAX_SCALE) {\n runOnJS(triggerMaxZoomHaptic)()\n }\n\n // Recalculate translation using focal point to always return to the same position when image is overshooting the max scale\n const newTranslation = zoomToFocalPoint({\n focalPointX: focalX.value,\n focalPointY: focalY.value,\n targetScale: finalScale,\n currentSavedScale: savedScale.value,\n currentSavedTranslateX: savedTranslateX.value,\n currentSavedTranslateY: savedTranslateY.value,\n })\n\n // Ensure image edges remain within window boundaries\n const clampedTranslate = clampTranslation({\n x: newTranslation.translateX,\n y: newTranslation.translateY,\n currentScale: finalScale,\n })\n\n // Animate to position and scale limits with a spring\n scale.value = withSpring(finalScale, RESET_SPRING_CONFIG)\n translateX.value = withSpring(clampedTranslate.x, RESET_SPRING_CONFIG)\n translateY.value = withSpring(clampedTranslate.y, RESET_SPRING_CONFIG)\n\n // Save state for next gesture\n savedScale.value = finalScale\n savedTranslateX.value = clampedTranslate.x\n savedTranslateY.value = clampedTranslate.y\n\n // Disable FlatList scroll since image is still zoomed\n runOnJS(enableFlatListScroll)(false)\n })\n\n const panGesture = Gesture.Pan()\n .minDistance(MIN_DISTANCE_FOR_PAN)\n .minPointers(SINGLE_FINGER_POINTER)\n .maxPointers(SINGLE_FINGER_POINTER)\n .onStart(() => {\n // Only start pan if image is zoomed in - prevents conflicts with FlatList\n if (scale.value <= DEFAULT_SCALE) return\n\n // Update saved position to current animated position\n // This ensures smooth continuation if decay is running\n savedTranslateX.value = translateX.value\n savedTranslateY.value = translateY.value\n })\n .onUpdate(e => {\n // Only pan if image is zoomed in - prevents conflicts with FlatList\n if (scale.value <= DEFAULT_SCALE) return\n\n const newTranslateX = savedTranslateX.value + e.translationX\n const newTranslateY = savedTranslateY.value + e.translationY\n\n // Ensure image edges remain within window boundaries\n const clampedTranslate = clampTranslation({\n x: newTranslateX,\n y: newTranslateY,\n currentScale: scale.value,\n })\n translateX.value = clampedTranslate.x\n translateY.value = clampedTranslate.y\n })\n .onEnd(e => {\n // Prevents saving pan position if image is zoomed out while panning\n if (scale.value <= DEFAULT_SCALE) return\n\n const clampDecayBounds = clampDecay(scale.value)\n\n translateX.value = withDecay(\n {\n velocity: e.velocityX * DECAY_VELOCITY_FACTOR,\n clamp: clampDecayBounds.x,\n deceleration: 0.996,\n },\n finished => {\n if (finished) {\n savedTranslateX.value = translateX.value\n }\n }\n )\n\n translateY.value = withDecay(\n {\n velocity: e.velocityY * DECAY_VELOCITY_FACTOR,\n clamp: clampDecayBounds.y,\n deceleration: 0.996,\n },\n finished => {\n if (finished) {\n savedTranslateY.value = translateY.value\n }\n }\n )\n })\n\n const panToDismissModalGesture = Gesture.Pan()\n .onUpdate(e => {\n const atDefaultScale = scale.value === DEFAULT_SCALE\n\n // Calculate zoom conditions for dismissing modal\n const atVerticalBoundry = isImageAtVerticalBoundry(scale.value)\n const panDirectionIsPrimarilyVertical = Math.abs(e.translationY) > Math.abs(e.translationX)\n const canDismissWhileZoomed = atVerticalBoundry && panDirectionIsPrimarilyVertical\n\n if (!(atDefaultScale || canDismissWhileZoomed)) return\n\n // Fade image if its been panned past 50% of the dismiss threshold\n const panDistance = Math.abs(e.translationY)\n const halfThreshold = DISMISS_PAN_THRESHOLD / 2\n const fadeDistance = Math.max(0, panDistance - halfThreshold)\n const fadeProgress = fadeDistance / halfThreshold\n\n // Check if we just crossed the dismiss threshold\n const previousDistance = Math.abs(dismissY.value)\n const crossedDismissThreshold =\n previousDistance < DISMISS_PAN_THRESHOLD && panDistance >= DISMISS_PAN_THRESHOLD\n\n if (crossedDismissThreshold) {\n runOnJS(triggerDismissHaptic)()\n }\n\n opacity.value = Math.max(0, DEFAULT_OPACITY - fadeProgress)\n dismissY.value = e.translationY\n })\n .onEnd(() => {\n const exceededDismissThreshold = Math.abs(dismissY.value) > DISMISS_PAN_THRESHOLD\n\n if (exceededDismissThreshold) {\n runOnJS(handleCloseModal)()\n } else {\n runOnJS(resetDismissGestures)()\n }\n })\n\n /* ==============================\n COMPOSE GESTURES\n ================================= */\n // Race between pinch and pan ensures only one is active at a time, preserving focal point logic\n const pinchOrPanGestures = Gesture.Race(pinchGesture, panGesture)\n\n // Exclusive race ensures single tap doesn't interfere with double tap\n const tapGestures = Gesture.Exclusive(doubleTapGesture, singleTapGesture)\n\n // Race between tap gestures and pinch/pan\n const transformImageGestures = Gesture.Race(tapGestures, pinchOrPanGestures)\n\n // Dismiss can work simultaneously with all gestures\n const composedGesture = Gesture.Simultaneous(transformImageGestures, panToDismissModalGesture)\n\n return (\n <>\n <StatusBar\n barStyle=\"light-content\"\n hidden={isStatusBarHidden}\n animated\n showHideTransition=\"slide\"\n />\n <GestureHandlerRootView>\n <GestureDetector gesture={composedGesture}>\n <FlatList\n data={imageAttachments}\n renderItem={({ item, index }) => (\n <GestureImage\n item={item}\n gesturesEnabled={index === currentImageIndex}\n scale={scale}\n translateX={translateX}\n translateY={translateY}\n dismissY={dismissY}\n opacity={opacity}\n />\n )}\n keyExtractor={(item, index) => `${item.id}-${index}`}\n horizontal\n pagingEnabled\n scrollEnabled={flatListScrollEnabled}\n showsHorizontalScrollIndicator={false}\n initialScrollIndex={initialImageIndex}\n getItemLayout={getItemLayout}\n onMomentumScrollEnd={onMomentumScrollEnd}\n onViewableItemsChanged={onViewableItemsChanged}\n viewabilityConfig={{\n itemVisiblePercentThreshold: 50, // 50% of the image must be visible in the window to be considered viewable\n }}\n style={styles.gallery}\n contentContainerStyle={styles.galleryContentContainer}\n />\n </GestureDetector>\n </GestureHandlerRootView>\n <LightboxToolbarHeader\n metaProps={metaProps}\n lightboxToolbarVisible={lightboxToolbarVisible}\n isStatusBarHidden={isStatusBarHidden}\n handleOpenInBrowser={handleOpenInBrowser}\n handleCloseModal={handleCloseModal}\n />\n {imageAttachments.length > 1 && (\n <LightboxToolbarFooter\n lightboxToolbarVisible={lightboxToolbarVisible}\n totalImages={imageAttachments.length}\n currentImageIndex={currentImageIndex}\n />\n )}\n </>\n )\n}\n\ninterface GestureImageProps {\n item: DenormalizedMessageAttachmentResource\n gesturesEnabled: boolean\n scale: SharedValue<number>\n translateX: SharedValue<number>\n translateY: SharedValue<number>\n dismissY: SharedValue<number>\n opacity: SharedValue<number>\n}\n\nconst GestureImage = ({\n item,\n gesturesEnabled,\n scale,\n translateX,\n translateY,\n dismissY,\n opacity,\n}: GestureImageProps) => {\n const styles = useStyles()\n const { url: itemUrl, urlMedium: itemUrlMedium } = item.attributes\n\n const animatedImageStyles = useAnimatedStyle(() => {\n return {\n transform: [\n { translateX: gesturesEnabled ? translateX.value : DEFAULT_TRANSLATE_X },\n { translateY: gesturesEnabled ? translateY.value + dismissY.value : DEFAULT_TRANSLATE_Y },\n { scale: gesturesEnabled ? scale.value : DEFAULT_SCALE },\n ],\n opacity: opacity.value,\n }\n })\n\n return (\n <TouchEventIsolator>\n <Image\n source={{ uri: itemUrlMedium || itemUrl }}\n style={styles.gestureImage}\n animatedImageStyle={animatedImageStyles}\n loadingBackgroundStyles={styles.gestureImageLoading}\n resizeMode=\"contain\"\n alt=\"\"\n />\n </TouchEventIsolator>\n )\n}\n\nconst TouchEventIsolator = ({ children }: { children: React.ReactNode }) => {\n const styles = useStyles()\n\n return (\n <View style={styles.touchEventIsolator} onStartShouldSetResponder={() => true}>\n {children}\n </View>\n )\n}\n\ninterface LightboxToolbarHeaderProps {\n metaProps: MetaProps\n lightboxToolbarVisible: SharedValue<number>\n isStatusBarHidden: boolean\n handleOpenInBrowser: () => void\n handleCloseModal: () => void\n}\n\nconst LightboxToolbarHeader = ({\n metaProps,\n lightboxToolbarVisible,\n isStatusBarHidden,\n handleOpenInBrowser,\n handleCloseModal,\n}: LightboxToolbarHeaderProps) => {\n const styles = useStyles()\n const { authorName, createdAt } = metaProps\n\n const animatedHeaderStyles = useAnimatedStyle(() => ({\n opacity: lightboxToolbarVisible.value,\n transform: [\n { translateY: (1 - lightboxToolbarVisible.value) * -20 }, // slide up when hiding\n ],\n }))\n\n return (\n <Animated.View\n style={[styles.lightboxToolbar, styles.lightboxToolbarHeader, animatedHeaderStyles]}\n accessibilityRole=\"toolbar\"\n >\n <View style={styles.lightboxToolbarHeaderMetaContainer}>\n <Heading variant=\"h3\" style={styles.lightboxToolbarHeaderTitle} numberOfLines={1}>\n {authorName}\n </Heading>\n <Text variant=\"tertiary\" style={styles.lightboxToolbarHeaderSubtitle}>\n {formatDatePreview(createdAt)}\n </Text>\n </View>\n <IconButton\n onPress={handleOpenInBrowser}\n disabled={isStatusBarHidden}\n name=\"general.newWindow\"\n accessibilityRole=\"link\"\n accessibilityLabel=\"Open image in browser\"\n accessibilityHint=\"Image can be downloaded and shared through the browser.\"\n style={styles.lightboxToolbarButton}\n iconStyle={styles.lightboxToolbarButtonIcon}\n size=\"lg\"\n />\n <IconButton\n onPress={handleCloseModal}\n disabled={isStatusBarHidden}\n name=\"general.x\"\n accessibilityLabel=\"Close image\"\n style={styles.lightboxToolbarButton}\n iconStyle={styles.lightboxToolbarButtonIcon}\n size=\"lg\"\n />\n </Animated.View>\n )\n}\n\ninterface LightboxToolbarFooterProps {\n lightboxToolbarVisible: SharedValue<number>\n totalImages: number\n currentImageIndex: number\n}\n\nconst LightboxToolbarFooter = ({\n lightboxToolbarVisible,\n totalImages,\n currentImageIndex,\n}: LightboxToolbarFooterProps) => {\n const styles = useStyles()\n\n const animatedFooterStyles = useAnimatedStyle(() => ({\n opacity: lightboxToolbarVisible.value,\n transform: [\n { translateY: (1 - lightboxToolbarVisible.value) * 20 }, // slide down when showing\n ],\n }))\n\n return (\n <Animated.View\n style={[styles.lightboxToolbar, styles.lightboxToolbarFooter, animatedFooterStyles]}\n accessibilityRole=\"toolbar\"\n >\n <Text style={styles.lightboxToolbarFooterText}>\n {currentImageIndex + 1} of {totalImages}\n </Text>\n </Animated.View>\n )\n}\n\ninterface UseStylesProps {\n imageWidth?: number\n imageHeight?: number\n}\n\nconst useStyles = ({ imageWidth = 100, imageHeight = 100 }: UseStylesProps = {}) => {\n const { top, bottom } = useSafeAreaInsets()\n const backgroundColor = tokens.colorNeutral7\n const transparentBackgroundColor = useMemo(\n () => colorFunction(backgroundColor).alpha(0.8).toString(),\n [backgroundColor]\n )\n\n return StyleSheet.create({\n container: {\n maxWidth: '100%',\n },\n touchEventIsolator: {\n flex: 1,\n },\n attachmentImageWrapper: {\n width: '100%',\n minWidth: 200,\n aspectRatio: imageWidth / imageHeight,\n },\n image: {\n borderRadius: 8,\n },\n gallery: {\n backgroundColor,\n },\n galleryContentContainer: {\n paddingTop: top,\n paddingBottom: bottom,\n },\n gestureImage: {\n height: '100%',\n width: WINDOW_WIDTH,\n backgroundColor: 'transparent',\n },\n gestureImageLoading: {\n backgroundColor,\n },\n lightboxToolbar: {\n width: '100%',\n position: 'absolute',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 20,\n paddingHorizontal: 16,\n backgroundColor: transparentBackgroundColor,\n },\n lightboxToolbarButton: {\n backgroundColor,\n height: 40,\n width: 40,\n borderRadius: 50,\n borderWidth: 1,\n borderColor: tokens.colorNeutral24,\n },\n lightboxToolbarButtonIcon: {\n color: tokens.colorNeutral88,\n },\n lightboxToolbarHeader: {\n top: 0,\n paddingTop: top + 16,\n paddingBottom: 8,\n },\n lightboxToolbarHeaderMetaContainer: {\n flex: 1,\n },\n lightboxToolbarHeaderTitle: {\n marginRight: 'auto',\n flexShrink: 1,\n color: tokens.colorNeutral88,\n },\n lightboxToolbarHeaderSubtitle: {\n color: tokens.colorNeutral68,\n },\n lightboxToolbarFooter: {\n justifyContent: 'center',\n bottom: 0,\n paddingTop: 8,\n paddingBottom: bottom + 16,\n },\n lightboxToolbarFooterText: {\n color: tokens.colorNeutral88,\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"message_reaction.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAKtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG7C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,CAM1E,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,WAAW,EACX,OAAO,EACP,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,WAAW,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACvD,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;CACvB,4BA8BA;AAED,eAAO,MAAM,iBAAiB,aAAc;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;CA0B3D,CAAA"}
1
+ {"version":3,"file":"message_reaction.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAKtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAI7C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,CAM1E,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,WAAW,EACX,OAAO,EACP,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,WAAW,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACvD,OAAO,EAAE,eAAe,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;CACvB,4BA+BA;AAED,eAAO,MAAM,iBAAiB,aAAc;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;CA0B3D,CAAA"}
@@ -6,6 +6,7 @@ import { Text } from '../../components/display';
6
6
  import { useInteractionGhostBackgroundColor, useTheme } from '../../hooks';
7
7
  import { useMessageReactionToggle } from '../../hooks/use_message_reaction_toggle';
8
8
  import { useCreateAndroidRippleColor } from '../../hooks/use_create_android_ripple_color';
9
+ import { Haptic } from '../../utils/native_adapters';
9
10
  export const REACTION_EMOJIS = {
10
11
  thumbs_up: '👍',
11
12
  thumbs_down: '👎',
@@ -27,6 +28,7 @@ export function MessageReaction({ reaction, onLongPress, message, conversationId
27
28
  if (!REACTION_EMOJIS[reaction.value])
28
29
  return null;
29
30
  const handlePress = () => {
31
+ Haptic.impactLight();
30
32
  handleReactionToggle({ value: reaction.value, mine: !!reaction.mine });
31
33
  };
32
34
  return (<PlatformPressable key={reaction.value} style={styles.reaction} onLongPress={() => onLongPress(reaction)} onPress={handlePress} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}>
@@ -1 +1 @@
1
- {"version":3,"file":"message_reaction.js","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,kCAAkC,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAGlF,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAA;AAEzF,MAAM,CAAC,MAAM,eAAe,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,iBAAiB,EAAE,CAAC;YACpB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;QAC9C,YAAY,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,uBAAuB,EAAE;KACtE,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport colorFunction from 'color'\nimport React, { useMemo } from 'react'\nimport { StyleSheet } from 'react-native'\nimport { Text } from '../../components/display'\nimport { useInteractionGhostBackgroundColor, useTheme } from '../../hooks'\nimport { useMessageReactionToggle } from '../../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageResource } from '../../types'\nimport { useCreateAndroidRippleColor } from '../../hooks/use_create_android_ripple_color'\n\nexport const REACTION_EMOJIS: Record<ReactionCountResource['value'], string> = {\n thumbs_up: '👍',\n thumbs_down: '👎',\n pray: '🙏',\n laugh: '😂',\n heart: '❤️',\n}\n\nexport function MessageReaction({\n reaction,\n onLongPress,\n message,\n conversationId,\n}: {\n reaction: ReactionCountResource\n onLongPress: (_reaction: ReactionCountResource) => void\n message: MessageResource\n conversationId: number\n}) {\n const styles = useReactionStyles(reaction)\n const { handleReactionToggle } = useMessageReactionToggle({\n conversation_id: conversationId,\n message,\n })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n if (!reaction.count) return null\n if (!REACTION_EMOJIS[reaction.value]) return null\n\n const handlePress = () => {\n handleReactionToggle({ value: reaction.value, mine: !!reaction.mine })\n }\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={styles.reaction}\n onLongPress={() => onLongPress(reaction)}\n onPress={handlePress}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n <Text style={styles.reactionText}>{reaction.count}</Text>\n </PlatformPressable>\n )\n}\n\nexport const useReactionStyles = ({ mine }: { mine: number }) => {\n const { colors } = useTheme()\n const activeBorderColor = useMemo(() => {\n return colorFunction(colors.interaction)\n .hsl()\n .lightness(colors.name === 'dark' ? 20 : 80)\n .string()\n }, [colors.interaction, colors.name])\n const activeBackgroundColor = useInteractionGhostBackgroundColor()\n\n return StyleSheet.create({\n reaction: {\n borderWidth: 1,\n borderColor: mine ? activeBorderColor : 'transparent',\n backgroundColor: mine ? activeBackgroundColor : colors.fillColorNeutral060,\n borderRadius: 16,\n overflow: 'hidden',\n paddingVertical: 4,\n paddingHorizontal: 8,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 2,\n },\n reactionEmoji: { fontSize: 12, paddingTop: 0 },\n reactionText: { fontSize: 12, color: colors.textColorDefaultPrimary },\n })\n}\n"]}
1
+ {"version":3,"file":"message_reaction.js","sourceRoot":"","sources":["../../../src/components/conversation/message_reaction.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,aAAa,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,kCAAkC,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAGlF,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAA;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAmD;IAC7E,SAAS,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AAE,CAAC;YAClB,iBAAiB,EAAE,CAAC;YACpB,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;SACP;QACD,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE;QAC9C,YAAY,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,uBAAuB,EAAE;KACtE,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport colorFunction from 'color'\nimport React, { useMemo } from 'react'\nimport { StyleSheet } from 'react-native'\nimport { Text } from '../../components/display'\nimport { useInteractionGhostBackgroundColor, useTheme } from '../../hooks'\nimport { useMessageReactionToggle } from '../../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../../types/resources/reaction'\nimport { MessageResource } from '../../types'\nimport { useCreateAndroidRippleColor } from '../../hooks/use_create_android_ripple_color'\nimport { Haptic } from '../../utils/native_adapters'\n\nexport const REACTION_EMOJIS: Record<ReactionCountResource['value'], string> = {\n thumbs_up: '👍',\n thumbs_down: '👎',\n pray: '🙏',\n laugh: '😂',\n heart: '❤️',\n}\n\nexport function MessageReaction({\n reaction,\n onLongPress,\n message,\n conversationId,\n}: {\n reaction: ReactionCountResource\n onLongPress: (_reaction: ReactionCountResource) => void\n message: MessageResource\n conversationId: number\n}) {\n const styles = useReactionStyles(reaction)\n const { handleReactionToggle } = useMessageReactionToggle({\n conversation_id: conversationId,\n message,\n })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n if (!reaction.count) return null\n if (!REACTION_EMOJIS[reaction.value]) return null\n\n const handlePress = () => {\n Haptic.impactLight()\n handleReactionToggle({ value: reaction.value, mine: !!reaction.mine })\n }\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={styles.reaction}\n onLongPress={() => onLongPress(reaction)}\n onPress={handlePress}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n <Text style={styles.reactionText}>{reaction.count}</Text>\n </PlatformPressable>\n )\n}\n\nexport const useReactionStyles = ({ mine }: { mine: number }) => {\n const { colors } = useTheme()\n const activeBorderColor = useMemo(() => {\n return colorFunction(colors.interaction)\n .hsl()\n .lightness(colors.name === 'dark' ? 20 : 80)\n .string()\n }, [colors.interaction, colors.name])\n const activeBackgroundColor = useInteractionGhostBackgroundColor()\n\n return StyleSheet.create({\n reaction: {\n borderWidth: 1,\n borderColor: mine ? activeBorderColor : 'transparent',\n backgroundColor: mine ? activeBackgroundColor : colors.fillColorNeutral060,\n borderRadius: 16,\n overflow: 'hidden',\n paddingVertical: 4,\n paddingHorizontal: 8,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 2,\n },\n reactionEmoji: { fontSize: 12, paddingTop: 0 },\n reactionText: { fontSize: 12, color: colors.textColorDefaultPrimary },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"message_actions_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAGzF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAY1C,eAAO,MAAM,2BAA2B,uEAGtC,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;IACxD,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAC,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,yBAAyB,qBAqJxE"}
1
+ {"version":3,"file":"message_actions_screen.d.ts","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAGzF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAY1C,eAAO,MAAM,2BAA2B,uEAGtC,CAAA;AAEF,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;IACxD,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,4BAA4B,CAAC,EAAE,OAAO,CAAA;CACvC,CAAC,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,EAAE,KAAK,EAAE,EAAE,yBAAyB,qBAsJxE"}
@@ -90,10 +90,13 @@ export function MessageActionsScreen({ route }) {
90
90
  }, [navigation, conversation_id, message_id]);
91
91
  return (<FormSheet.Root style={styles.formSheetContent}>
92
92
  <View style={styles.reactionList}>
93
- {availableReactions.map((reaction, index) => (<Reaction key={index} reaction={reaction} onPress={() => handleReactionToggle({
94
- value: reaction.value,
95
- mine: reaction.mine,
96
- })}/>))}
93
+ {availableReactions.map((reaction, index) => (<Reaction key={index} reaction={reaction} onPress={() => {
94
+ Haptic.impactLight();
95
+ handleReactionToggle({
96
+ value: reaction.value,
97
+ mine: reaction.mine,
98
+ });
99
+ }}/>))}
97
100
  </View>
98
101
  <View style={styles.actions}>
99
102
  <FormSheet.Action onPress={handleCopyPress} title="Copy text" iconName="services.fileCopy" accessibilityHint="Copies text and links to clipboard"/>
@@ -1 +1 @@
1
- {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW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AQ;YACxB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,EAAE;YACjB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;YAChD,iBAAiB,EAAE,CAAC;SACrB;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const navigation = useNavigation()\n const { conversation_id, message_id, canDeleteNonAuthoredMessages } = route.params\n\n const apiClient = useApiClient()\n const styles = useStyles()\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) fail('Message not found')\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n onSuccess: () => navigation.goBack(),\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message_id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message_id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n onSuccess: () => {\n refetch()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },\n ])\n }, [handleDeleteMessage])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRoute = state?.routes?.find(r => r.name === 'Conversation')\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('Conversation', params))\n }, [navigation, conversation_id, message_id])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message_id])\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() =>\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n }\n />\n ))}\n </View>\n <View style={styles.actions}>\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"message_actions_screen.js","sourceRoot":"","sources":["../../src/screens/message_actions_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAA;AAChG,OAAO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,QAAQ,EAAE;YACR,MAAM,EAAE,eAAe;YACvB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,cAAc;YAC3B,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;SACnB;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,EAAE;SACb;QACD,OAAO,EAAE;YACP,UAAU,EAAE,CAAC;SACd;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements'\nimport { StackActions, StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport { useMutation } from '@tanstack/react-query'\nimport { isNil, omitBy } from 'lodash'\nimport React, { useCallback } from 'react'\nimport { Alert, Platform, StyleSheet, View } from 'react-native'\nimport { Text } from '../components'\nimport { REACTION_EMOJIS, useReactionStyles } from '../components/conversation/message_reaction'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCreateAndroidRippleColor, useFontScale, useTheme } from '../hooks'\nimport { useApiClient } from '../hooks/use_api_client'\nimport { useConversationMessages } from '../hooks/use_conversation_messages'\nimport { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'\nimport { ReactionCountResource } from '../types/resources/reaction'\nimport { Clipboard, Haptic } from '../utils/native_adapters'\n\nexport const MessageActionsScreenOptions = getFormSheetScreenOptions({\n sheetAllowedDetents: [0.5],\n headerTitle: 'Message actions',\n})\n\nexport type MessageActionsScreenProps = StaticScreenProps<{\n message_id: string\n conversation_id: number\n canDeleteNonAuthoredMessages?: boolean\n}>\n\nexport function MessageActionsScreen({ route }: MessageActionsScreenProps) {\n const navigation = useNavigation()\n const { conversation_id, message_id, canDeleteNonAuthoredMessages } = route.params\n\n const apiClient = useApiClient()\n const styles = useStyles()\n\n const { messages, refetch } = useConversationMessages(\n { conversation_id },\n { refetchOnMount: false }\n )\n const message = messages.find(m => m.id === message_id)\n\n if (!message) fail('Message not found')\n\n const myReactions = message?.reactionCounts\n .filter(reaction => reaction.mine)\n .map(reaction => reaction.value)\n\n const availableReactions = Object.entries(REACTION_EMOJIS).map(([value, emoji]) => {\n return {\n value: value as ReactionCountResource['value'],\n emoji,\n mine: myReactions?.includes(value as ReactionCountResource['value']),\n }\n })\n\n const attachmentForCopy = (): string => {\n const giphyTitleLink = message?.attachments.find(\n attachment => attachment.type === 'giphy'\n )?.titleLink\n\n if (giphyTitleLink) return giphyTitleLink\n return ''\n }\n\n const handleCopyPress = () => {\n Clipboard.setStringAsync(message?.text || attachmentForCopy() || '')\n navigation.goBack()\n }\n\n const { handleReactionToggle, isPending } = useMessageReactionToggle({\n conversation_id,\n message,\n onSuccess: () => navigation.goBack(),\n })\n\n const deleteMessage = useCallback(() => {\n const url = `/me/conversations/${conversation_id}/messages/${message_id}/`\n\n return apiClient.chat.delete({ url })\n }, [apiClient, conversation_id, message_id])\n\n const { mutate: handleDeleteMessage } = useMutation({\n mutationFn: deleteMessage,\n onSuccess: () => {\n refetch()\n navigation.goBack()\n },\n onError: () => {\n Alert.alert('Oops', 'We were unable to delete this message. Please try again.')\n },\n })\n\n const handleDeleteConfirm = useCallback(() => {\n Alert.alert('Delete message', 'Are you sure you want to permanently delete this message?', [\n { text: 'Cancel', style: 'cancel' },\n { text: 'Delete', style: 'destructive', onPress: () => handleDeleteMessage() },\n ])\n }, [handleDeleteMessage])\n\n const handleEditPress = useCallback(() => {\n const state = navigation.getState?.()\n const targetRoute = state?.routes?.find(r => r.name === 'Conversation')\n const params = omitBy(\n {\n ...(targetRoute?.params || {}),\n conversation_id,\n editing_message_id: message_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('Conversation', params))\n }, [navigation, conversation_id, message_id])\n\n const handleViewReadReceiptsPress = useCallback(() => {\n Haptic.impactLight()\n const params = omitBy(\n {\n conversation_id,\n message_id,\n },\n isNil\n )\n navigation.dispatch(StackActions.popTo('MessageReadReceipts', params))\n }, [navigation, conversation_id, message_id])\n\n return (\n <FormSheet.Root style={styles.formSheetContent}>\n <View style={styles.reactionList}>\n {availableReactions.map((reaction, index) => (\n <Reaction\n key={index}\n reaction={reaction}\n onPress={() => {\n Haptic.impactLight()\n handleReactionToggle({\n value: reaction.value,\n mine: reaction.mine,\n })\n }}\n />\n ))}\n </View>\n <View style={styles.actions}>\n <FormSheet.Action\n onPress={handleCopyPress}\n title=\"Copy text\"\n iconName=\"services.fileCopy\"\n accessibilityHint=\"Copies text and links to clipboard\"\n />\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleEditPress()}\n title=\"Edit message\"\n iconName=\"accounts.editor\"\n accessibilityHint=\"Opens existing text in the message form input.\"\n />\n )}\n {message?.mine && (\n <FormSheet.Action\n onPress={() => handleViewReadReceiptsPress()}\n title=\"View read receipts\"\n iconName=\"general.checkPerson\"\n accessibilityHint=\"Opens a modal with a list of people who read your message.\"\n />\n )}\n {(message?.mine || canDeleteNonAuthoredMessages) && (\n <FormSheet.Action\n onPress={() => handleDeleteConfirm()}\n title=\"Delete message\"\n iconName=\"publishing.trash\"\n appearance=\"danger\"\n disabled={isPending}\n accessibilityHint=\"Opens a confirmation alert to delete this message permanently.\"\n />\n )}\n </View>\n </FormSheet.Root>\n )\n}\n\nconst Reaction = ({\n reaction,\n onPress,\n}: {\n reaction: { value: ReactionCountResource['value']; emoji: string; mine: boolean | undefined }\n onPress: () => void\n}) => {\n const styles = useStyles()\n const reactionStyles = useReactionStyles({ mine: reaction.mine ? 1 : 0 })\n\n const { colors } = useTheme()\n const baseRippleColor = reaction.mine ? colors.interaction : colors.fillColorNeutral060\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n return (\n <PlatformPressable\n key={reaction.value}\n style={[reactionStyles.reaction, styles.reaction]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={onPress}\n >\n <Text style={styles.reactionEmoji}>{REACTION_EMOJIS[reaction.value]}</Text>\n </PlatformPressable>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier: 1.3 })\n\n const btnBorderWidth = 1\n const baseSize = 46 * fontScale\n const reactionBtnSize = Platform.select({\n ios: baseSize,\n android: baseSize + btnBorderWidth * 2,\n })\n\n return StyleSheet.create({\n formSheetContent: {\n paddingTop: 16,\n },\n reactionList: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n gap: 16,\n paddingTop: 8,\n paddingBottom: 16,\n borderBottomColor: colors.borderColorDefaultBase,\n borderBottomWidth: 1,\n },\n reaction: {\n height: reactionBtnSize,\n width: reactionBtnSize,\n borderWidth: btnBorderWidth,\n borderRadius: 32,\n justifyContent: 'center',\n overflow: 'hidden',\n },\n reactionEmoji: {\n fontSize: 24,\n },\n actions: {\n paddingTop: 4,\n },\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.14.0-rc.2",
3
+ "version": "3.14.0-rc.3",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -55,5 +55,5 @@
55
55
  "react-native-url-polyfill": "^2.0.0",
56
56
  "typescript": "<5.6.0"
57
57
  },
58
- "gitHead": "0cbdc714a6cb35ae1140590d915cac239662f2a9"
58
+ "gitHead": "3528a0fe694aeae4c7d40254ec2d39f92aec72dc"
59
59
  }
@@ -33,10 +33,10 @@ import { formatDatePreview } from '../../../utils/date'
33
33
  import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
34
34
  import { PlatformPressable } from '@react-navigation/elements'
35
35
  import { useTheme } from '../../../hooks'
36
- import { platformFontWeightMedium } from '../../../utils'
36
+ import { Haptic, platformFontWeightMedium } from '../../../utils'
37
37
 
38
38
  const { width: WINDOW_WIDTH, height: WINDOW_HEIGHT } = Dimensions.get('window')
39
- const DISMISS_PAN_THRESHOLD = 250
39
+ const DISMISS_PAN_THRESHOLD = 175
40
40
  const MIN_DISTANCE_FOR_PAN = 10 // Higher threshold gives pinching priority
41
41
  const SINGLE_FINGER_POINTER = 1 // Single-finger panning / tapping helps to avoid conflicts with pinching
42
42
  const DEFAULT_OPACITY = 1
@@ -161,6 +161,7 @@ const LightboxGallery = ({
161
161
  const styles = useStyles()
162
162
  const insets = useSafeAreaInsets()
163
163
  const [currentImageIndex, setCurrentImageIndex] = useState(initialImageIndex)
164
+ const { soft: triggerMaxZoomHaptic, rigid: triggerDismissHaptic } = Haptic
164
165
 
165
166
  // Get current image data
166
167
  const currentImage = imageAttachments[currentImageIndex]
@@ -510,6 +511,15 @@ const LightboxGallery = ({
510
511
  MAX_SCALE + MAX_SCALE_OVERSHOOT,
511
512
  Math.max(MIN_SCALE, newScale)
512
513
  )
514
+
515
+ // Check if we just reached the minimum scale threshold
516
+ const previousScale = scale.value
517
+ const reacjedMinScale = previousScale > MIN_SCALE && newScaleClamped <= MIN_SCALE
518
+
519
+ if (reacjedMinScale) {
520
+ runOnJS(triggerDismissHaptic)()
521
+ }
522
+
513
523
  scale.value = newScaleClamped
514
524
 
515
525
  // Calculate new translation to keep focal point under fingers
@@ -545,6 +555,10 @@ const LightboxGallery = ({
545
555
  // Check if overshooting the max scale and clamp it
546
556
  const finalScale = currentScale > MAX_SCALE ? MAX_SCALE : currentScale
547
557
 
558
+ if (finalScale === MAX_SCALE) {
559
+ runOnJS(triggerMaxZoomHaptic)()
560
+ }
561
+
548
562
  // Recalculate translation using focal point to always return to the same position when image is overshooting the max scale
549
563
  const newTranslation = zoomToFocalPoint({
550
564
  focalPointX: focalX.value,
@@ -655,6 +669,15 @@ const LightboxGallery = ({
655
669
  const fadeDistance = Math.max(0, panDistance - halfThreshold)
656
670
  const fadeProgress = fadeDistance / halfThreshold
657
671
 
672
+ // Check if we just crossed the dismiss threshold
673
+ const previousDistance = Math.abs(dismissY.value)
674
+ const crossedDismissThreshold =
675
+ previousDistance < DISMISS_PAN_THRESHOLD && panDistance >= DISMISS_PAN_THRESHOLD
676
+
677
+ if (crossedDismissThreshold) {
678
+ runOnJS(triggerDismissHaptic)()
679
+ }
680
+
658
681
  opacity.value = Math.max(0, DEFAULT_OPACITY - fadeProgress)
659
682
  dismissY.value = e.translationY
660
683
  })
@@ -8,6 +8,7 @@ import { useMessageReactionToggle } from '../../hooks/use_message_reaction_toggl
8
8
  import { ReactionCountResource } from '../../types/resources/reaction'
9
9
  import { MessageResource } from '../../types'
10
10
  import { useCreateAndroidRippleColor } from '../../hooks/use_create_android_ripple_color'
11
+ import { Haptic } from '../../utils/native_adapters'
11
12
 
12
13
  export const REACTION_EMOJIS: Record<ReactionCountResource['value'], string> = {
13
14
  thumbs_up: '👍',
@@ -42,6 +43,7 @@ export function MessageReaction({
42
43
  if (!REACTION_EMOJIS[reaction.value]) return null
43
44
 
44
45
  const handlePress = () => {
46
+ Haptic.impactLight()
45
47
  handleReactionToggle({ value: reaction.value, mine: !!reaction.mine })
46
48
  }
47
49
 
@@ -129,12 +129,13 @@ export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
129
129
  <Reaction
130
130
  key={index}
131
131
  reaction={reaction}
132
- onPress={() =>
132
+ onPress={() => {
133
+ Haptic.impactLight()
133
134
  handleReactionToggle({
134
135
  value: reaction.value,
135
136
  mine: reaction.mine,
136
137
  })
137
- }
138
+ }}
138
139
  />
139
140
  ))}
140
141
  </View>