From e4cd9fe6ed7d7cb49d232cad491629fee2139656 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Fri, 31 Oct 2025 22:03:43 +0100 Subject: [PATCH] Update filepreview modal to support image panning/zooming (#1286) --- .../credentials/details/FilePreviewModal.tsx | 27 +++++++++---------- apps/mobile-app/package-lock.json | 24 +++++++++++++++++ apps/mobile-app/package.json | 1 + 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/apps/mobile-app/components/credentials/details/FilePreviewModal.tsx b/apps/mobile-app/components/credentials/details/FilePreviewModal.tsx index 0269728aa..95fd08580 100644 --- a/apps/mobile-app/components/credentials/details/FilePreviewModal.tsx +++ b/apps/mobile-app/components/credentials/details/FilePreviewModal.tsx @@ -9,10 +9,10 @@ import { StyleSheet, TouchableOpacity, ScrollView, - Image, Dimensions, Alert } from 'react-native'; +import ImageViewer from 'react-native-image-zoom-viewer'; import { useColors } from '@/hooks/useColorScheme'; @@ -227,21 +227,18 @@ export const FilePreviewModal: React.FC = ({ } if (isImage) { + const imageUrls = [{ url: filePath }]; + return ( - - Alert.alert('Error', 'Could not load image')} - /> - + Alert.alert('Error', 'Could not load image')} + /> ); } diff --git a/apps/mobile-app/package-lock.json b/apps/mobile-app/package-lock.json index 9ea019f9e..bbdd3590f 100644 --- a/apps/mobile-app/package-lock.json +++ b/apps/mobile-app/package-lock.json @@ -48,6 +48,7 @@ "react-native-edge-to-edge": "1.6.0", "react-native-gesture-handler": "~2.24.0", "react-native-get-random-values": "^1.11.0", + "react-native-image-zoom-viewer": "^3.0.1", "react-native-keyboard-controller": "^1.18.6", "react-native-quick-crypto": "^0.7.13", "react-native-reanimated": "~3.17.4", @@ -14746,6 +14747,29 @@ "react-native": ">=0.56" } }, + "node_modules/react-native-image-pan-zoom": { + "version": "2.1.12", + "resolved": "https://registry.npmjs.org/react-native-image-pan-zoom/-/react-native-image-pan-zoom-2.1.12.tgz", + "integrity": "sha512-BF66XeP6dzuANsPmmFsJshM2Jyh/Mo1t8FsGc1L9Q9/sVP8MJULDabB1hms+eAoqgtyhMr5BuXV3E1hJ5U5H6Q==", + "license": "ISC", + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, + "node_modules/react-native-image-zoom-viewer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/react-native-image-zoom-viewer/-/react-native-image-zoom-viewer-3.0.1.tgz", + "integrity": "sha512-la6s5DNSuq4GCRLsi5CZ29FPjgTpdCuGIRdO5T9rUrAtxrlpBPhhSnHrbmPVxsdtOUvxHacTh2Gfa9+RraMZQA==", + "license": "MIT", + "dependencies": { + "react-native-image-pan-zoom": "^2.1.12" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/react-native-is-edge-to-edge": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/react-native-is-edge-to-edge/-/react-native-is-edge-to-edge-1.2.1.tgz", diff --git a/apps/mobile-app/package.json b/apps/mobile-app/package.json index b91dfc960..fb6d5f36f 100644 --- a/apps/mobile-app/package.json +++ b/apps/mobile-app/package.json @@ -69,6 +69,7 @@ "react-native-edge-to-edge": "1.6.0", "react-native-gesture-handler": "~2.24.0", "react-native-get-random-values": "^1.11.0", + "react-native-image-zoom-viewer": "^3.0.1", "react-native-keyboard-controller": "^1.18.6", "react-native-quick-crypto": "^0.7.13", "react-native-reanimated": "~3.17.4",