@supportworks/multi-imagepicker 8.4.6 → 8.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/package.json +2 -2
- package/src/components/AddImages.js +2 -1
- package/src/components/CameraModal.tsx +304 -163
- package/src/components/MultiImagePicker.js +2 -0
package/README.md
CHANGED
|
@@ -49,6 +49,14 @@ The API instance may provide `makeThumbnail(path)` and `deleteThumbnail(path)` f
|
|
|
49
49
|
|
|
50
50
|
Version 8.4.2 requires `@supportworks/navbars >=3.0.0` for `LoadingOverlayHost` and the shared loading service. Keep `AddImagesProvider` mounted around the editor flow.
|
|
51
51
|
|
|
52
|
+
## Camera layout testing and optional zoom slider
|
|
53
|
+
|
|
54
|
+
`MultiImagePicker` and `AddImages` accept `enableZoomSlider` (default `false`). When enabled, the camera offers an adjustment button to switch between zoom presets and the original vertical slider, with a button to return to the presets. The slider uses the camera's supported range, capped at 5×, in 0.5× steps.
|
|
55
|
+
|
|
56
|
+
A dedicated test harness can pass `testImageSource` (a React Native image source) directly to `src/components/CameraModal`. This replaces the native camera with a sample background, bypasses camera permission requests, and supplies simulated zoom and front/back states. Shutter presses create disposable sample files for Session Roll testing. They are deleted when the tester unmounts, including after Done; do not save its results to customer records. Captures use the source image, not an optically zoomed or focused camera image.
|
|
57
|
+
|
|
58
|
+
Keep that input out of normal camera launches. Ripple only supplies it from its core.test menu tester, presented in the same full-screen modal as normal camera use. Flash, focus, lens switching, and zoom in this mode exercise UI state only; they do not verify camera hardware.
|
|
59
|
+
|
|
52
60
|
## Usage - imports
|
|
53
61
|
|
|
54
62
|
```javascript
|
|
@@ -279,3 +287,7 @@ render() {
|
|
|
279
287
|
...
|
|
280
288
|
}
|
|
281
289
|
```
|
|
290
|
+
|
|
291
|
+
Camera pinch zoom uses two fingers on the preview and continuously adjusts within the reported camera range (up to 5×). It works independently of `enableZoomSlider`, which remains false by default. Presets and the optional original slider retain their fixed/half-step values. Single-finger taps still focus; finishing a pinch does not trigger focus. Physical-device testing is required to assess lens-transition smoothness.
|
|
292
|
+
|
|
293
|
+
Zoom presets are `.5`, `1`, and `3` when supported by the camera. The nearest preset stays selected and shows the current zoom while pinching or using the slider (for example, `1.5×` on the middle button). Exact midpoint ties select the lower preset. Tapping a button always returns to its fixed preset value.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supportworks/multi-imagepicker",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.8",
|
|
4
4
|
"description": "Android and iOS customized multiple image picker. For react-native >= 0.60.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@supportworks/app-styler": ">=1.0.6",
|
|
20
20
|
"@supportworks/camera": ">=0.2.3",
|
|
21
21
|
"@supportworks/core-controls": ">=5.0.0",
|
|
22
|
-
"@supportworks/icon-library": ">=1.
|
|
22
|
+
"@supportworks/icon-library": ">=1.11.59",
|
|
23
23
|
"@supportworks/navbars": ">=3.0.0",
|
|
24
24
|
"expo-sensors": "*",
|
|
25
25
|
"@supportworks/swmaterialdesign": ">=1.1.3",
|
|
@@ -23,6 +23,7 @@ const AddImages = forwardRef((
|
|
|
23
23
|
annotationAllowed = false, // whether to allow annotations on images
|
|
24
24
|
showToCustomerAllowed = false, // whether to allow "show to customer" option
|
|
25
25
|
maxCount, // = null, //max number of images that can be selected. Passed to MultiImagePicker. If null default not commented out, causes crash, so leave it this way.
|
|
26
|
+
enableZoomSlider = false,
|
|
26
27
|
existingCount = 0, // number of images already attached outside of this picker session
|
|
27
28
|
children
|
|
28
29
|
}, ref) => {
|
|
@@ -450,7 +451,7 @@ const AddImages = forwardRef((
|
|
|
450
451
|
])
|
|
451
452
|
|
|
452
453
|
return (
|
|
453
|
-
!showAdd && !showAttaching && <MultiImagePicker ref={setPickerRef} hitSlop={hitSlop} maxCount={maxCount} existingCount={existingCount} parentStyle={parentStyle} callback={onImageSelect}>
|
|
454
|
+
!showAdd && !showAttaching && <MultiImagePicker enableZoomSlider={enableZoomSlider} ref={setPickerRef} hitSlop={hitSlop} maxCount={maxCount} existingCount={existingCount} parentStyle={parentStyle} callback={onImageSelect}>
|
|
454
455
|
{children}
|
|
455
456
|
</MultiImagePicker>
|
|
456
457
|
)
|
|
@@ -20,6 +20,7 @@ import { Api } from '@supportworks/api-core'
|
|
|
20
20
|
import FramingGuideOverlay from './FramingGuideOverlay'
|
|
21
21
|
import {
|
|
22
22
|
AppState,
|
|
23
|
+
GestureResponderEvent,
|
|
23
24
|
ActivityIndicator,
|
|
24
25
|
View,
|
|
25
26
|
Text,
|
|
@@ -28,13 +29,13 @@ import {
|
|
|
28
29
|
Pressable,
|
|
29
30
|
Alert,
|
|
30
31
|
Image,
|
|
32
|
+
ImageSourcePropType,
|
|
31
33
|
FlatList,
|
|
32
34
|
Animated,
|
|
33
35
|
PanResponder,
|
|
34
36
|
Platform,
|
|
35
37
|
useWindowDimensions
|
|
36
38
|
} from 'react-native'
|
|
37
|
-
import Svg, { Circle, Path } from 'react-native-svg'
|
|
38
39
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
39
40
|
import { check, openSettings, PERMISSIONS, request, RESULTS } from 'react-native-permissions'
|
|
40
41
|
|
|
@@ -85,18 +86,19 @@ interface CameraTestModalProps {
|
|
|
85
86
|
limit?: number
|
|
86
87
|
/** Shows a live tilt indicator nudging the user away from steep, floor-only close-ups. */
|
|
87
88
|
angleGuideEnabled?: boolean
|
|
89
|
+
/** Test harness only: replaces native camera access with disposable sample captures. */
|
|
90
|
+
testImageSource?: ImageSourcePropType
|
|
91
|
+
/** Offers a slider alongside the Sketch zoom presets. Off by default. */
|
|
92
|
+
enableZoomSlider?: boolean
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
// Event types are now imported from the camera module
|
|
91
96
|
|
|
92
97
|
const DEFAULT_ZOOM = 1
|
|
93
98
|
const FOCUS_RING_SIZE = 72
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const SIDE_BUTTON_TEXT_SIZE = Math.round(14 * RIGHT_CONTROL_SCALE)
|
|
98
|
-
const SIDE_BUTTON_GAP = 18
|
|
99
|
-
const SIDE_ACTION_GROUP_MARGIN_BOTTOM = 28
|
|
99
|
+
const SIDE_BUTTON_SIZE = 40
|
|
100
|
+
const SIDE_BUTTON_ICON_SIZE = 24
|
|
101
|
+
const SIDE_BUTTON_GAP = 8
|
|
100
102
|
const GALLERY_PREVIEW_SIZE = 48
|
|
101
103
|
const GALLERY_PREVIEW_MARGIN_BOTTOM = 40
|
|
102
104
|
const GALLERY_PREVIEW_BORDER_RADIUS = 8
|
|
@@ -112,6 +114,7 @@ const ZOOM_SLIDER_TRACK_LENGTH = 180
|
|
|
112
114
|
const ZOOM_SLIDER_WIDTH = 60
|
|
113
115
|
const ZOOM_SLIDER_THUMB_SIZE = 42
|
|
114
116
|
const ZOOM_SLIDER_THUMB_WIDTH = 52
|
|
117
|
+
const ZOOM_PRESETS = [0.5, 1, 3]
|
|
115
118
|
const ZOOM_STEP = 0.5
|
|
116
119
|
type CameraPermissionState = 'checking' | 'granted' | 'denied'
|
|
117
120
|
|
|
@@ -137,10 +140,12 @@ const snapZoomValue = (value: number, min: number, max: number) => {
|
|
|
137
140
|
return roundZoomValue(clamp(snapped, min, max))
|
|
138
141
|
}
|
|
139
142
|
|
|
140
|
-
const formatZoomLabel = (zoom: number): ZoomLevel => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
const formatZoomLabel = (zoom: number): ZoomLevel => `${Math.round(zoom * 100) / 100}x`
|
|
144
|
+
|
|
145
|
+
const pinchDistance = (event: GestureResponderEvent) => {
|
|
146
|
+
const touches = event.nativeEvent.touches
|
|
147
|
+
if (touches.length !== 2) return 0
|
|
148
|
+
return Math.hypot(touches[0].pageX - touches[1].pageX, touches[0].pageY - touches[1].pageY)
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
const isSameZoomLevel = (left: number, right: number) => {
|
|
@@ -199,38 +204,7 @@ const buildZoomRangeForPosition = (cameras: CameraInfo[], position: 'front' | 'b
|
|
|
199
204
|
return { min: minZoom, max: maxZoom }
|
|
200
205
|
}
|
|
201
206
|
|
|
202
|
-
const
|
|
203
|
-
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
204
|
-
<Path
|
|
205
|
-
d="M4.5 7H7l1.2-2h7.6L17 7h2.5c1.1 0 2 .9 2 2v7.5c0 1.1-.9 2-2 2H4.5c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2Z"
|
|
206
|
-
stroke={color}
|
|
207
|
-
strokeWidth={1.6}
|
|
208
|
-
strokeLinecap="round"
|
|
209
|
-
strokeLinejoin="round"
|
|
210
|
-
/>
|
|
211
|
-
<Circle cx={12} cy={12.5} r={3.5} stroke={color} strokeWidth={1.6} />
|
|
212
|
-
<Path
|
|
213
|
-
d="M11.8 9.2A3.3 3.3 0 0 1 15 12.1"
|
|
214
|
-
stroke={color}
|
|
215
|
-
strokeWidth={1.4}
|
|
216
|
-
strokeLinecap="round"
|
|
217
|
-
strokeLinejoin="round"
|
|
218
|
-
/>
|
|
219
|
-
<Path d="M15 12.1l-1-.8" stroke={color} strokeWidth={1.4} strokeLinecap="round" strokeLinejoin="round" />
|
|
220
|
-
<Path d="M15 12.1l-.2 1.3" stroke={color} strokeWidth={1.4} strokeLinecap="round" strokeLinejoin="round" />
|
|
221
|
-
<Path
|
|
222
|
-
d="M12.2 15.8A3.3 3.3 0 0 1 9 12.9"
|
|
223
|
-
stroke={color}
|
|
224
|
-
strokeWidth={1.4}
|
|
225
|
-
strokeLinecap="round"
|
|
226
|
-
strokeLinejoin="round"
|
|
227
|
-
/>
|
|
228
|
-
<Path d="M9 12.9l.9-.8" stroke={color} strokeWidth={1.4} strokeLinecap="round" strokeLinejoin="round" />
|
|
229
|
-
<Path d="M9 12.9l-.2-1.3" stroke={color} strokeWidth={1.4} strokeLinecap="round" strokeLinejoin="round" />
|
|
230
|
-
</Svg>
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraRef: externalCameraRef, limit, angleGuideEnabled }) => {
|
|
207
|
+
const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraRef: externalCameraRef, limit, angleGuideEnabled, testImageSource, enableZoomSlider = false }) => {
|
|
234
208
|
const internalCameraRef = useRef<CameraViewRef>(null)
|
|
235
209
|
const cameraRef = externalCameraRef || internalCameraRef
|
|
236
210
|
const insets = useSafeAreaInsets()
|
|
@@ -246,17 +220,13 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
246
220
|
: 1
|
|
247
221
|
const scaleMetric = (value: number, min = 0) => Math.max(min, Math.round(value * controlScale))
|
|
248
222
|
const focusRingSize = scaleMetric(FOCUS_RING_SIZE, 52)
|
|
249
|
-
const cancelButtonMinWidth =
|
|
250
|
-
const cancelButtonHeight =
|
|
223
|
+
const cancelButtonMinWidth = 84
|
|
224
|
+
const cancelButtonHeight = 40
|
|
251
225
|
const cancelButtonPaddingHorizontal = scaleMetric(14, 12)
|
|
252
|
-
const cancelButtonFontSize =
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
const
|
|
256
|
-
const sideButtonGap = scaleMetric(SIDE_BUTTON_GAP, 10)
|
|
257
|
-
const sideButtonIconSize = scaleMetric(SIDE_BUTTON_ICON_SIZE, 20)
|
|
258
|
-
const sideButtonTextSize = scaleMetric(SIDE_BUTTON_TEXT_SIZE, 12)
|
|
259
|
-
const sideActionGroupMarginBottom = scaleMetric(SIDE_ACTION_GROUP_MARGIN_BOTTOM, 16)
|
|
226
|
+
const cancelButtonFontSize = 14
|
|
227
|
+
const sideButtonSize = SIDE_BUTTON_SIZE
|
|
228
|
+
const sideButtonGap = SIDE_BUTTON_GAP
|
|
229
|
+
const sideButtonIconSize = SIDE_BUTTON_ICON_SIZE
|
|
260
230
|
const galleryPreviewSize = GALLERY_PREVIEW_SIZE
|
|
261
231
|
const galleryPreviewMarginBottom = isPhoneSized ? 0 : GALLERY_PREVIEW_MARGIN_BOTTOM
|
|
262
232
|
const galleryPreviewBorderRadius = GALLERY_PREVIEW_BORDER_RADIUS
|
|
@@ -270,14 +240,20 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
270
240
|
const doneButtonIconSize = DONE_BUTTON_ICON_SIZE
|
|
271
241
|
const doneButtonMarginBottom = 0
|
|
272
242
|
const rightOverlayWidth = RIGHT_OVERLAY_WIDTH
|
|
273
|
-
const topOverlayHorizontalInset =
|
|
274
|
-
const overlaySideInset = isTightLayout ? 8 : isPhoneSized ? 10 : 16
|
|
243
|
+
const topOverlayHorizontalInset = 16
|
|
275
244
|
const showFlashControl = !isTightLayout
|
|
276
245
|
const showCameraSwitchControl = !isTightLayout
|
|
277
246
|
const showSecondaryControls = showFlashControl || showCameraSwitchControl
|
|
278
247
|
|
|
279
|
-
const
|
|
248
|
+
const closeGalleryRef = useRef<((type?: string) => void) | null>(null)
|
|
280
249
|
const shutterFlashAnim = useRef(new Animated.Value(0)).current
|
|
250
|
+
const knobTop = useRef(new Animated.Value(0)).current
|
|
251
|
+
const isSliderDragging = useRef(false)
|
|
252
|
+
const zoomRailRef = useRef<View>(null)
|
|
253
|
+
const zoomRailTopRef = useRef<number | null>(null)
|
|
254
|
+
const [isZoomSliderVisible, setIsZoomSliderVisible] = useState(false)
|
|
255
|
+
const pinchStart = useRef<{ distance: number; zoom: number } | null>(null)
|
|
256
|
+
const suppressFocusAfterPinch = useRef(false)
|
|
281
257
|
const [currentZoom, setCurrentZoom] = useState<number>(DEFAULT_ZOOM)
|
|
282
258
|
const [isDepthEnabled, setIsDepthEnabled] = useState<boolean>(true)
|
|
283
259
|
const [isFlashEnabled, setIsFlashEnabled] = useState<boolean>(false)
|
|
@@ -293,16 +269,30 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
293
269
|
const [isGalleryModalVisible, setIsGalleryModalVisible] = useState<boolean>(false)
|
|
294
270
|
const [isDoneButtonDisabled, setIsDoneButtonDisabled] = useState<boolean>(false)
|
|
295
271
|
const [focusPoint, setFocusPoint] = useState<{ x: number; y: number } | null>(null)
|
|
296
|
-
const [cameraPermissionState, setCameraPermissionState] = useState<CameraPermissionState>('checking')
|
|
272
|
+
const [cameraPermissionState, setCameraPermissionState] = useState<CameraPermissionState>(testImageSource ? 'granted' : 'checking')
|
|
297
273
|
const [isCapturePending, setIsCapturePending] = useState<boolean>(false)
|
|
298
274
|
const focusAnim = useRef(new Animated.Value(0)).current
|
|
299
|
-
const knobTop = useRef(new Animated.Value(0)).current
|
|
300
|
-
const isSliderDragging = useRef(false)
|
|
301
|
-
const zoomRailRef = useRef<View>(null)
|
|
302
|
-
const zoomRailTopRef = useRef<number | null>(null)
|
|
303
275
|
const capturePendingRef = useRef(false)
|
|
304
|
-
const
|
|
305
|
-
const
|
|
276
|
+
const testCapturePaths = useRef<string[]>([])
|
|
277
|
+
const isMounted = useRef(true)
|
|
278
|
+
const currentZoomRange = testImageSource
|
|
279
|
+
? { min: isFrontCamera ? 1 : 0.5, max: isFrontCamera ? 1 : 5 }
|
|
280
|
+
: isFrontCamera ? zoomRangeByPosition.front : zoomRangeByPosition.back
|
|
281
|
+
|
|
282
|
+
React.useEffect(() => {
|
|
283
|
+
isMounted.current = true
|
|
284
|
+
return () => {
|
|
285
|
+
isMounted.current = false
|
|
286
|
+
testCapturePaths.current.forEach(path => Api.getApi().RNFS.unlink(path).catch(() => {}))
|
|
287
|
+
testCapturePaths.current = []
|
|
288
|
+
}
|
|
289
|
+
}, [])
|
|
290
|
+
const availableZoomPresets = ZOOM_PRESETS.filter(zoom => zoom >= currentZoomRange.min && zoom <= currentZoomRange.max)
|
|
291
|
+
const displayZoom = roundZoomValue(currentZoom)
|
|
292
|
+
// Keep the lower preset selected at an exact midpoint between two presets.
|
|
293
|
+
const selectedZoomPreset = availableZoomPresets.reduce((nearest, zoom) =>
|
|
294
|
+
Math.abs(zoom - currentZoom) < Math.abs(nearest - currentZoom) ? zoom : nearest,
|
|
295
|
+
availableZoomPresets[0])
|
|
306
296
|
const captureLimit = typeof limit === 'number' && limit > 0 ? limit : null
|
|
307
297
|
const hasReachedCaptureLimit = captureLimit !== null && capturedImages.length >= captureLimit
|
|
308
298
|
const isShutterDisabled = isCapturePending || hasReachedCaptureLimit
|
|
@@ -326,6 +316,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
326
316
|
}, [])
|
|
327
317
|
|
|
328
318
|
React.useEffect(() => {
|
|
319
|
+
if (testImageSource) return
|
|
329
320
|
let isCancelled = false
|
|
330
321
|
|
|
331
322
|
const ensureCameraPermission = async () => {
|
|
@@ -463,6 +454,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
463
454
|
|
|
464
455
|
const handleCameraPress = React.useCallback(
|
|
465
456
|
(event: { nativeEvent: { locationX: number; locationY: number } }) => {
|
|
457
|
+
if (suppressFocusAfterPinch.current) return
|
|
466
458
|
const { locationX, locationY } = event.nativeEvent
|
|
467
459
|
triggerFocusRing(locationX, locationY)
|
|
468
460
|
if (cameraRef.current) {
|
|
@@ -488,7 +480,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
488
480
|
})
|
|
489
481
|
}
|
|
490
482
|
|
|
491
|
-
const
|
|
483
|
+
const handleCapturePhoto = async () => {
|
|
492
484
|
if (capturePendingRef.current) {
|
|
493
485
|
return
|
|
494
486
|
}
|
|
@@ -501,6 +493,27 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
501
493
|
console.log('CAMERA: Attempting to capture photo')
|
|
502
494
|
updateCapturePending(true)
|
|
503
495
|
triggerShutterFlash() // Trigger the flash effect
|
|
496
|
+
if (testImageSource) {
|
|
497
|
+
try {
|
|
498
|
+
const source = Image.resolveAssetSource(testImageSource)
|
|
499
|
+
const image = await ImageResizer.createResizedImage(source.uri, source.width, source.height, 'JPEG', 90)
|
|
500
|
+
if (!isMounted.current) {
|
|
501
|
+
await Api.getApi().RNFS.unlink(image.path).catch(() => {})
|
|
502
|
+
return
|
|
503
|
+
}
|
|
504
|
+
testCapturePaths.current.push(image.path)
|
|
505
|
+
handlePhotoCaptured({ nativeEvent: {
|
|
506
|
+
imageUri: image.uri,
|
|
507
|
+
depthMapUri: '',
|
|
508
|
+
imageSize: { width: image.width, height: image.height }
|
|
509
|
+
} })
|
|
510
|
+
} catch (error) {
|
|
511
|
+
if (isMounted.current) Alert.alert('Sample photo unavailable', 'Unable to create a test photo. Close and reopen the camera tester.')
|
|
512
|
+
} finally {
|
|
513
|
+
if (isMounted.current) updateCapturePending(false)
|
|
514
|
+
}
|
|
515
|
+
return
|
|
516
|
+
}
|
|
504
517
|
if (cameraRef.current) {
|
|
505
518
|
try {
|
|
506
519
|
cameraRef.current.capturePhoto()
|
|
@@ -514,7 +527,12 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
514
527
|
}
|
|
515
528
|
}
|
|
516
529
|
|
|
517
|
-
const
|
|
530
|
+
const handleToggleCamera = () => {
|
|
531
|
+
if (testImageSource) {
|
|
532
|
+
setIsFrontCamera(prev => !prev)
|
|
533
|
+
setIsFlashEnabled(false)
|
|
534
|
+
return
|
|
535
|
+
}
|
|
518
536
|
console.log('CAMERA: Attempting to switch camera')
|
|
519
537
|
if (cameraRef.current) {
|
|
520
538
|
cameraRef.current.switchCamera()
|
|
@@ -538,10 +556,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
538
556
|
}
|
|
539
557
|
}, [isFrontCamera, isDepthEnabled, isFlashEnabled])
|
|
540
558
|
|
|
541
|
-
const
|
|
559
|
+
const handleToggleFlash = () => {
|
|
542
560
|
if (isFrontCamera) {
|
|
543
561
|
return
|
|
544
562
|
}
|
|
563
|
+
if (testImageSource) {
|
|
564
|
+
setIsFlashEnabled(prev => !prev)
|
|
565
|
+
return
|
|
566
|
+
}
|
|
545
567
|
console.log('CAMERA: Attempting to toggle flash')
|
|
546
568
|
if (cameraRef.current) {
|
|
547
569
|
cameraRef.current.toggleFlash()
|
|
@@ -551,6 +573,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
551
573
|
}
|
|
552
574
|
}
|
|
553
575
|
|
|
576
|
+
const handleToggleZoomSlider = () => setIsZoomSliderVisible(visible => !visible)
|
|
577
|
+
|
|
554
578
|
const handleZoomChange = React.useCallback((newZoom: number) => {
|
|
555
579
|
setCurrentZoom((prevZoom) => {
|
|
556
580
|
const nextZoom = snapZoomValue(newZoom, currentZoomRange.min, currentZoomRange.max)
|
|
@@ -559,17 +583,44 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
559
583
|
}, [currentZoomRange.max, currentZoomRange.min])
|
|
560
584
|
|
|
561
585
|
React.useEffect(() => {
|
|
562
|
-
const clampedZoom =
|
|
586
|
+
const clampedZoom = clamp(currentZoom, currentZoomRange.min, currentZoomRange.max)
|
|
563
587
|
if (!isSameZoomLevel(clampedZoom, currentZoom)) {
|
|
564
588
|
setCurrentZoom(clampedZoom)
|
|
565
589
|
}
|
|
566
590
|
}, [currentZoom, currentZoomRange.max, currentZoomRange.min])
|
|
567
591
|
|
|
568
592
|
React.useEffect(() => {
|
|
569
|
-
|
|
570
|
-
|
|
593
|
+
pinchStart.current = null
|
|
594
|
+
}, [isFrontCamera, currentZoomRange.min, currentZoomRange.max])
|
|
595
|
+
|
|
596
|
+
const handleShouldCapturePinch = (event: GestureResponderEvent) => {
|
|
597
|
+
if (event.nativeEvent.touches.length === 1 && !pinchStart.current) {
|
|
598
|
+
suppressFocusAfterPinch.current = false
|
|
571
599
|
}
|
|
572
|
-
|
|
600
|
+
return !capturePendingRef.current && currentZoomRange.max > currentZoomRange.min && pinchDistance(event) > 0
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
const handlePinchStart = (event: GestureResponderEvent) => {
|
|
604
|
+
const distance = pinchDistance(event)
|
|
605
|
+
pinchStart.current = distance > 0 ? { distance, zoom: currentZoom } : null
|
|
606
|
+
suppressFocusAfterPinch.current = true
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const handlePinchMove = (event: GestureResponderEvent) => {
|
|
610
|
+
const distance = pinchDistance(event)
|
|
611
|
+
if (!distance || capturePendingRef.current) {
|
|
612
|
+
pinchStart.current = null
|
|
613
|
+
return
|
|
614
|
+
}
|
|
615
|
+
if (!pinchStart.current) {
|
|
616
|
+
handlePinchStart(event)
|
|
617
|
+
return
|
|
618
|
+
}
|
|
619
|
+
const zoom = pinchStart.current.zoom * distance / pinchStart.current.distance
|
|
620
|
+
setCurrentZoom(Math.round(clamp(zoom, currentZoomRange.min, currentZoomRange.max) * 100) / 100)
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
const handlePinchEnd = () => { pinchStart.current = null }
|
|
573
624
|
|
|
574
625
|
React.useEffect(() => {
|
|
575
626
|
const targetTop = getTopPositionForZoom(currentZoom, currentZoomRange.min, currentZoomRange.max)
|
|
@@ -578,12 +629,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
578
629
|
return
|
|
579
630
|
}
|
|
580
631
|
|
|
581
|
-
Animated.spring(knobTop, {
|
|
632
|
+
const animation = Animated.spring(knobTop, {
|
|
582
633
|
toValue: targetTop,
|
|
583
634
|
useNativeDriver: false,
|
|
584
635
|
tension: 180,
|
|
585
636
|
friction: 20
|
|
586
|
-
})
|
|
637
|
+
})
|
|
638
|
+
animation.start()
|
|
639
|
+
return () => animation.stop()
|
|
587
640
|
}, [currentZoom, currentZoomRange.max, currentZoomRange.min, knobTop])
|
|
588
641
|
|
|
589
642
|
const measureZoomRail = React.useCallback(() => {
|
|
@@ -614,8 +667,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
614
667
|
const sliderPanResponder = React.useMemo(
|
|
615
668
|
() =>
|
|
616
669
|
PanResponder.create({
|
|
617
|
-
onStartShouldSetPanResponder: () =>
|
|
618
|
-
onMoveShouldSetPanResponder: () =>
|
|
670
|
+
onStartShouldSetPanResponder: () => (currentZoomRange.max > currentZoomRange.min),
|
|
671
|
+
onMoveShouldSetPanResponder: () => (currentZoomRange.max > currentZoomRange.min),
|
|
619
672
|
onPanResponderGrant: (event, gestureState) => {
|
|
620
673
|
isSliderDragging.current = true
|
|
621
674
|
measureZoomRail()
|
|
@@ -641,9 +694,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
641
694
|
isSliderDragging.current = false
|
|
642
695
|
}
|
|
643
696
|
}),
|
|
644
|
-
[getSliderTopFromGesture,
|
|
697
|
+
[getSliderTopFromGesture, (currentZoomRange.max > currentZoomRange.min), measureZoomRail, updateZoomFromSliderPosition]
|
|
645
698
|
)
|
|
646
699
|
|
|
700
|
+
const handleGalleryCloseReady = React.useCallback((closeModal: ((type?: string) => void) | null) => {
|
|
701
|
+
closeGalleryRef.current = closeModal
|
|
702
|
+
}, [])
|
|
703
|
+
const handleCloseGallery = () => closeGalleryRef.current?.('cancel')
|
|
704
|
+
|
|
647
705
|
const openGalleryModal = () => {
|
|
648
706
|
console.log('OPENING GALLERY MODAL', capturedImages.length)
|
|
649
707
|
if (limit !== 1 && capturedImages.length > 0) {
|
|
@@ -658,22 +716,28 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
658
716
|
})
|
|
659
717
|
}
|
|
660
718
|
|
|
719
|
+
const FlashIcon = isFlashEnabled ? Icons.IconFlashOn : Icons.IconFlashOff
|
|
661
720
|
const latestCapturedImage = capturedImages[capturedImages.length - 1]
|
|
662
721
|
const hasCapturedImages = capturedImages.length > 0
|
|
663
722
|
const shouldShowGalleryPreview = limit !== 1
|
|
664
723
|
const shouldShowDoneButton = limit !== 1
|
|
665
|
-
const
|
|
666
|
-
const
|
|
724
|
+
const shouldShowZoomControls = currentZoomRange.max > currentZoomRange.min && !isTightLayout
|
|
725
|
+
const showZoomSlider = enableZoomSlider && isZoomSliderVisible && shouldShowZoomControls
|
|
726
|
+
const zoomControlsLength = availableZoomPresets.length * 40 + 16
|
|
667
727
|
const gallerySubtitle = `${capturedImages.length} ${capturedImages.length === 1 ? 'image' : 'images'}`
|
|
668
|
-
|
|
728
|
+
// Sketch 16:9: shutter ends 16pt above the photo edge (20pt on SE).
|
|
729
|
+
const phoneControlsBottom = isLandscape ? insets.bottom + 8 : insets.bottom > 0 ? 16 : 20
|
|
669
730
|
const primaryControlsTop = Math.max(insets.top + 96, windowHeight / 2 - shutterButtonSize / 2)
|
|
670
|
-
|
|
671
|
-
const secondaryControlsTop = isPhoneSized
|
|
672
|
-
|
|
673
|
-
|
|
731
|
+
// SVT artboard: shutter center y=540, flash y=256, switch y=304.
|
|
732
|
+
const secondaryControlsTop = isPhoneSized ? insets.top + 8 : primaryControlsTop - 248
|
|
733
|
+
const zoomControlsTop = isPhoneSized
|
|
734
|
+
? windowHeight - phoneControlsBottom - shutterButtonSize - 63
|
|
735
|
+
: windowHeight / 2 - zoomControlsLength / 2
|
|
736
|
+
|
|
674
737
|
const zoomSliderHeight = ZOOM_SLIDER_TRACK_LENGTH + ZOOM_SLIDER_THUMB_SIZE
|
|
675
738
|
const zoomSliderTop = Math.max(insets.top + (isPhoneSized ? 88 : 104), Math.round(windowHeight * 0.5 - zoomSliderHeight / 2))
|
|
676
739
|
|
|
740
|
+
|
|
677
741
|
const handleCancelPress = () => {
|
|
678
742
|
if (capturePendingRef.current) {
|
|
679
743
|
return
|
|
@@ -766,25 +830,37 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
766
830
|
isCancelDisabled && styles.cancelButtonDisabled
|
|
767
831
|
]}
|
|
768
832
|
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
|
833
|
+
accessibilityLabel="Cancel"
|
|
769
834
|
onPress={handleCancelPress}
|
|
770
835
|
disabled={isCancelDisabled}
|
|
771
836
|
>
|
|
772
837
|
<Text style={[styles.cancelButtonText, { fontSize: cancelButtonFontSize }]}>Cancel</Text>
|
|
773
838
|
</TouchableOpacity>
|
|
774
839
|
|
|
775
|
-
|
|
776
|
-
<View style={[styles.captureCountBadge, { width: captureBadgeSize, height: captureBadgeSize, borderRadius: captureBadgeSize / 2 }]}>
|
|
777
|
-
<Text style={[styles.captureCountBadgeText, { fontSize: captureBadgeFontSize }]}>{capturedImages.length}</Text>
|
|
778
|
-
</View>
|
|
779
|
-
) : (
|
|
780
|
-
<View style={[styles.topOverlaySpacer, { width: captureBadgeSize, height: captureBadgeSize }]} />
|
|
781
|
-
)}
|
|
840
|
+
|
|
782
841
|
</View>
|
|
783
842
|
|
|
784
843
|
{/* Camera View */}
|
|
785
|
-
<View
|
|
844
|
+
<View
|
|
845
|
+
style={styles.cameraContainer}
|
|
846
|
+
testID="camera-pinch-surface"
|
|
847
|
+
onStartShouldSetResponderCapture={handleShouldCapturePinch}
|
|
848
|
+
onMoveShouldSetResponderCapture={handleShouldCapturePinch}
|
|
849
|
+
onResponderGrant={handlePinchStart}
|
|
850
|
+
onResponderMove={handlePinchMove}
|
|
851
|
+
onResponderRelease={handlePinchEnd}
|
|
852
|
+
onResponderTerminate={handlePinchEnd}
|
|
853
|
+
>
|
|
786
854
|
<Pressable style={styles.cameraTouchLayer} onPress={handleCameraPress}>
|
|
787
|
-
|
|
855
|
+
{testImageSource ? (
|
|
856
|
+
<View style={[styles.camera, { overflow: 'hidden' }]}>
|
|
857
|
+
<Image
|
|
858
|
+
source={testImageSource}
|
|
859
|
+
resizeMode="cover"
|
|
860
|
+
style={[StyleSheet.absoluteFillObject, { width: '100%', height: '100%', transform: [{ scale: currentZoom / 0.5 }, { scaleX: isFrontCamera ? -1 : 1 }] }]}
|
|
861
|
+
/>
|
|
862
|
+
</View>
|
|
863
|
+
) : <CameraView
|
|
788
864
|
ref={cameraRef}
|
|
789
865
|
isDepthEnabled={isDepthEnabled}
|
|
790
866
|
zoomLevel={formatZoomLabel(currentZoom)}
|
|
@@ -794,7 +870,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
794
870
|
onCaptureStateChange={handleCaptureStateChange}
|
|
795
871
|
onError={handleCameraError}
|
|
796
872
|
style={styles.camera}
|
|
797
|
-
/>
|
|
873
|
+
/>}
|
|
798
874
|
{focusPoint ? (
|
|
799
875
|
<Animated.View
|
|
800
876
|
style={[
|
|
@@ -827,31 +903,35 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
827
903
|
|
|
828
904
|
<View
|
|
829
905
|
pointerEvents="box-none"
|
|
830
|
-
style={[styles.rightOverlay, { width:
|
|
906
|
+
style={[styles.rightOverlay, { width: isPhoneSized ? 88 : 40, right: (isPhoneSized ? 16 : 32) + insets.right, top: secondaryControlsTop }]}
|
|
831
907
|
>
|
|
832
908
|
{showSecondaryControls && (
|
|
833
|
-
<View style={[styles.sideActionGroup, {
|
|
909
|
+
<View style={[styles.sideActionGroup, { flexDirection: isPhoneSized ? 'row' : 'column' }]}>
|
|
834
910
|
{showFlashControl && (
|
|
835
911
|
<TouchableOpacity
|
|
836
912
|
style={[
|
|
837
913
|
styles.sideButton,
|
|
838
914
|
{ width: sideButtonSize, height: sideButtonSize, borderRadius: sideButtonSize / 2 },
|
|
839
|
-
showCameraSwitchControl && { marginBottom: sideButtonGap },
|
|
915
|
+
showCameraSwitchControl && (isPhoneSized ? { marginRight: sideButtonGap } : { marginBottom: sideButtonGap }),
|
|
840
916
|
isFlashEnabled && styles.sideButtonActive,
|
|
841
917
|
isFrontCamera && styles.sideButtonDisabled
|
|
842
918
|
]}
|
|
843
|
-
|
|
919
|
+
accessibilityRole="button"
|
|
920
|
+
accessibilityLabel="Toggle flash"
|
|
921
|
+
onPress={handleToggleFlash}
|
|
844
922
|
disabled={isFrontCamera}
|
|
845
923
|
>
|
|
846
|
-
<
|
|
924
|
+
<FlashIcon width={24} height={24} fill={colors.white} fillOpacity={1} />
|
|
847
925
|
</TouchableOpacity>
|
|
848
926
|
)}
|
|
849
927
|
{showCameraSwitchControl && (
|
|
850
928
|
<TouchableOpacity
|
|
851
929
|
style={[styles.sideButton, { width: sideButtonSize, height: sideButtonSize, borderRadius: sideButtonSize / 2 }]}
|
|
852
|
-
|
|
930
|
+
accessibilityRole="button"
|
|
931
|
+
accessibilityLabel="Switch camera"
|
|
932
|
+
onPress={handleToggleCamera}
|
|
853
933
|
>
|
|
854
|
-
<
|
|
934
|
+
<Icons.IconCameraSwitch width={sideButtonIconSize} height={sideButtonIconSize} fill={colors.white} fillOpacity={1} />
|
|
855
935
|
</TouchableOpacity>
|
|
856
936
|
)}
|
|
857
937
|
</View>
|
|
@@ -880,6 +960,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
880
960
|
},
|
|
881
961
|
!hasCapturedImages && styles.galleryPreviewButtonEmpty
|
|
882
962
|
]}
|
|
963
|
+
accessibilityLabel="Open Session Roll"
|
|
883
964
|
onPress={openGalleryModal}
|
|
884
965
|
activeOpacity={0.9}
|
|
885
966
|
>
|
|
@@ -915,13 +996,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
915
996
|
isPhoneSized && { position: 'absolute', left: '50%', marginLeft: -shutterButtonSize / 2 },
|
|
916
997
|
isShutterDisabled && styles.shutterButtonDisabled
|
|
917
998
|
]}
|
|
918
|
-
|
|
999
|
+
accessibilityLabel="Take photo"
|
|
1000
|
+
onPress={handleCapturePhoto}
|
|
919
1001
|
disabled={isShutterDisabled}
|
|
920
1002
|
>
|
|
921
1003
|
<View
|
|
922
1004
|
style={[
|
|
923
1005
|
styles.shutterButtonOuter,
|
|
924
|
-
{ width: shutterButtonSize, height: shutterButtonSize, borderRadius: shutterButtonSize / 2, borderWidth:
|
|
1006
|
+
{ width: shutterButtonSize, height: shutterButtonSize, borderRadius: shutterButtonSize / 2, borderWidth: 4 },
|
|
925
1007
|
isShutterDisabled && styles.shutterButtonOuterDisabled
|
|
926
1008
|
]}
|
|
927
1009
|
/>
|
|
@@ -939,9 +1021,10 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
939
1021
|
style={[
|
|
940
1022
|
styles.doneButton,
|
|
941
1023
|
{ width: 95, height: doneButtonHeight, paddingHorizontal: doneButtonHorizontalPadding, borderRadius: doneButtonHeight / 2, marginBottom: doneButtonMarginBottom },
|
|
942
|
-
isPhoneSized && { position: 'absolute', right: 0 },
|
|
1024
|
+
isPhoneSized && { position: 'absolute', right: 0, top: !isLandscape && insets.bottom > 0 ? 17 : 16 },
|
|
943
1025
|
isDoneDisabled && styles.doneButtonDisabled
|
|
944
1026
|
]}
|
|
1027
|
+
accessibilityLabel="Done"
|
|
945
1028
|
onPress={handleDonePress}
|
|
946
1029
|
disabled={isDoneDisabled}
|
|
947
1030
|
>
|
|
@@ -961,22 +1044,75 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
961
1044
|
</View>
|
|
962
1045
|
) : null}
|
|
963
1046
|
|
|
964
|
-
{
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
<View
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1047
|
+
{shouldShowZoomControls ? (
|
|
1048
|
+
<>
|
|
1049
|
+
{showZoomSlider ? (
|
|
1050
|
+
<View style={[styles.zoomSliderContainer, { left: 12 + insets.left, top: zoomSliderTop }]}>
|
|
1051
|
+
<View style={styles.zoomSlider}>
|
|
1052
|
+
<View
|
|
1053
|
+
ref={zoomRailRef}
|
|
1054
|
+
testID="camera-zoom-slider"
|
|
1055
|
+
style={styles.zoomRailContainer}
|
|
1056
|
+
onLayout={measureZoomRail}
|
|
1057
|
+
{...sliderPanResponder.panHandlers}
|
|
1058
|
+
>
|
|
1059
|
+
<View style={styles.zoomRail} />
|
|
1060
|
+
<Animated.View style={[styles.zoomThumb, { top: knobTop }]}>
|
|
1061
|
+
<Text style={styles.zoomThumbText}>{formatZoomLabel(currentZoom)}</Text>
|
|
1062
|
+
</Animated.View>
|
|
1063
|
+
</View>
|
|
1064
|
+
</View>
|
|
977
1065
|
</View>
|
|
1066
|
+
) : (
|
|
1067
|
+
<View
|
|
1068
|
+
style={[
|
|
1069
|
+
styles.zoomContainer,
|
|
1070
|
+
isPhoneSized
|
|
1071
|
+
? { width: zoomControlsLength, height: 48, left: (windowWidth - zoomControlsLength) / 2, top: zoomControlsTop, flexDirection: 'row' }
|
|
1072
|
+
: { width: 48, height: zoomControlsLength, left: 16 + insets.left, top: zoomControlsTop }
|
|
1073
|
+
]}
|
|
1074
|
+
>
|
|
1075
|
+
{availableZoomPresets.map(zoom => {
|
|
1076
|
+
const selected = zoom === selectedZoomPreset
|
|
1077
|
+
const handlePress = () => handleZoomChange(zoom)
|
|
1078
|
+
return (
|
|
1079
|
+
<TouchableOpacity
|
|
1080
|
+
key={zoom}
|
|
1081
|
+
accessibilityRole="button"
|
|
1082
|
+
accessibilityLabel={`${zoom} times zoom`}
|
|
1083
|
+
accessibilityState={{ selected }}
|
|
1084
|
+
accessibilityValue={selected ? { text: `${displayZoom} times zoom` } : undefined}
|
|
1085
|
+
onPress={handlePress}
|
|
1086
|
+
style={[styles.zoomButton, selected && styles.zoomButtonSelected]}
|
|
1087
|
+
>
|
|
1088
|
+
<Text numberOfLines={1} adjustsFontSizeToFit style={[styles.zoomText, selected && styles.zoomTextSelected]}>
|
|
1089
|
+
{selected ? `${displayZoom === 0.5 ? '.5' : displayZoom}×` : zoom === 0.5 ? '.5' : zoom}
|
|
1090
|
+
</Text>
|
|
1091
|
+
</TouchableOpacity>
|
|
1092
|
+
)
|
|
1093
|
+
})}
|
|
978
1094
|
</View>
|
|
979
|
-
|
|
1095
|
+
)}
|
|
1096
|
+
{enableZoomSlider && (
|
|
1097
|
+
<TouchableOpacity
|
|
1098
|
+
accessibilityRole="button"
|
|
1099
|
+
accessibilityLabel={showZoomSlider ? 'Show zoom presets' : 'Show zoom slider'}
|
|
1100
|
+
accessibilityState={{ expanded: showZoomSlider }}
|
|
1101
|
+
onPress={handleToggleZoomSlider}
|
|
1102
|
+
style={[
|
|
1103
|
+
styles.sideButton,
|
|
1104
|
+
{ position: 'absolute', zIndex: 12 },
|
|
1105
|
+
showZoomSlider
|
|
1106
|
+
? { left: 22 + insets.left, top: zoomSliderTop + zoomSliderHeight + 8 }
|
|
1107
|
+
: isPhoneSized
|
|
1108
|
+
? { left: (windowWidth + zoomControlsLength) / 2 + 8, top: zoomControlsTop + 4 }
|
|
1109
|
+
: { left: 20 + insets.left, top: zoomControlsTop + zoomControlsLength + 8 }
|
|
1110
|
+
]}
|
|
1111
|
+
>
|
|
1112
|
+
<Icons.IconAdjust size={24} fill={colors.white} fillOpacity={1} />
|
|
1113
|
+
</TouchableOpacity>
|
|
1114
|
+
)}
|
|
1115
|
+
</>
|
|
980
1116
|
) : null}
|
|
981
1117
|
|
|
982
1118
|
{/* Shutter Flash Overlay */}
|
|
@@ -985,7 +1121,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
985
1121
|
{/* Gallery SwipeModal */}
|
|
986
1122
|
<SwipeModal
|
|
987
1123
|
key={`gallery-${isGalleryModalVisible}`}
|
|
988
|
-
|
|
1124
|
+
implicit={handleGalleryCloseReady}
|
|
989
1125
|
visible={isGalleryModalVisible}
|
|
990
1126
|
onClose={() => setIsGalleryModalVisible(false)}
|
|
991
1127
|
scrollOffset={1}
|
|
@@ -998,7 +1134,9 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
998
1134
|
<View style={styles.gallerySheetHeader}>
|
|
999
1135
|
<TouchableOpacity
|
|
1000
1136
|
style={styles.gallerySheetClose}
|
|
1001
|
-
onPress={
|
|
1137
|
+
onPress={handleCloseGallery}
|
|
1138
|
+
accessibilityRole="button"
|
|
1139
|
+
accessibilityLabel="Close Session Roll"
|
|
1002
1140
|
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
|
1003
1141
|
>
|
|
1004
1142
|
<Icons.IconClose_WithPad size={18} fill={colors.white} fillOpacity={1} />
|
|
@@ -1103,16 +1241,12 @@ const styles = StyleSheet.create({
|
|
|
1103
1241
|
justifyContent: 'space-between',
|
|
1104
1242
|
zIndex: 10
|
|
1105
1243
|
},
|
|
1106
|
-
topOverlaySpacer: {
|
|
1107
|
-
width: 30,
|
|
1108
|
-
height: 30
|
|
1109
|
-
},
|
|
1110
1244
|
cancelButton: {
|
|
1111
1245
|
minWidth: 56,
|
|
1112
1246
|
height: 34,
|
|
1113
1247
|
paddingHorizontal: 14,
|
|
1114
1248
|
borderRadius: 17,
|
|
1115
|
-
backgroundColor:
|
|
1249
|
+
backgroundColor: colors.black18,
|
|
1116
1250
|
alignItems: 'center',
|
|
1117
1251
|
justifyContent: 'center'
|
|
1118
1252
|
},
|
|
@@ -1120,30 +1254,8 @@ const styles = StyleSheet.create({
|
|
|
1120
1254
|
opacity: 0.45
|
|
1121
1255
|
},
|
|
1122
1256
|
cancelButtonText: {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
fontWeight: 'bold',
|
|
1126
|
-
opacity: 0.92
|
|
1127
|
-
},
|
|
1128
|
-
captureCountBadge: {
|
|
1129
|
-
width: 26,
|
|
1130
|
-
height: 26,
|
|
1131
|
-
borderRadius: 13,
|
|
1132
|
-
backgroundColor: colors.yellow,
|
|
1133
|
-
borderWidth: 2,
|
|
1134
|
-
borderColor: colors.white,
|
|
1135
|
-
alignItems: 'center',
|
|
1136
|
-
justifyContent: 'center'
|
|
1137
|
-
},
|
|
1138
|
-
captureCountBadgeText: {
|
|
1139
|
-
color: colors.white,
|
|
1140
|
-
fontSize: 13,
|
|
1141
|
-
fontWeight: 'bold'
|
|
1142
|
-
},
|
|
1143
|
-
sideButtonText: {
|
|
1144
|
-
color: colors.white,
|
|
1145
|
-
fontSize: SIDE_BUTTON_TEXT_SIZE,
|
|
1146
|
-
fontWeight: 'bold'
|
|
1257
|
+
...stdStyles.S3,
|
|
1258
|
+
color: colors.white
|
|
1147
1259
|
},
|
|
1148
1260
|
cameraContainer: {
|
|
1149
1261
|
position: 'absolute',
|
|
@@ -1204,22 +1316,18 @@ const styles = StyleSheet.create({
|
|
|
1204
1316
|
},
|
|
1205
1317
|
sideActionGroup: {
|
|
1206
1318
|
width: '100%',
|
|
1207
|
-
alignItems: 'center'
|
|
1208
|
-
marginBottom: SIDE_ACTION_GROUP_MARGIN_BOTTOM
|
|
1209
|
-
},
|
|
1210
|
-
sideButtonSpacing: {
|
|
1211
|
-
marginBottom: SIDE_BUTTON_GAP
|
|
1319
|
+
alignItems: 'center'
|
|
1212
1320
|
},
|
|
1213
1321
|
sideButton: {
|
|
1214
1322
|
width: SIDE_BUTTON_SIZE,
|
|
1215
1323
|
height: SIDE_BUTTON_SIZE,
|
|
1216
1324
|
borderRadius: SIDE_BUTTON_SIZE / 2,
|
|
1217
|
-
backgroundColor:
|
|
1325
|
+
backgroundColor: colors.black18,
|
|
1218
1326
|
alignItems: 'center',
|
|
1219
1327
|
justifyContent: 'center'
|
|
1220
1328
|
},
|
|
1221
1329
|
sideButtonActive: {
|
|
1222
|
-
backgroundColor:
|
|
1330
|
+
backgroundColor: colors.blue
|
|
1223
1331
|
},
|
|
1224
1332
|
sideButtonDisabled: {
|
|
1225
1333
|
opacity: 0.42
|
|
@@ -1229,7 +1337,7 @@ const styles = StyleSheet.create({
|
|
|
1229
1337
|
height: GALLERY_PREVIEW_SIZE,
|
|
1230
1338
|
borderRadius: GALLERY_PREVIEW_BORDER_RADIUS,
|
|
1231
1339
|
backgroundColor: 'rgba(255,255,255,0.12)',
|
|
1232
|
-
borderWidth:
|
|
1340
|
+
borderWidth: 2,
|
|
1233
1341
|
borderColor: colors.white,
|
|
1234
1342
|
overflow: 'visible',
|
|
1235
1343
|
alignItems: 'center',
|
|
@@ -1264,9 +1372,9 @@ const styles = StyleSheet.create({
|
|
|
1264
1372
|
justifyContent: 'center'
|
|
1265
1373
|
},
|
|
1266
1374
|
galleryPreviewBadgeText: {
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1375
|
+
...stdStyles.Caption2,
|
|
1376
|
+
letterSpacing: 0.39,
|
|
1377
|
+
color: colors.white
|
|
1270
1378
|
},
|
|
1271
1379
|
zoomSliderContainer: {
|
|
1272
1380
|
position: 'absolute',
|
|
@@ -1307,6 +1415,40 @@ const styles = StyleSheet.create({
|
|
|
1307
1415
|
fontSize: 12,
|
|
1308
1416
|
fontWeight: 'bold'
|
|
1309
1417
|
},
|
|
1418
|
+
zoomContainer: {
|
|
1419
|
+
position: 'absolute',
|
|
1420
|
+
borderRadius: 24,
|
|
1421
|
+
backgroundColor: colors.black18,
|
|
1422
|
+
alignItems: 'center',
|
|
1423
|
+
justifyContent: 'center',
|
|
1424
|
+
gap: 8,
|
|
1425
|
+
padding: 4,
|
|
1426
|
+
zIndex: 12
|
|
1427
|
+
},
|
|
1428
|
+
zoomButton: {
|
|
1429
|
+
width: 32,
|
|
1430
|
+
height: 32,
|
|
1431
|
+
borderRadius: 16,
|
|
1432
|
+
backgroundColor: colors.black62,
|
|
1433
|
+
alignItems: 'center',
|
|
1434
|
+
justifyContent: 'center'
|
|
1435
|
+
},
|
|
1436
|
+
zoomButtonSelected: {
|
|
1437
|
+
paddingHorizontal: 4,
|
|
1438
|
+
width: 40,
|
|
1439
|
+
height: 40,
|
|
1440
|
+
borderRadius: 20,
|
|
1441
|
+
backgroundColor: colors.blue
|
|
1442
|
+
},
|
|
1443
|
+
zoomText: {
|
|
1444
|
+
...stdStyles.Caption2,
|
|
1445
|
+
letterSpacing: 0.39,
|
|
1446
|
+
color: colors.white
|
|
1447
|
+
},
|
|
1448
|
+
zoomTextSelected: {
|
|
1449
|
+
...stdStyles.S1,
|
|
1450
|
+
color: colors.white
|
|
1451
|
+
},
|
|
1310
1452
|
shutterButton: {
|
|
1311
1453
|
width: SHUTTER_BUTTON_SIZE,
|
|
1312
1454
|
height: SHUTTER_BUTTON_SIZE,
|
|
@@ -1323,9 +1465,9 @@ const styles = StyleSheet.create({
|
|
|
1323
1465
|
width: SHUTTER_BUTTON_SIZE,
|
|
1324
1466
|
height: SHUTTER_BUTTON_SIZE,
|
|
1325
1467
|
borderRadius: SHUTTER_BUTTON_SIZE / 2,
|
|
1326
|
-
borderWidth:
|
|
1468
|
+
borderWidth: 4,
|
|
1327
1469
|
borderColor: colors.white,
|
|
1328
|
-
backgroundColor: '
|
|
1470
|
+
backgroundColor: 'transparent'
|
|
1329
1471
|
},
|
|
1330
1472
|
shutterButtonOuterDisabled: {
|
|
1331
1473
|
borderColor: 'rgba(255,255,255,0.6)',
|
|
@@ -1351,9 +1493,8 @@ const styles = StyleSheet.create({
|
|
|
1351
1493
|
marginBottom: 30
|
|
1352
1494
|
},
|
|
1353
1495
|
doneButtonText: {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
fontWeight: 'bold'
|
|
1496
|
+
...stdStyles.S3,
|
|
1497
|
+
color: colors.white
|
|
1357
1498
|
},
|
|
1358
1499
|
doneButtonIcon: {
|
|
1359
1500
|
marginLeft: 8
|
|
@@ -44,6 +44,7 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
44
44
|
existingCount = 0, // number of images already attached outside of this picker session
|
|
45
45
|
callbackData = null, // data appended to payload and passed with callback function (optional)
|
|
46
46
|
callback = null, // callback function (optional)
|
|
47
|
+
enableZoomSlider = false,
|
|
47
48
|
angleGuideEnabled = false, // shows a live tilt indicator in CameraModal nudging away from steep floor-only close-ups (optional)
|
|
48
49
|
children,
|
|
49
50
|
...touchableProps // any other props passed into MultiImagePicker will be spread onto the TouchableOpacity below
|
|
@@ -414,6 +415,7 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
414
415
|
limit={remainingCount}
|
|
415
416
|
onCancel={() => handleCameraModalDone([])}
|
|
416
417
|
angleGuideEnabled={angleGuideEnabled}
|
|
418
|
+
enableZoomSlider={enableZoomSlider}
|
|
417
419
|
/>
|
|
418
420
|
</Modal>
|
|
419
421
|
)}
|