@supportworks/multi-imagepicker 8.3.6 → 8.3.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.
@@ -1,14 +1,17 @@
1
1
  // Supportworks dependencies
2
2
  import { colors } from '@supportworks/app-styler'
3
- import { CommonButton, SwipeModal } from '@supportworks/core-controls'
3
+ import { SwipeModal } from '@supportworks/core-controls'
4
4
  import { Icons } from '@supportworks/icon-library'
5
5
  // Camera module
6
6
  import {
7
7
  CameraView,
8
8
  CameraViewRef,
9
+ CameraInfo,
9
10
  OnStatusChangeEventPayload,
10
11
  OnCamerasAvailableEventPayload,
11
12
  OnPhotoCapturedEventPayload,
13
+ OnCaptureStateChangeEventPayload,
14
+ OnErrorEventPayload,
12
15
  ZoomLevel
13
16
  } from '@supportworks/camera'
14
17
  import React, { useRef, useState } from 'react'
@@ -25,7 +28,8 @@ import {
25
28
  ScrollView,
26
29
  Animated,
27
30
  PanResponder,
28
- Platform
31
+ Platform,
32
+ useWindowDimensions
29
33
  } from 'react-native'
30
34
  import Svg, { Circle, Path } from 'react-native-svg'
31
35
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
@@ -50,15 +54,30 @@ interface CameraTestModalProps {
50
54
 
51
55
  // Event types are now imported from the camera module
52
56
 
53
- const ZOOM_SLIDER_TRACK_LENGTH = 180
54
- const ZOOM_SLIDER_WIDTH = 40
55
- const ZOOM_SLIDER_THUMB_SIZE = 32
56
- const MIN_ZOOM = 1
57
- const MAX_ZOOM = 5
58
- const ZOOM_STEP = 0.1
59
- const ZOOM_RANGE = MAX_ZOOM - MIN_ZOOM
60
57
  const DEFAULT_ZOOM = 1
61
58
  const FOCUS_RING_SIZE = 72
59
+ const RIGHT_CONTROL_SCALE = 1.4
60
+ const SIDE_BUTTON_SIZE = Math.round(38 * RIGHT_CONTROL_SCALE)
61
+ const SIDE_BUTTON_ICON_SIZE = Math.round(20 * RIGHT_CONTROL_SCALE)
62
+ const SIDE_BUTTON_TEXT_SIZE = Math.round(14 * RIGHT_CONTROL_SCALE)
63
+ const SIDE_BUTTON_GAP = 18
64
+ const SIDE_ACTION_GROUP_MARGIN_BOTTOM = 28
65
+ const GALLERY_PREVIEW_SIZE = Math.round(46 * RIGHT_CONTROL_SCALE)
66
+ const GALLERY_PREVIEW_MARGIN_BOTTOM = 32
67
+ const GALLERY_PREVIEW_BORDER_RADIUS = 14
68
+ const GALLERY_PREVIEW_BADGE_SIZE = 28
69
+ const SHUTTER_BUTTON_SIZE = 76
70
+ const SHUTTER_BUTTON_MARGIN_BOTTOM = 20
71
+ const DONE_BUTTON_HEIGHT = Math.round(36 * RIGHT_CONTROL_SCALE)
72
+ const DONE_BUTTON_HORIZONTAL_PADDING = 24
73
+ const DONE_BUTTON_TEXT_SIZE = 20
74
+ const DONE_BUTTON_ICON_SIZE = 28
75
+ const RIGHT_OVERLAY_WIDTH = 132
76
+ const ZOOM_SLIDER_TRACK_LENGTH = 180
77
+ const ZOOM_SLIDER_WIDTH = 60
78
+ const ZOOM_SLIDER_THUMB_SIZE = 42
79
+ const ZOOM_SLIDER_THUMB_WIDTH = 52
80
+ const ZOOM_STEP = 0.5
62
81
  type CameraPermissionState = 'checking' | 'granted' | 'denied'
63
82
 
64
83
  const waitForAppToBeActive = async () => {
@@ -76,35 +95,73 @@ const waitForAppToBeActive = async () => {
76
95
  })
77
96
  }
78
97
 
79
- const clamp = (value: number, min: number, max: number) => {
80
- return Math.min(Math.max(value, min), max)
98
+ const roundZoomValue = (value: number) => Math.round(value * 10) / 10
99
+ const clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max)
100
+ const snapZoomValue = (value: number, min: number, max: number) => {
101
+ const snapped = Math.round(value / ZOOM_STEP) * ZOOM_STEP
102
+ return roundZoomValue(clamp(snapped, min, max))
81
103
  }
82
104
 
83
105
  const formatZoomLabel = (zoom: number): ZoomLevel => {
84
- const rounded = Math.round(zoom * 10) / 10
106
+ const rounded = roundZoomValue(zoom)
85
107
  const isWhole = Math.abs(rounded - Math.round(rounded)) < 0.01
86
108
  return `${isWhole ? rounded.toFixed(0) : rounded.toFixed(1)}x`
87
109
  }
88
110
 
89
- const getTopPositionForZoom = (zoom: number) => {
90
- if (ZOOM_RANGE <= 0) {
111
+ const isSameZoomLevel = (left: number, right: number) => {
112
+ return Math.abs(left - right) < 0.01
113
+ }
114
+
115
+ const getTopPositionForZoom = (zoom: number, minZoom: number, maxZoom: number) => {
116
+ const zoomRange = maxZoom - minZoom
117
+ if (zoomRange <= 0.01) {
91
118
  return 0
92
119
  }
93
- const clampedZoom = clamp(zoom, MIN_ZOOM, MAX_ZOOM)
94
- const normalized = (MAX_ZOOM - clampedZoom) / ZOOM_RANGE
120
+
121
+ const clampedZoom = clamp(zoom, minZoom, maxZoom)
122
+ const normalized = (maxZoom - clampedZoom) / zoomRange
95
123
  return normalized * ZOOM_SLIDER_TRACK_LENGTH
96
124
  }
97
125
 
98
- const getZoomForTopPosition = (position: number): number => {
99
- if (ZOOM_RANGE <= 0) {
100
- return DEFAULT_ZOOM
126
+ const getZoomForTopPosition = (position: number, minZoom: number, maxZoom: number) => {
127
+ const zoomRange = maxZoom - minZoom
128
+ if (zoomRange <= 0.01) {
129
+ return minZoom
101
130
  }
102
131
 
103
132
  const clampedPosition = clamp(position, 0, ZOOM_SLIDER_TRACK_LENGTH)
104
133
  const normalized = clampedPosition / ZOOM_SLIDER_TRACK_LENGTH
105
- const zoom = MAX_ZOOM - normalized * ZOOM_RANGE
106
- const stepped = Math.round(zoom / ZOOM_STEP) * ZOOM_STEP
107
- return clamp(stepped, MIN_ZOOM, MAX_ZOOM)
134
+ const zoom = maxZoom - normalized * zoomRange
135
+ return snapZoomValue(zoom, minZoom, maxZoom)
136
+ }
137
+
138
+ const buildZoomRangeForPosition = (cameras: CameraInfo[], position: 'front' | 'back') => {
139
+ const positionCameras = cameras.filter((camera) => camera.position === position && camera.isAvailable)
140
+
141
+ if (!positionCameras.length || position === 'front') {
142
+ return { min: DEFAULT_ZOOM, max: DEFAULT_ZOOM }
143
+ }
144
+
145
+ let minActualZoom = Number.POSITIVE_INFINITY
146
+ let maxActualZoom = DEFAULT_ZOOM
147
+
148
+ positionCameras.forEach((camera) => {
149
+ const opticalZoom = typeof camera.zoomFactor === 'number' && camera.zoomFactor > 0 ? camera.zoomFactor : DEFAULT_ZOOM
150
+ const minFactor = typeof camera.minZoomFactor === 'number' && camera.minZoomFactor > 0 ? camera.minZoomFactor : DEFAULT_ZOOM
151
+ const maxFactor = typeof camera.maxZoomFactor === 'number' && camera.maxZoomFactor > 0 ? camera.maxZoomFactor : DEFAULT_ZOOM
152
+
153
+ minActualZoom = Math.min(minActualZoom, opticalZoom * minFactor)
154
+ maxActualZoom = Math.max(maxActualZoom, opticalZoom * maxFactor)
155
+ })
156
+
157
+ if (!Number.isFinite(minActualZoom)) {
158
+ return { min: DEFAULT_ZOOM, max: DEFAULT_ZOOM }
159
+ }
160
+
161
+ const minZoom = roundZoomValue(clamp(minActualZoom, 0.5, 5))
162
+ const maxZoom = roundZoomValue(clamp(Math.max(maxActualZoom, minZoom), minZoom, 5))
163
+
164
+ return { min: minZoom, max: maxZoom }
108
165
  }
109
166
 
110
167
  const FlipCameraIcon: React.FC<{ size?: number; color?: string }> = ({ size = 28, color = colors.white }) => (
@@ -142,6 +199,47 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
142
199
  const internalCameraRef = useRef<CameraViewRef>(null)
143
200
  const cameraRef = externalCameraRef || internalCameraRef
144
201
  const insets = useSafeAreaInsets()
202
+ const { width: windowWidth, height: windowHeight } = useWindowDimensions()
203
+ const shortestSide = Math.min(windowWidth, windowHeight)
204
+ const isLandscape = windowWidth > windowHeight
205
+ const isPhoneSized = shortestSide < 500
206
+ const isTightLayout = isPhoneSized && isLandscape
207
+ const controlScale = isTightLayout
208
+ ? clamp(windowHeight / 430, 0.72, 0.82)
209
+ : isPhoneSized
210
+ ? clamp(shortestSide / 430, 0.88, 0.94)
211
+ : 1
212
+ const scaleMetric = (value: number, min = 0) => Math.max(min, Math.round(value * controlScale))
213
+ const focusRingSize = scaleMetric(FOCUS_RING_SIZE, 52)
214
+ const cancelButtonMinWidth = scaleMetric(56, 48)
215
+ const cancelButtonHeight = scaleMetric(34, 30)
216
+ const cancelButtonPaddingHorizontal = scaleMetric(14, 12)
217
+ const cancelButtonFontSize = scaleMetric(14, 12)
218
+ const captureBadgeSize = scaleMetric(26, 22)
219
+ const captureBadgeFontSize = scaleMetric(13, 11)
220
+ const sideButtonSize = scaleMetric(SIDE_BUTTON_SIZE, 38)
221
+ const sideButtonGap = scaleMetric(SIDE_BUTTON_GAP, 10)
222
+ const sideButtonIconSize = scaleMetric(SIDE_BUTTON_ICON_SIZE, 20)
223
+ const sideButtonTextSize = scaleMetric(SIDE_BUTTON_TEXT_SIZE, 12)
224
+ const sideActionGroupMarginBottom = scaleMetric(SIDE_ACTION_GROUP_MARGIN_BOTTOM, 16)
225
+ const galleryPreviewSize = scaleMetric(GALLERY_PREVIEW_SIZE, 34)
226
+ const galleryPreviewMarginBottom = scaleMetric(GALLERY_PREVIEW_MARGIN_BOTTOM, 16)
227
+ const galleryPreviewBorderRadius = scaleMetric(GALLERY_PREVIEW_BORDER_RADIUS, 10)
228
+ const galleryPreviewBadgeSize = scaleMetric(GALLERY_PREVIEW_BADGE_SIZE, 22)
229
+ const shutterButtonSize = scaleMetric(SHUTTER_BUTTON_SIZE, 58)
230
+ const shutterButtonMarginBottom = scaleMetric(SHUTTER_BUTTON_MARGIN_BOTTOM, 12)
231
+ const shutterInnerSize = scaleMetric(62, 46)
232
+ const doneButtonHeight = scaleMetric(DONE_BUTTON_HEIGHT, 30)
233
+ const doneButtonHorizontalPadding = scaleMetric(DONE_BUTTON_HORIZONTAL_PADDING, 16)
234
+ const doneButtonTextSize = scaleMetric(DONE_BUTTON_TEXT_SIZE, 16)
235
+ const doneButtonIconSize = scaleMetric(DONE_BUTTON_ICON_SIZE, 20)
236
+ const doneButtonMarginBottom = scaleMetric(30, 18)
237
+ const rightOverlayWidth = scaleMetric(RIGHT_OVERLAY_WIDTH, 96)
238
+ const topOverlayHorizontalInset = isTightLayout ? 10 : isPhoneSized ? 14 : 18
239
+ const overlaySideInset = isTightLayout ? 8 : isPhoneSized ? 10 : 16
240
+ const showFlashControl = !isTightLayout
241
+ const showCameraSwitchControl = !isTightLayout
242
+ const showSecondaryControls = showFlashControl || showCameraSwitchControl
145
243
 
146
244
  // Debug logging
147
245
  React.useEffect(() => {
@@ -153,9 +251,12 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
153
251
  const [currentZoom, setCurrentZoom] = useState<number>(DEFAULT_ZOOM)
154
252
  const [isDepthEnabled, setIsDepthEnabled] = useState<boolean>(true)
155
253
  const [isFlashEnabled, setIsFlashEnabled] = useState<boolean>(false)
156
- const [canZoomByPosition, setCanZoomByPosition] = useState<{ front: boolean; back: boolean }>({
157
- front: false,
158
- back: false
254
+ const [zoomRangeByPosition, setZoomRangeByPosition] = useState<{
255
+ front: { min: number; max: number }
256
+ back: { min: number; max: number }
257
+ }>({
258
+ front: { min: DEFAULT_ZOOM, max: DEFAULT_ZOOM },
259
+ back: { min: DEFAULT_ZOOM, max: DEFAULT_ZOOM }
159
260
  })
160
261
  const [capturedImages, setCapturedImages] = useState<CapturedImage[]>([])
161
262
  const [isFrontCamera, setIsFrontCamera] = useState<boolean>(false)
@@ -163,13 +264,36 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
163
264
  const [isDoneButtonDisabled, setIsDoneButtonDisabled] = useState<boolean>(false)
164
265
  const [focusPoint, setFocusPoint] = useState<{ x: number; y: number } | null>(null)
165
266
  const [cameraPermissionState, setCameraPermissionState] = useState<CameraPermissionState>('checking')
166
- const knobTop = useRef(new Animated.Value(getTopPositionForZoom(DEFAULT_ZOOM))).current
267
+ const [isCapturePending, setIsCapturePending] = useState<boolean>(false)
167
268
  const focusAnim = useRef(new Animated.Value(0)).current
168
- const dragStartOffset = useRef(0)
269
+ const knobTop = useRef(new Animated.Value(0)).current
270
+ const isSliderDragging = useRef(false)
169
271
  const zoomRailRef = useRef<View>(null)
170
272
  const zoomRailTopRef = useRef<number | null>(null)
171
- const isZoomAvailable = isFrontCamera ? canZoomByPosition.front : canZoomByPosition.back
172
- const sliderDisabled = isFrontCamera || !isZoomAvailable
273
+ const capturePendingRef = useRef(false)
274
+ const currentZoomRange = isFrontCamera ? zoomRangeByPosition.front : zoomRangeByPosition.back
275
+ const isZoomAvailable = currentZoomRange.max - currentZoomRange.min > 0.01
276
+ const captureLimit = typeof limit === 'number' && limit > 0 ? limit : null
277
+ const hasReachedCaptureLimit = captureLimit !== null && capturedImages.length >= captureLimit
278
+ const isShutterDisabled = isCapturePending || hasReachedCaptureLimit
279
+ const isCancelDisabled = isCapturePending
280
+ const isDoneDisabled = isDoneButtonDisabled || isCapturePending
281
+ const captureLimitMessage = captureLimit
282
+ ? `Maximum of ${captureLimit} photo${captureLimit === 1 ? '' : 's'} reached`
283
+ : ''
284
+
285
+ const showCaptureLimitAlert = React.useCallback(() => {
286
+ if (!captureLimit) {
287
+ return
288
+ }
289
+
290
+ Alert.alert('Selection Limit', captureLimitMessage)
291
+ }, [captureLimit, captureLimitMessage])
292
+
293
+ const updateCapturePending = React.useCallback((nextValue: boolean) => {
294
+ capturePendingRef.current = nextValue
295
+ setIsCapturePending(nextValue)
296
+ }, [])
173
297
 
174
298
  React.useEffect(() => {
175
299
  let isCancelled = false
@@ -225,16 +349,10 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
225
349
 
226
350
  const handleCamerasAvailable = React.useCallback((event: { nativeEvent: OnCamerasAvailableEventPayload }) => {
227
351
  const cameras = event?.nativeEvent?.cameras || []
228
- const availability = { front: false, back: false }
229
- cameras.forEach((camera) => {
230
- const maxZoom = typeof camera.maxZoomFactor === 'number' ? camera.maxZoomFactor : 1
231
- const minZoom = typeof camera.minZoomFactor === 'number' ? camera.minZoomFactor : 1
232
- const hasZoom = maxZoom > 1.01 && maxZoom > minZoom
233
- if (camera.position === 'front' || camera.position === 'back') {
234
- availability[camera.position] = availability[camera.position] || hasZoom
235
- }
352
+ setZoomRangeByPosition({
353
+ front: buildZoomRangeForPosition(cameras, 'front'),
354
+ back: buildZoomRangeForPosition(cameras, 'back')
236
355
  })
237
- setCanZoomByPosition(availability)
238
356
  }, [])
239
357
 
240
358
  const handlePhotoCaptured = (event: { nativeEvent: OnPhotoCapturedEventPayload }) => {
@@ -253,12 +371,17 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
253
371
  }
254
372
 
255
373
  setCapturedImages((prevImages) => {
374
+ if (captureLimit && prevImages.length >= captureLimit) {
375
+ return prevImages
376
+ }
377
+
256
378
  // If limit is 1, and we already have an image, replace it
257
379
  if (limit === 1) {
258
380
  return [newImage]
259
381
  }
260
- // Otherwise add to the array
261
- return [...prevImages, newImage]
382
+
383
+ const nextImages = [...prevImages, newImage]
384
+ return captureLimit ? nextImages.slice(0, captureLimit) : nextImages
262
385
  })
263
386
 
264
387
  // If limit is 1, automatically trigger done after capture
@@ -278,18 +401,17 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
278
401
  }
279
402
  }
280
403
 
281
- const handleZoomRailLayout = React.useCallback(() => {
282
- zoomRailRef.current?.measureInWindow((_, y) => {
283
- zoomRailTopRef.current = y
284
- })
285
- }, [])
404
+ const handleCaptureStateChange = React.useCallback((event: { nativeEvent: OnCaptureStateChangeEventPayload }) => {
405
+ const nextValue = !!event?.nativeEvent?.isCapturing
406
+ console.log('CAMERA: Capture state changed:', nextValue)
407
+ updateCapturePending(nextValue)
408
+ }, [updateCapturePending])
286
409
 
287
- const getZoomOffsetFromEvent = (event: { nativeEvent: { locationY: number; pageY: number } }) => {
288
- const { locationY, pageY } = event.nativeEvent
289
- const railTop = zoomRailTopRef.current
290
- const rawOffset = railTop == null ? locationY : pageY - railTop
291
- return clamp(rawOffset - ZOOM_SLIDER_THUMB_SIZE / 2, 0, ZOOM_SLIDER_TRACK_LENGTH)
292
- }
410
+ const handleCameraError = React.useCallback((event: { nativeEvent: OnErrorEventPayload }) => {
411
+ const errorMessage = event?.nativeEvent?.error || 'Camera error'
412
+ console.log('CAMERA: Error event:', errorMessage)
413
+ updateCapturePending(false)
414
+ }, [updateCapturePending])
293
415
 
294
416
  const triggerFocusRing = React.useCallback(
295
417
  (x: number, y: number) => {
@@ -337,11 +459,27 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
337
459
  }
338
460
 
339
461
  const capturePhoto = () => {
462
+ if (capturePendingRef.current) {
463
+ return
464
+ }
465
+
466
+ if (hasReachedCaptureLimit) {
467
+ showCaptureLimitAlert()
468
+ return
469
+ }
470
+
340
471
  console.log('CAMERA: Attempting to capture photo')
472
+ updateCapturePending(true)
341
473
  triggerShutterFlash() // Trigger the flash effect
342
474
  if (cameraRef.current) {
343
- cameraRef.current.capturePhoto()
475
+ try {
476
+ cameraRef.current.capturePhoto()
477
+ } catch (error) {
478
+ updateCapturePending(false)
479
+ Alert.alert('Error', 'Unable to capture photo')
480
+ }
344
481
  } else {
482
+ updateCapturePending(false)
345
483
  Alert.alert('Error', 'Camera reference not available')
346
484
  }
347
485
  }
@@ -384,20 +522,18 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
384
522
  }
385
523
 
386
524
  const handleZoomChange = React.useCallback((newZoom: number) => {
387
- setCurrentZoom(clamp(newZoom, MIN_ZOOM, MAX_ZOOM))
388
- }, [])
389
-
390
- React.useEffect(() => {
391
- if (isFrontCamera && currentZoom !== DEFAULT_ZOOM) {
392
- setCurrentZoom(DEFAULT_ZOOM)
393
- }
394
- }, [isFrontCamera, currentZoom])
525
+ setCurrentZoom((prevZoom) => {
526
+ const nextZoom = snapZoomValue(newZoom, currentZoomRange.min, currentZoomRange.max)
527
+ return isSameZoomLevel(prevZoom, nextZoom) ? prevZoom : nextZoom
528
+ })
529
+ }, [currentZoomRange.max, currentZoomRange.min])
395
530
 
396
531
  React.useEffect(() => {
397
- if (!isZoomAvailable && currentZoom !== DEFAULT_ZOOM) {
398
- setCurrentZoom(DEFAULT_ZOOM)
532
+ const clampedZoom = snapZoomValue(currentZoom, currentZoomRange.min, currentZoomRange.max)
533
+ if (!isSameZoomLevel(clampedZoom, currentZoom)) {
534
+ setCurrentZoom(clampedZoom)
399
535
  }
400
- }, [isZoomAvailable, currentZoom])
536
+ }, [currentZoom, currentZoomRange.max, currentZoomRange.min])
401
537
 
402
538
  React.useEffect(() => {
403
539
  if (cameraRef.current) {
@@ -406,47 +542,81 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
406
542
  }, [cameraRef, currentZoom])
407
543
 
408
544
  React.useEffect(() => {
409
- const targetTop = getTopPositionForZoom(currentZoom)
410
- dragStartOffset.current = targetTop
545
+ const targetTop = getTopPositionForZoom(currentZoom, currentZoomRange.min, currentZoomRange.max)
546
+ if (isSliderDragging.current) {
547
+ knobTop.setValue(targetTop)
548
+ return
549
+ }
550
+
411
551
  Animated.spring(knobTop, {
412
552
  toValue: targetTop,
413
553
  useNativeDriver: false,
414
554
  tension: 180,
415
555
  friction: 20
416
556
  }).start()
417
- }, [currentZoom, knobTop])
557
+ }, [currentZoom, currentZoomRange.max, currentZoomRange.min, knobTop])
558
+
559
+ const measureZoomRail = React.useCallback(() => {
560
+ zoomRailRef.current?.measureInWindow((_, y) => {
561
+ zoomRailTopRef.current = y
562
+ })
563
+ }, [])
564
+
565
+ const getSliderTopFromGesture = React.useCallback(
566
+ (pageY: number, fallbackLocationY: number) => {
567
+ const railTop = zoomRailTopRef.current
568
+ const rawTop = railTop == null ? fallbackLocationY - ZOOM_SLIDER_THUMB_SIZE / 2 : pageY - railTop - ZOOM_SLIDER_THUMB_SIZE / 2
569
+ return clamp(rawTop, 0, ZOOM_SLIDER_TRACK_LENGTH)
570
+ },
571
+ []
572
+ )
573
+
574
+ const updateZoomFromSliderPosition = React.useCallback((rawTop: number) => {
575
+ const nextTop = clamp(rawTop, 0, ZOOM_SLIDER_TRACK_LENGTH)
576
+ const nextZoom = getZoomForTopPosition(nextTop, currentZoomRange.min, currentZoomRange.max)
577
+ const snappedTop = getTopPositionForZoom(nextZoom, currentZoomRange.min, currentZoomRange.max)
578
+
579
+ knobTop.stopAnimation()
580
+ knobTop.setValue(snappedTop)
581
+ handleZoomChange(nextZoom)
582
+ }, [currentZoomRange.max, currentZoomRange.min, handleZoomChange, knobTop])
418
583
 
419
584
  const sliderPanResponder = React.useMemo(
420
585
  () =>
421
586
  PanResponder.create({
422
- onStartShouldSetPanResponder: () => !sliderDisabled,
423
- onMoveShouldSetPanResponder: () => !sliderDisabled,
424
- onPanResponderGrant: (evt) => {
425
- const tapOffset = getZoomOffsetFromEvent(evt)
426
- dragStartOffset.current = tapOffset
427
- knobTop.setValue(tapOffset)
428
- handleZoomChange(getZoomForTopPosition(tapOffset))
587
+ onStartShouldSetPanResponder: () => isZoomAvailable,
588
+ onMoveShouldSetPanResponder: () => isZoomAvailable,
589
+ onPanResponderGrant: (event, gestureState) => {
590
+ isSliderDragging.current = true
591
+ measureZoomRail()
592
+ updateZoomFromSliderPosition(
593
+ getSliderTopFromGesture(gestureState.y0, event.nativeEvent.locationY)
594
+ )
429
595
  },
430
- onPanResponderMove: (evt) => {
431
- const next = getZoomOffsetFromEvent(evt)
432
- knobTop.setValue(next)
433
- handleZoomChange(getZoomForTopPosition(next))
596
+ onPanResponderMove: (event, gestureState) => {
597
+ updateZoomFromSliderPosition(
598
+ getSliderTopFromGesture(gestureState.moveY, event.nativeEvent.locationY)
599
+ )
434
600
  },
435
- onPanResponderRelease: (evt) => {
436
- const next = getZoomOffsetFromEvent(evt)
437
- handleZoomChange(getZoomForTopPosition(next))
601
+ onPanResponderRelease: (event, gestureState) => {
602
+ updateZoomFromSliderPosition(
603
+ getSliderTopFromGesture(gestureState.moveY, event.nativeEvent.locationY)
604
+ )
605
+ isSliderDragging.current = false
438
606
  },
439
- onPanResponderTerminate: (evt) => {
440
- const next = getZoomOffsetFromEvent(evt)
441
- handleZoomChange(getZoomForTopPosition(next))
607
+ onPanResponderTerminate: (event, gestureState) => {
608
+ updateZoomFromSliderPosition(
609
+ getSliderTopFromGesture(gestureState.moveY, event.nativeEvent.locationY)
610
+ )
611
+ isSliderDragging.current = false
442
612
  }
443
613
  }),
444
- [sliderDisabled, handleZoomChange, knobTop]
614
+ [getSliderTopFromGesture, isZoomAvailable, measureZoomRail, updateZoomFromSliderPosition]
445
615
  )
446
616
 
447
617
  const openGalleryModal = () => {
448
618
  console.log('OPENING GALLERY MODAL', capturedImages.length)
449
- if (capturedImages.length > 0) {
619
+ if (limit !== 1 && capturedImages.length > 0) {
450
620
  setIsGalleryModalVisible(true)
451
621
  }
452
622
  }
@@ -458,6 +628,53 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
458
628
  })
459
629
  }
460
630
 
631
+ const latestCapturedImage = capturedImages[capturedImages.length - 1]
632
+ const hasCapturedImages = capturedImages.length > 0
633
+ const shouldShowGalleryPreview = limit !== 1 && !isTightLayout
634
+ const shouldShowDoneButton = limit !== 1
635
+ const shouldShowZoomSlider = isZoomAvailable && !isTightLayout
636
+ const visibleSideControlCount = (showFlashControl ? 1 : 0) + (showCameraSwitchControl ? 1 : 0)
637
+ const gallerySubtitle = `${capturedImages.length} ${capturedImages.length === 1 ? 'image' : 'images'}`
638
+ const rightOverlayHeight =
639
+ (visibleSideControlCount > 0
640
+ ? sideButtonSize * visibleSideControlCount + sideButtonGap * Math.max(visibleSideControlCount - 1, 0) + sideActionGroupMarginBottom
641
+ : 0) +
642
+ (shouldShowGalleryPreview ? galleryPreviewSize + galleryPreviewMarginBottom : 0) +
643
+ shutterButtonSize +
644
+ shutterButtonMarginBottom +
645
+ (shouldShowDoneButton ? doneButtonHeight + doneButtonMarginBottom : 0)
646
+ const rightOverlayTop = Math.max(insets.top + (isTightLayout ? 64 : isPhoneSized ? 80 : 96), Math.round(windowHeight * 0.5 - rightOverlayHeight / 2))
647
+ const zoomSliderHeight = ZOOM_SLIDER_TRACK_LENGTH + ZOOM_SLIDER_THUMB_SIZE
648
+ const zoomSliderTop = Math.max(insets.top + (isPhoneSized ? 88 : 104), Math.round(windowHeight * 0.5 - zoomSliderHeight / 2))
649
+
650
+ const handleCancelPress = () => {
651
+ if (capturePendingRef.current) {
652
+ return
653
+ }
654
+ if (cameraRef.current) {
655
+ cameraRef.current.stopCamera()
656
+ }
657
+ onCancel()
658
+ }
659
+
660
+ const handleDonePress = () => {
661
+ if (isDoneDisabled) {
662
+ return
663
+ }
664
+
665
+ setIsDoneButtonDisabled(true)
666
+ if (cameraRef.current) {
667
+ cameraRef.current.stopCamera()
668
+ }
669
+
670
+ onDone(
671
+ capturedImages.map((img) => ({
672
+ imageURI: img.uri,
673
+ depthMapURI: img.depthMapUri
674
+ }))
675
+ )
676
+ }
677
+
461
678
  if (cameraPermissionState !== 'granted') {
462
679
  const isCheckingPermission = cameraPermissionState === 'checking'
463
680
 
@@ -465,21 +682,17 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
465
682
  <View style={styles.container}>
466
683
  <View
467
684
  style={[
468
- styles.topControls,
469
- { paddingTop: insets.top + 10, paddingLeft: 20 + insets.left, paddingRight: 20 + insets.right }
685
+ styles.topOverlay,
686
+ { paddingTop: insets.top + 8, paddingLeft: topOverlayHorizontalInset + insets.left, paddingRight: topOverlayHorizontalInset + insets.right }
470
687
  ]}
471
688
  >
472
- <View style={styles.topLeft} />
473
- <View style={styles.topRight}>
474
- <TouchableOpacity
475
- style={styles.topTextButton}
476
- hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
477
- onPress={onCancel}
478
- >
479
- <Icons.IconUndo width={18} height={18} fill={colors.white} />
480
- <Text style={styles.topTextButtonLabel}>Cancel</Text>
481
- </TouchableOpacity>
482
- </View>
689
+ <TouchableOpacity
690
+ style={[styles.cancelButton, { minWidth: cancelButtonMinWidth, height: cancelButtonHeight, paddingHorizontal: cancelButtonPaddingHorizontal, borderRadius: cancelButtonHeight / 2 }]}
691
+ hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
692
+ onPress={onCancel}
693
+ >
694
+ <Text style={[styles.cancelButtonText, { fontSize: cancelButtonFontSize }]}>Cancel</Text>
695
+ </TouchableOpacity>
483
696
  </View>
484
697
 
485
698
  <View style={styles.permissionStateContainer}>
@@ -513,54 +726,32 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
513
726
 
514
727
  return (
515
728
  <View style={styles.container}>
516
- {/* Top Controls */}
517
729
  <View
518
730
  style={[
519
- styles.topControls,
520
- { paddingTop: insets.top + 10, paddingLeft: 20 + insets.left, paddingRight: 20 + insets.right }
731
+ styles.topOverlay,
732
+ { paddingTop: insets.top + 8, paddingLeft: topOverlayHorizontalInset + insets.left, paddingRight: topOverlayHorizontalInset + insets.right }
521
733
  ]}
522
734
  >
523
- <View style={styles.topLeft} />
524
- {/* <View style={styles.topCenter}>
525
- <Text style={styles.statusText}>{status}</Text>
526
- </View> */}
527
- <View style={styles.topRight}>
528
- <TouchableOpacity
529
- style={styles.topTextButton}
530
- hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
531
- onPress={() => {
532
- // Stop camera first
533
- if (cameraRef.current) {
534
- cameraRef.current.stopCamera()
535
- }
536
- // Then call onCancel
537
- onCancel()
538
- }}
539
- >
540
- <Icons.IconUndo width={18} height={18} fill={colors.white} />
541
- <Text style={styles.topTextButtonLabel}>Cancel</Text>
542
- </TouchableOpacity>
543
- </View>
544
- </View>
545
- <View pointerEvents="box-none" style={[styles.sideControls, { right: 20 + insets.right }]}>
546
735
  <TouchableOpacity
547
736
  style={[
548
- styles.sideButton,
549
- styles.sideButtonSpacing,
550
- isFlashEnabled && styles.sideButtonActive,
551
- isFrontCamera && styles.sideButtonDisabled
737
+ styles.cancelButton,
738
+ { minWidth: cancelButtonMinWidth, height: cancelButtonHeight, paddingHorizontal: cancelButtonPaddingHorizontal, borderRadius: cancelButtonHeight / 2 },
739
+ isCancelDisabled && styles.cancelButtonDisabled
552
740
  ]}
553
- onPress={toggleFlash}
554
- disabled={isFrontCamera}
741
+ hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
742
+ onPress={handleCancelPress}
743
+ disabled={isCancelDisabled}
555
744
  >
556
- <Text style={styles.sideButtonText}>⚡</Text>
557
- </TouchableOpacity>
558
- <TouchableOpacity style={[styles.sideButton, styles.sideButtonSpacing]} onPress={toggleCamera}>
559
- <FlipCameraIcon color={colors.white} />
560
- </TouchableOpacity>
561
- <TouchableOpacity style={[styles.shutterButton, styles.recordButtonOffset]} onPress={capturePhoto}>
562
- <View style={styles.shutterInner} />
745
+ <Text style={[styles.cancelButtonText, { fontSize: cancelButtonFontSize }]}>Cancel</Text>
563
746
  </TouchableOpacity>
747
+
748
+ {hasCapturedImages ? (
749
+ <View style={[styles.captureCountBadge, { width: captureBadgeSize, height: captureBadgeSize, borderRadius: captureBadgeSize / 2 }]}>
750
+ <Text style={[styles.captureCountBadgeText, { fontSize: captureBadgeFontSize }]}>{capturedImages.length}</Text>
751
+ </View>
752
+ ) : (
753
+ <View style={[styles.topOverlaySpacer, { width: captureBadgeSize, height: captureBadgeSize }]} />
754
+ )}
564
755
  </View>
565
756
 
566
757
  {/* Camera View */}
@@ -573,6 +764,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
573
764
  onStatusChange={handleStatusChange}
574
765
  onCamerasAvailable={handleCamerasAvailable}
575
766
  onPhotoCaptured={handlePhotoCaptured}
767
+ onCaptureStateChange={handleCaptureStateChange}
768
+ onError={handleCameraError}
576
769
  style={styles.camera}
577
770
  />
578
771
  {focusPoint ? (
@@ -580,8 +773,11 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
580
773
  style={[
581
774
  styles.focusRing,
582
775
  {
583
- left: focusPoint.x - FOCUS_RING_SIZE / 2,
584
- top: focusPoint.y - FOCUS_RING_SIZE / 2,
776
+ width: focusRingSize,
777
+ height: focusRingSize,
778
+ borderRadius: focusRingSize / 2,
779
+ left: focusPoint.x - focusRingSize / 2,
780
+ top: focusPoint.y - focusRingSize / 2,
585
781
  opacity: focusAnim.interpolate({
586
782
  inputRange: [0, 0.7, 1],
587
783
  outputRange: [1, 0.8, 0]
@@ -601,13 +797,135 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
601
797
  </Pressable>
602
798
  </View>
603
799
 
604
- {isZoomAvailable ? (
605
- <View pointerEvents="box-none" style={[styles.zoomSliderContainer, { left: 20 + insets.left }]}>
606
- <View style={[styles.zoomSlider, sliderDisabled && styles.zoomSliderDisabled]}>
800
+ <View
801
+ pointerEvents="box-none"
802
+ style={[styles.rightOverlay, { width: rightOverlayWidth, right: overlaySideInset + insets.right, top: rightOverlayTop }]}
803
+ >
804
+ {showSecondaryControls && (
805
+ <View style={[styles.sideActionGroup, { marginBottom: sideActionGroupMarginBottom }]}>
806
+ {showFlashControl && (
807
+ <TouchableOpacity
808
+ style={[
809
+ styles.sideButton,
810
+ { width: sideButtonSize, height: sideButtonSize, borderRadius: sideButtonSize / 2 },
811
+ showCameraSwitchControl && { marginBottom: sideButtonGap },
812
+ isFlashEnabled && styles.sideButtonActive,
813
+ isFrontCamera && styles.sideButtonDisabled
814
+ ]}
815
+ onPress={toggleFlash}
816
+ disabled={isFrontCamera}
817
+ >
818
+ <Text style={[styles.sideButtonText, { fontSize: sideButtonTextSize }]}>⚡</Text>
819
+ </TouchableOpacity>
820
+ )}
821
+ {showCameraSwitchControl && (
822
+ <TouchableOpacity
823
+ style={[styles.sideButton, { width: sideButtonSize, height: sideButtonSize, borderRadius: sideButtonSize / 2 }]}
824
+ onPress={toggleCamera}
825
+ >
826
+ <FlipCameraIcon size={sideButtonIconSize} color={colors.white} />
827
+ </TouchableOpacity>
828
+ )}
829
+ </View>
830
+ )}
831
+
832
+ {shouldShowGalleryPreview ? (
833
+ <TouchableOpacity
834
+ style={[
835
+ styles.galleryPreviewButton,
836
+ {
837
+ width: galleryPreviewSize,
838
+ height: galleryPreviewSize,
839
+ borderRadius: galleryPreviewBorderRadius,
840
+ marginBottom: galleryPreviewMarginBottom
841
+ },
842
+ !hasCapturedImages && styles.galleryPreviewButtonEmpty
843
+ ]}
844
+ onPress={openGalleryModal}
845
+ activeOpacity={0.9}
846
+ >
847
+ {latestCapturedImage ? (
848
+ <Image source={{ uri: latestCapturedImage.uri }} style={[styles.galleryPreviewImage, { borderRadius: Math.max(6, galleryPreviewBorderRadius - 2) }]} resizeMode="cover" />
849
+ ) : (
850
+ <View style={[styles.galleryPreviewPlaceholder, { borderRadius: Math.max(6, galleryPreviewBorderRadius - 2) }]} />
851
+ )}
852
+ {hasCapturedImages ? (
853
+ <View
854
+ style={[
855
+ styles.galleryPreviewBadge,
856
+ {
857
+ right: Math.round(-8 * controlScale),
858
+ minWidth: galleryPreviewBadgeSize,
859
+ height: galleryPreviewBadgeSize,
860
+ borderRadius: galleryPreviewBadgeSize / 2
861
+ }
862
+ ]}
863
+ pointerEvents="none"
864
+ >
865
+ <Text style={styles.galleryPreviewBadgeText}>{capturedImages.length}</Text>
866
+ </View>
867
+ ) : null}
868
+ </TouchableOpacity>
869
+ ) : null}
870
+
871
+ <TouchableOpacity
872
+ style={[
873
+ styles.shutterButton,
874
+ { width: shutterButtonSize, height: shutterButtonSize, borderRadius: shutterButtonSize / 2, marginBottom: shutterButtonMarginBottom },
875
+ isShutterDisabled && styles.shutterButtonDisabled
876
+ ]}
877
+ onPress={capturePhoto}
878
+ disabled={isShutterDisabled}
879
+ >
880
+ <View
881
+ style={[
882
+ styles.shutterButtonOuter,
883
+ { width: shutterButtonSize, height: shutterButtonSize, borderRadius: shutterButtonSize / 2, borderWidth: Math.max(2, Math.round(3 * controlScale)) },
884
+ isShutterDisabled && styles.shutterButtonOuterDisabled
885
+ ]}
886
+ />
887
+ <View
888
+ style={[
889
+ styles.shutterInner,
890
+ { width: shutterInnerSize, height: shutterInnerSize, borderRadius: shutterInnerSize / 2 },
891
+ isShutterDisabled && styles.shutterInnerDisabled
892
+ ]}
893
+ />
894
+ </TouchableOpacity>
895
+
896
+ {shouldShowDoneButton ? (
897
+ <TouchableOpacity
898
+ style={[
899
+ styles.doneButton,
900
+ { height: doneButtonHeight, paddingHorizontal: doneButtonHorizontalPadding, borderRadius: doneButtonHeight / 2, marginBottom: doneButtonMarginBottom },
901
+ isDoneDisabled && styles.doneButtonDisabled
902
+ ]}
903
+ onPress={handleDonePress}
904
+ disabled={isDoneDisabled}
905
+ >
906
+ <Text style={[styles.doneButtonText, { fontSize: doneButtonTextSize }]}>Done</Text>
907
+ <View style={[styles.doneButtonIcon, { marginLeft: Math.max(6, Math.round(8 * controlScale)) }]}>
908
+ <Icons.IconForward_WithPad size={doneButtonIconSize} fill={colors.white} fillOpacity={1} />
909
+ </View>
910
+ </TouchableOpacity>
911
+ ) : null}
912
+ </View>
913
+
914
+ {hasReachedCaptureLimit && limit !== 1 ? (
915
+ <View pointerEvents="none" style={styles.captureLimitBannerOverlay}>
916
+ <View style={styles.captureLimitBanner}>
917
+ <Text style={styles.captureLimitBannerText}>{captureLimitMessage}</Text>
918
+ </View>
919
+ </View>
920
+ ) : null}
921
+
922
+ {shouldShowZoomSlider ? (
923
+ <View pointerEvents="box-none" style={[styles.zoomSliderContainer, { left: 12 + insets.left, top: zoomSliderTop }]}>
924
+ <View style={styles.zoomSlider}>
607
925
  <View
608
926
  ref={zoomRailRef}
609
927
  style={styles.zoomRailContainer}
610
- onLayout={handleZoomRailLayout}
928
+ onLayout={measureZoomRail}
611
929
  {...sliderPanResponder.panHandlers}
612
930
  >
613
931
  <View style={styles.zoomRail} />
@@ -619,61 +937,6 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
619
937
  </View>
620
938
  ) : null}
621
939
 
622
- {/* Bottom Controls Container */}
623
- <View style={styles.bottomControlsContainer}>
624
- {/* Gallery Thumbnail - Left */}
625
-
626
- <TouchableOpacity style={styles.galleryContainer} onPress={openGalleryModal}>
627
- {capturedImages.length > 0 ? (
628
- <>
629
- <View style={styles.galleryThumbnail}>
630
- <Image
631
- source={{
632
- uri: capturedImages[capturedImages.length - 1].uri
633
- }}
634
- style={styles.galleryImage}
635
- resizeMode="cover"
636
- />
637
- </View>
638
- <View style={styles.galleryBadge} pointerEvents="none">
639
- <Text style={styles.galleryBadgeText}>{capturedImages.length}</Text>
640
- </View>
641
- </>
642
- ) : (
643
- <View style={styles.galleryPlaceholder} />
644
- )}
645
- </TouchableOpacity>
646
-
647
- {/* Done Button - Right */}
648
- <View style={styles.doneButtonContainer}>
649
- <CommonButton
650
- label="Done"
651
- disabled={isDoneButtonDisabled}
652
- onPress={() => {
653
- if (isDoneButtonDisabled) {
654
- return
655
- }
656
- setIsDoneButtonDisabled(true)
657
- // Stop camera first
658
- if (cameraRef.current) {
659
- cameraRef.current.stopCamera()
660
- }
661
- // Then call onDone with images
662
- onDone(
663
- capturedImages.map((img) => ({
664
- imageURI: img.uri,
665
- depthMapURI: img.depthMapUri
666
- }))
667
- )
668
- }}
669
- size="medium"
670
- color="primary"
671
- variant="filled"
672
- endIcon={<Icons.IconForward_WithPad />}
673
- />
674
- </View>
675
- </View>
676
-
677
940
  {/* Shutter Flash Overlay */}
678
941
  <Animated.View style={[styles.shutterFlashOverlay, { opacity: shutterFlashAnim }]} pointerEvents="none" />
679
942
 
@@ -682,37 +945,56 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
682
945
  key={`gallery-${isGalleryModalVisible}`}
683
946
  ref={swipeModalRef}
684
947
  visible={isGalleryModalVisible}
685
- title="Captured Images"
686
- subtitle={`${capturedImages.length} images`}
687
948
  onClose={() => setIsGalleryModalVisible(false)}
688
949
  scrollOffset={1}
689
- height={240}
950
+ height={228}
690
951
  propagateSwipe
691
- navBarType={3}
952
+ showTopNav={false}
953
+ backgroundColor="#151515"
692
954
  >
693
- <ScrollView
694
- horizontal
695
- showsHorizontalScrollIndicator={false}
696
- contentContainerStyle={styles.galleryScrollContainer}
697
- decelerationRate="fast"
698
- >
699
- {capturedImages
700
- .slice()
701
- .reverse()
702
- .map((image, index) => (
703
- <View key={index} style={styles.galleryImageItem}>
704
- <Image source={{ uri: image.uri }} style={styles.galleryModalImage} resizeMode="cover" />
705
- <View style={styles.galleryImageOverlay}>
955
+ <View style={styles.gallerySheet}>
956
+ <View style={styles.gallerySheetHeader}>
957
+ <TouchableOpacity
958
+ style={styles.gallerySheetClose}
959
+ onPress={() => swipeModalRef.current?.closeModal('cancel')}
960
+ hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
961
+ >
962
+ <Icons.IconClose_WithPad size={18} fill={colors.white} fillOpacity={1} />
963
+ </TouchableOpacity>
964
+
965
+ <View style={styles.gallerySheetTitleWrap}>
966
+ <Text style={styles.gallerySheetTitle}>Session Roll</Text>
967
+ <Text style={styles.gallerySheetSubtitle}>{gallerySubtitle}</Text>
968
+ </View>
969
+
970
+ <View style={styles.gallerySheetHeaderSpacer} />
971
+ </View>
972
+
973
+ <View style={styles.galleryDivider} />
974
+
975
+ <ScrollView
976
+ horizontal
977
+ showsHorizontalScrollIndicator={false}
978
+ contentContainerStyle={styles.galleryScrollContainer}
979
+ decelerationRate="fast"
980
+ >
981
+ {capturedImages
982
+ .slice()
983
+ .reverse()
984
+ .map((image, index) => (
985
+ <View key={index} style={styles.galleryImageItem}>
986
+ <Image source={{ uri: image.uri }} style={styles.galleryModalImage} resizeMode="cover" />
706
987
  <TouchableOpacity
707
988
  style={styles.removeButton}
708
989
  onPress={() => removeImage(capturedImages.length - 1 - index)}
990
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
709
991
  >
710
- <Icons.IconClose_WithPad />
992
+ <Icons.IconClose_WithPad size={16} fill={colors.black} fillOpacity={0.72} />
711
993
  </TouchableOpacity>
712
994
  </View>
713
- </View>
714
- ))}
715
- </ScrollView>
995
+ ))}
996
+ </ScrollView>
997
+ </View>
716
998
  </SwipeModal>
717
999
  </View>
718
1000
  )
@@ -721,7 +1003,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
721
1003
  const styles = StyleSheet.create({
722
1004
  container: {
723
1005
  flex: 1,
724
- padding: 10
1006
+ backgroundColor: colors.black
725
1007
  },
726
1008
  permissionStateContainer: {
727
1009
  flex: 1,
@@ -767,91 +1049,65 @@ const styles = StyleSheet.create({
767
1049
  fontSize: 15,
768
1050
  fontWeight: 'bold'
769
1051
  },
770
- topControls: {
1052
+ topOverlay: {
771
1053
  position: 'absolute',
772
1054
  top: 0,
773
1055
  left: 0,
774
1056
  right: 0,
775
- height: 60,
776
1057
  flexDirection: 'row',
777
1058
  alignItems: 'center',
778
1059
  justifyContent: 'space-between',
779
1060
  zIndex: 10
780
1061
  },
781
- topLeft: {
782
- width: 60,
783
- alignItems: 'flex-start',
784
- justifyContent: 'center'
1062
+ topOverlaySpacer: {
1063
+ width: 30,
1064
+ height: 30
785
1065
  },
786
- topCenter: {
787
- flex: 1,
788
- alignItems: 'center',
789
- justifyContent: 'center'
790
- },
791
- topRight: {
792
- flexDirection: 'row',
1066
+ cancelButton: {
1067
+ minWidth: 56,
1068
+ height: 34,
1069
+ paddingHorizontal: 14,
1070
+ borderRadius: 17,
1071
+ backgroundColor: 'rgba(255,255,255,0.14)',
793
1072
  alignItems: 'center',
794
- justifyContent: 'flex-end',
795
- flex: 1
796
- },
797
- topTextButton: {
798
- flexDirection: 'row',
799
- alignItems: 'center',
800
- backgroundColor: colors.black60,
801
- borderRadius: 22,
802
- paddingHorizontal: 18,
803
- height: 44,
804
- minWidth: 100,
805
1073
  justifyContent: 'center'
806
1074
  },
807
- topTextButtonLabel: {
808
- color: colors.white,
809
- fontSize: 16,
810
- fontWeight: 'bold',
811
- marginLeft: 6
1075
+ cancelButtonDisabled: {
1076
+ opacity: 0.45
812
1077
  },
813
- statusText: {
1078
+ cancelButtonText: {
814
1079
  color: colors.white,
815
1080
  fontSize: 14,
816
- fontWeight: '500'
817
- },
818
- sideControls: {
819
- position: 'absolute',
820
- top: 0,
821
- bottom: 0,
822
- right: 20,
823
- justifyContent: 'center',
824
- alignItems: 'center',
825
- zIndex: 10
1081
+ fontWeight: 'bold',
1082
+ opacity: 0.92
826
1083
  },
827
- sideButton: {
828
- width: 44,
829
- height: 44,
830
- borderRadius: 22,
831
- backgroundColor: colors.black60,
1084
+ captureCountBadge: {
1085
+ width: 26,
1086
+ height: 26,
1087
+ borderRadius: 13,
1088
+ backgroundColor: colors.yellow,
1089
+ borderWidth: 2,
1090
+ borderColor: colors.white,
832
1091
  alignItems: 'center',
833
1092
  justifyContent: 'center'
834
1093
  },
835
- sideButtonSpacing: {
836
- marginBottom: 18
1094
+ captureCountBadgeText: {
1095
+ color: colors.white,
1096
+ fontSize: 13,
1097
+ fontWeight: 'bold'
837
1098
  },
838
1099
  sideButtonText: {
839
1100
  color: colors.white,
840
- fontSize: 16,
1101
+ fontSize: SIDE_BUTTON_TEXT_SIZE,
841
1102
  fontWeight: 'bold'
842
1103
  },
843
- sideButtonActive: {
844
- backgroundColor: colors.blue
845
- },
846
- sideButtonDisabled: {
847
- opacity: 0.4
848
- },
849
1104
  cameraContainer: {
850
1105
  position: 'absolute',
851
1106
  top: 0,
852
1107
  left: 0,
853
1108
  right: 0,
854
- bottom: 0
1109
+ bottom: 0,
1110
+ overflow: 'hidden'
855
1111
  },
856
1112
  cameraTouchLayer: {
857
1113
  flex: 1
@@ -868,83 +1124,111 @@ const styles = StyleSheet.create({
868
1124
  borderColor: colors.white,
869
1125
  backgroundColor: 'transparent'
870
1126
  },
871
- bottomControlsContainer: {
1127
+ rightOverlay: {
872
1128
  position: 'absolute',
873
- bottom: 30,
874
- left: 0,
875
- right: 0,
876
- flexDirection: 'row',
1129
+ width: RIGHT_OVERLAY_WIDTH,
877
1130
  alignItems: 'center',
878
- justifyContent: 'space-between',
879
- paddingHorizontal: 20,
880
- zIndex: 10
1131
+ zIndex: 12
881
1132
  },
882
- galleryContainer: {
883
- width: 100,
884
- height: 60,
885
- alignItems: 'flex-start',
1133
+ captureLimitBannerOverlay: {
1134
+ ...StyleSheet.absoluteFillObject,
1135
+ alignItems: 'center',
886
1136
  justifyContent: 'center',
887
- overflow: 'visible'
1137
+ paddingHorizontal: 24,
1138
+ zIndex: 11
888
1139
  },
889
- galleryThumbnail: {
890
- width: 50,
891
- height: 50,
892
- borderRadius: 8,
893
- overflow: 'hidden',
894
- position: 'relative',
895
- backgroundColor: colors.black60,
896
- borderWidth: 2,
897
- borderColor: colors.white
1140
+ captureLimitBanner: {
1141
+ minWidth: 220,
1142
+ maxWidth: 320,
1143
+ paddingHorizontal: 18,
1144
+ paddingVertical: 12,
1145
+ borderRadius: 12,
1146
+ backgroundColor: 'rgba(6, 7, 8, 0.72)',
1147
+ alignItems: 'center',
1148
+ justifyContent: 'center'
898
1149
  },
899
- galleryImage: {
1150
+ captureLimitBannerText: {
1151
+ color: colors.white,
1152
+ fontSize: 12,
1153
+ fontWeight: '600',
1154
+ textAlign: 'center',
1155
+ lineHeight: 16
1156
+ },
1157
+ sideActionGroup: {
1158
+ width: '100%',
1159
+ alignItems: 'center',
1160
+ marginBottom: SIDE_ACTION_GROUP_MARGIN_BOTTOM
1161
+ },
1162
+ sideButtonSpacing: {
1163
+ marginBottom: SIDE_BUTTON_GAP
1164
+ },
1165
+ sideButton: {
1166
+ width: SIDE_BUTTON_SIZE,
1167
+ height: SIDE_BUTTON_SIZE,
1168
+ borderRadius: SIDE_BUTTON_SIZE / 2,
1169
+ backgroundColor: 'rgba(6, 7, 8, 0.34)',
1170
+ alignItems: 'center',
1171
+ justifyContent: 'center'
1172
+ },
1173
+ sideButtonActive: {
1174
+ backgroundColor: 'rgba(24, 113, 231, 0.82)'
1175
+ },
1176
+ sideButtonDisabled: {
1177
+ opacity: 0.42
1178
+ },
1179
+ galleryPreviewButton: {
1180
+ width: GALLERY_PREVIEW_SIZE,
1181
+ height: GALLERY_PREVIEW_SIZE,
1182
+ borderRadius: GALLERY_PREVIEW_BORDER_RADIUS,
1183
+ backgroundColor: 'rgba(255,255,255,0.12)',
1184
+ borderWidth: 1.5,
1185
+ borderColor: colors.white,
1186
+ overflow: 'visible',
1187
+ alignItems: 'center',
1188
+ justifyContent: 'center',
1189
+ marginBottom: GALLERY_PREVIEW_MARGIN_BOTTOM
1190
+ },
1191
+ galleryPreviewButtonEmpty: {
1192
+ borderColor: 'rgba(255,255,255,0.42)',
1193
+ backgroundColor: 'rgba(6, 7, 8, 0.18)'
1194
+ },
1195
+ galleryPreviewImage: {
900
1196
  width: '100%',
901
1197
  height: '100%',
902
- position: 'absolute',
903
- top: 0,
904
- left: 0
1198
+ borderRadius: GALLERY_PREVIEW_BORDER_RADIUS - 2
905
1199
  },
906
- galleryBadge: {
1200
+ galleryPreviewPlaceholder: {
1201
+ width: '100%',
1202
+ height: '100%',
1203
+ borderRadius: GALLERY_PREVIEW_BORDER_RADIUS - 2,
1204
+ backgroundColor: 'rgba(255,255,255,0.08)'
1205
+ },
1206
+ galleryPreviewBadge: {
907
1207
  position: 'absolute',
908
- top: -5,
909
- right: 42, // Position relative to the 100px container, accounting for 50px thumbnail
910
- width: 22,
911
- height: 22,
912
- borderRadius: 11,
1208
+ top: 0,
1209
+ right: -8,
1210
+ minWidth: GALLERY_PREVIEW_BADGE_SIZE,
1211
+ height: GALLERY_PREVIEW_BADGE_SIZE,
1212
+ paddingHorizontal: 6,
1213
+ borderRadius: GALLERY_PREVIEW_BADGE_SIZE / 2,
913
1214
  backgroundColor: colors.blue,
914
1215
  alignItems: 'center',
915
- justifyContent: 'center',
916
- opacity: 1
1216
+ justifyContent: 'center'
917
1217
  },
918
- galleryBadgeText: {
1218
+ galleryPreviewBadgeText: {
919
1219
  color: colors.white,
920
- fontSize: 12,
1220
+ fontSize: 15,
921
1221
  fontWeight: 'bold'
922
1222
  },
923
- galleryPlaceholder: {
924
- width: 50,
925
- height: 50,
926
- borderRadius: 8,
927
- backgroundColor: colors.black60,
928
- borderWidth: 2,
929
- borderColor: colors.black40,
930
- borderStyle: 'dashed'
931
- },
932
1223
  zoomSliderContainer: {
933
1224
  position: 'absolute',
934
- top: 0,
935
- bottom: 0,
936
- justifyContent: 'center',
1225
+ width: ZOOM_SLIDER_WIDTH,
937
1226
  alignItems: 'center',
938
1227
  zIndex: 12,
939
- width: ZOOM_SLIDER_WIDTH
940
1228
  },
941
1229
  zoomSlider: {
942
1230
  width: ZOOM_SLIDER_WIDTH,
943
- alignItems: 'center',
944
- paddingVertical: 12
945
- },
946
- zoomSliderDisabled: {
947
- opacity: 0.4
1231
+ alignItems: 'center'
948
1232
  },
949
1233
  zoomRailContainer: {
950
1234
  width: ZOOM_SLIDER_WIDTH,
@@ -956,114 +1240,149 @@ const styles = StyleSheet.create({
956
1240
  position: 'absolute',
957
1241
  top: ZOOM_SLIDER_THUMB_SIZE / 2,
958
1242
  bottom: ZOOM_SLIDER_THUMB_SIZE / 2,
959
- width: 4,
960
- borderRadius: 2,
961
- backgroundColor: colors.black60
1243
+ width: 2,
1244
+ borderRadius: 1,
1245
+ backgroundColor: 'rgba(255,255,255,0.18)'
962
1246
  },
963
1247
  zoomThumb: {
964
1248
  position: 'absolute',
965
- width: ZOOM_SLIDER_THUMB_SIZE,
1249
+ width: ZOOM_SLIDER_THUMB_WIDTH,
966
1250
  height: ZOOM_SLIDER_THUMB_SIZE,
967
1251
  borderRadius: ZOOM_SLIDER_THUMB_SIZE / 2,
968
- backgroundColor: colors.white,
1252
+ backgroundColor: colors.blue,
969
1253
  alignItems: 'center',
970
1254
  justifyContent: 'center',
971
- left: (ZOOM_SLIDER_WIDTH - ZOOM_SLIDER_THUMB_SIZE) / 2,
972
- borderWidth: 2,
973
- borderColor: colors.blue
1255
+ left: (ZOOM_SLIDER_WIDTH - ZOOM_SLIDER_THUMB_WIDTH) / 2
974
1256
  },
975
1257
  zoomThumbText: {
976
- color: colors.blue,
1258
+ color: colors.white,
977
1259
  fontSize: 12,
978
1260
  fontWeight: 'bold'
979
1261
  },
980
- modeContainer: {
981
- position: 'absolute',
982
- bottom: 80,
983
- left: 0,
984
- right: 0,
1262
+ shutterButton: {
1263
+ width: SHUTTER_BUTTON_SIZE,
1264
+ height: SHUTTER_BUTTON_SIZE,
1265
+ borderRadius: SHUTTER_BUTTON_SIZE / 2,
985
1266
  alignItems: 'center',
986
- justifyContent: 'center'
1267
+ justifyContent: 'center',
1268
+ marginBottom: SHUTTER_BUTTON_MARGIN_BOTTOM
987
1269
  },
988
- modeButton: {
989
- paddingHorizontal: 16,
990
- paddingVertical: 8,
991
- borderRadius: 15,
992
- backgroundColor: colors.black60,
1270
+ shutterButtonDisabled: {
1271
+ opacity: 0.65
1272
+ },
1273
+ shutterButtonOuter: {
1274
+ position: 'absolute',
1275
+ width: SHUTTER_BUTTON_SIZE,
1276
+ height: SHUTTER_BUTTON_SIZE,
1277
+ borderRadius: SHUTTER_BUTTON_SIZE / 2,
1278
+ borderWidth: 3,
1279
+ borderColor: colors.white,
1280
+ backgroundColor: 'rgba(255,255,255,0.16)'
1281
+ },
1282
+ shutterButtonOuterDisabled: {
1283
+ borderColor: 'rgba(255,255,255,0.6)',
1284
+ backgroundColor: 'rgba(255,255,255,0.08)'
1285
+ },
1286
+ shutterInner: {
1287
+ width: 62,
1288
+ height: 62,
1289
+ borderRadius: 31,
1290
+ backgroundColor: colors.white
1291
+ },
1292
+ shutterInnerDisabled: {
1293
+ backgroundColor: 'rgba(255,255,255,0.72)'
1294
+ },
1295
+ doneButton: {
1296
+ height: DONE_BUTTON_HEIGHT,
1297
+ paddingHorizontal: DONE_BUTTON_HORIZONTAL_PADDING,
1298
+ borderRadius: DONE_BUTTON_HEIGHT / 2,
1299
+ backgroundColor: colors.blue,
1300
+ flexDirection: 'row',
993
1301
  alignItems: 'center',
994
- justifyContent: 'center'
1302
+ justifyContent: 'center',
1303
+ marginBottom: 30
995
1304
  },
996
- modeButtonText: {
1305
+ doneButtonText: {
997
1306
  color: colors.white,
998
- fontSize: 12,
1307
+ fontSize: DONE_BUTTON_TEXT_SIZE,
999
1308
  fontWeight: 'bold'
1000
1309
  },
1001
- shutterButton: {
1002
- width: 80,
1003
- height: 80,
1004
- borderRadius: 40,
1005
- backgroundColor: 'transparent',
1006
- alignItems: 'center',
1007
- justifyContent: 'center',
1008
- borderWidth: 4,
1009
- borderColor: colors.white
1310
+ doneButtonIcon: {
1311
+ marginLeft: 8
1010
1312
  },
1011
- recordButtonOffset: {
1012
- marginTop: 20
1313
+ doneButtonDisabled: {
1314
+ opacity: 0.45
1013
1315
  },
1014
- shutterInner: {
1015
- width: 65,
1016
- height: 65,
1017
- borderRadius: 30,
1018
- backgroundColor: colors.white
1316
+ gallerySheet: {
1317
+ flex: 1,
1318
+ paddingBottom: 16
1019
1319
  },
1020
- doneButtonContainer: {
1021
- width: 100,
1022
- alignItems: 'flex-end',
1320
+ gallerySheetHeader: {
1321
+ flexDirection: 'row',
1322
+ alignItems: 'center',
1323
+ justifyContent: 'space-between',
1324
+ paddingHorizontal: 14,
1325
+ paddingTop: 4,
1326
+ paddingBottom: 10
1327
+ },
1328
+ gallerySheetClose: {
1329
+ width: 32,
1330
+ height: 32,
1331
+ alignItems: 'center',
1023
1332
  justifyContent: 'center'
1024
1333
  },
1025
- doneButtonText: {
1334
+ gallerySheetTitleWrap: {
1335
+ flex: 1,
1336
+ alignItems: 'center',
1337
+ justifyContent: 'center'
1338
+ },
1339
+ gallerySheetTitle: {
1026
1340
  color: colors.white,
1027
- fontSize: 14,
1341
+ fontSize: 15,
1028
1342
  fontWeight: 'bold'
1029
1343
  },
1344
+ gallerySheetSubtitle: {
1345
+ color: 'rgba(255,255,255,0.58)',
1346
+ fontSize: 12,
1347
+ marginTop: 3
1348
+ },
1349
+ gallerySheetHeaderSpacer: {
1350
+ width: 32,
1351
+ height: 32
1352
+ },
1353
+ galleryDivider: {
1354
+ height: 1,
1355
+ backgroundColor: 'rgba(255,255,255,0.09)',
1356
+ marginBottom: 14
1357
+ },
1030
1358
  galleryScrollContainer: {
1031
- paddingHorizontal: 16,
1032
- paddingVertical: 16,
1359
+ paddingHorizontal: 14,
1033
1360
  alignItems: 'center'
1034
1361
  },
1035
1362
  galleryImageItem: {
1036
- width: 90,
1037
- height: 120, // 3:4 aspect ratio (90/120 = 0.75) - vertical
1038
- marginRight: 12,
1363
+ width: 46,
1364
+ height: 62,
1365
+ marginRight: 8,
1039
1366
  borderRadius: 8,
1040
1367
  overflow: 'hidden',
1041
1368
  position: 'relative',
1042
- backgroundColor: colors.black60
1369
+ backgroundColor: 'rgba(255,255,255,0.08)'
1043
1370
  },
1044
1371
  galleryModalImage: {
1045
1372
  width: '100%',
1046
1373
  height: '100%'
1047
1374
  },
1048
- galleryImageOverlay: {
1049
- position: 'absolute',
1050
- top: 0,
1051
- left: 0,
1052
- right: 0,
1053
- bottom: 0,
1054
- backgroundColor: colors.black18,
1055
- alignItems: 'flex-end',
1056
- justifyContent: 'flex-start',
1057
- padding: 8
1058
- },
1059
1375
  removeButton: {
1060
- width: 24,
1061
- height: 24,
1062
- borderRadius: 12,
1376
+ position: 'absolute',
1377
+ top: 3,
1378
+ left: 3,
1379
+ width: 18,
1380
+ height: 18,
1381
+ borderRadius: 9,
1063
1382
  backgroundColor: colors.white,
1064
1383
  alignItems: 'center',
1065
1384
  justifyContent: 'center',
1066
- opacity: 0.45
1385
+ opacity: 0.95
1067
1386
  },
1068
1387
  shutterFlashOverlay: {
1069
1388
  position: 'absolute',