@supportworks/multi-imagepicker 8.4.6 → 8.4.7
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 +1 -1
- package/src/components/AddImages.js +2 -1
- package/src/components/CameraModal.tsx +313 -159
- 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
|
@@ -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,14 @@ 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, {
|
|
39
|
+
import Svg, { Path } from 'react-native-svg'
|
|
38
40
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
39
41
|
import { check, openSettings, PERMISSIONS, request, RESULTS } from 'react-native-permissions'
|
|
40
42
|
|
|
@@ -85,18 +87,19 @@ interface CameraTestModalProps {
|
|
|
85
87
|
limit?: number
|
|
86
88
|
/** Shows a live tilt indicator nudging the user away from steep, floor-only close-ups. */
|
|
87
89
|
angleGuideEnabled?: boolean
|
|
90
|
+
/** Test harness only: replaces native camera access with disposable sample captures. */
|
|
91
|
+
testImageSource?: ImageSourcePropType
|
|
92
|
+
/** Offers a slider alongside the Sketch zoom presets. Off by default. */
|
|
93
|
+
enableZoomSlider?: boolean
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
// Event types are now imported from the camera module
|
|
91
97
|
|
|
92
98
|
const DEFAULT_ZOOM = 1
|
|
93
99
|
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
|
|
100
|
+
const SIDE_BUTTON_SIZE = 40
|
|
101
|
+
const SIDE_BUTTON_ICON_SIZE = 24
|
|
102
|
+
const SIDE_BUTTON_GAP = 8
|
|
100
103
|
const GALLERY_PREVIEW_SIZE = 48
|
|
101
104
|
const GALLERY_PREVIEW_MARGIN_BOTTOM = 40
|
|
102
105
|
const GALLERY_PREVIEW_BORDER_RADIUS = 8
|
|
@@ -112,6 +115,7 @@ const ZOOM_SLIDER_TRACK_LENGTH = 180
|
|
|
112
115
|
const ZOOM_SLIDER_WIDTH = 60
|
|
113
116
|
const ZOOM_SLIDER_THUMB_SIZE = 42
|
|
114
117
|
const ZOOM_SLIDER_THUMB_WIDTH = 52
|
|
118
|
+
const ZOOM_PRESETS = [0.5, 1, 3]
|
|
115
119
|
const ZOOM_STEP = 0.5
|
|
116
120
|
type CameraPermissionState = 'checking' | 'granted' | 'denied'
|
|
117
121
|
|
|
@@ -137,10 +141,12 @@ const snapZoomValue = (value: number, min: number, max: number) => {
|
|
|
137
141
|
return roundZoomValue(clamp(snapped, min, max))
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
const formatZoomLabel = (zoom: number): ZoomLevel => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
const formatZoomLabel = (zoom: number): ZoomLevel => `${Math.round(zoom * 100) / 100}x`
|
|
145
|
+
|
|
146
|
+
const pinchDistance = (event: GestureResponderEvent) => {
|
|
147
|
+
const touches = event.nativeEvent.touches
|
|
148
|
+
if (touches.length !== 2) return 0
|
|
149
|
+
return Math.hypot(touches[0].pageX - touches[1].pageX, touches[0].pageY - touches[1].pageY)
|
|
144
150
|
}
|
|
145
151
|
|
|
146
152
|
const isSameZoomLevel = (left: number, right: number) => {
|
|
@@ -199,38 +205,20 @@ const buildZoomRangeForPosition = (cameras: CameraInfo[], position: 'front' | 'b
|
|
|
199
205
|
return { min: minZoom, max: maxZoom }
|
|
200
206
|
}
|
|
201
207
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<
|
|
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" />
|
|
208
|
+
// Outlines from the camera icons in photos-upload_v2.1.sketch.
|
|
209
|
+
const FlipCameraIcon = ({ size = 24, color = colors.white }) => (
|
|
210
|
+
<Svg width={size} height={size} viewBox="0 0 24 24">
|
|
211
|
+
<Path fill={color} fillRule="evenodd" d="M20.0000 5.0000 L16.8300 5.0000 L15.0000 3.0000 L9.0000 3.0000 L7.1700 5.0000 L4.0000 5.0000 C2.9000 5.0000 2.0000 5.9000 2.0000 7.0000 L2.0000 19.0000 C2.0000 20.1000 2.9000 21.0000 4.0000 21.0000 L20.0000 21.0000 C21.1000 21.0000 22.0000 20.1000 22.0000 19.0000 L22.0000 7.0000 C22.0000 5.9000 21.1000 5.0000 20.0000 5.0000 Z M12.0000 18.0000 C9.2400 18.0000 7.0000 15.7600 7.0000 13.0000 L5.0000 13.0000 L7.5000 10.5000 L10.0000 13.0000 L8.0000 13.0000 C8.0000 15.2100 9.7900 17.0000 12.0000 17.0000 C12.5800 17.0000 13.1300 16.8700 13.6200 16.6500 L14.3600 17.3900 C13.6500 17.7600 12.8600 18.0000 12.0000 18.0000 Z M16.5000 15.5000 L14.0000 13.0000 L16.0000 13.0000 C16.0000 10.7900 14.2100 9.0000 12.0000 9.0000 C11.4200 9.0000 10.8700 9.1300 10.3800 9.3500 L9.6400 8.6200 C10.3500 8.2400 11.1400 8.0000 12.0000 8.0000 C14.7600 8.0000 17.0000 10.2400 17.0000 13.0000 L19.0000 13.0000 L16.5000 15.5000 Z" />
|
|
212
|
+
</Svg>
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
const FlashIcon = ({ enabled }: { enabled: boolean }) => (
|
|
216
|
+
<Svg width={24} height={24} viewBox="0 0 24 24">
|
|
217
|
+
<Path fill={colors.white} d={enabled ? 'M7 2v11h3v9l7-12h-4l4-8Z' : 'M17.0000 10.0000 L13.3900 10.0000 L15.6700 12.2800 L17.0000 10.0000 Z M17.0000 2.0000 L7.0000 2.0000 L7.0000 3.6100 L13.1300 9.7400 L17.0000 2.0000 Z M3.4100 2.8600 L2.0000 4.2700 L7.0000 9.2700 L7.0000 13.0000 L10.0000 13.0000 L10.0000 22.0000 L13.5800 15.8500 L17.7300 20.0000 L19.1400 18.5900 L3.4100 2.8600 Z'} />
|
|
230
218
|
</Svg>
|
|
231
219
|
)
|
|
232
220
|
|
|
233
|
-
const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraRef: externalCameraRef, limit, angleGuideEnabled }) => {
|
|
221
|
+
const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraRef: externalCameraRef, limit, angleGuideEnabled, testImageSource, enableZoomSlider = false }) => {
|
|
234
222
|
const internalCameraRef = useRef<CameraViewRef>(null)
|
|
235
223
|
const cameraRef = externalCameraRef || internalCameraRef
|
|
236
224
|
const insets = useSafeAreaInsets()
|
|
@@ -246,17 +234,13 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
246
234
|
: 1
|
|
247
235
|
const scaleMetric = (value: number, min = 0) => Math.max(min, Math.round(value * controlScale))
|
|
248
236
|
const focusRingSize = scaleMetric(FOCUS_RING_SIZE, 52)
|
|
249
|
-
const cancelButtonMinWidth =
|
|
250
|
-
const cancelButtonHeight =
|
|
237
|
+
const cancelButtonMinWidth = 84
|
|
238
|
+
const cancelButtonHeight = 40
|
|
251
239
|
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)
|
|
240
|
+
const cancelButtonFontSize = 14
|
|
241
|
+
const sideButtonSize = SIDE_BUTTON_SIZE
|
|
242
|
+
const sideButtonGap = SIDE_BUTTON_GAP
|
|
243
|
+
const sideButtonIconSize = SIDE_BUTTON_ICON_SIZE
|
|
260
244
|
const galleryPreviewSize = GALLERY_PREVIEW_SIZE
|
|
261
245
|
const galleryPreviewMarginBottom = isPhoneSized ? 0 : GALLERY_PREVIEW_MARGIN_BOTTOM
|
|
262
246
|
const galleryPreviewBorderRadius = GALLERY_PREVIEW_BORDER_RADIUS
|
|
@@ -270,14 +254,20 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
270
254
|
const doneButtonIconSize = DONE_BUTTON_ICON_SIZE
|
|
271
255
|
const doneButtonMarginBottom = 0
|
|
272
256
|
const rightOverlayWidth = RIGHT_OVERLAY_WIDTH
|
|
273
|
-
const topOverlayHorizontalInset =
|
|
274
|
-
const overlaySideInset = isTightLayout ? 8 : isPhoneSized ? 10 : 16
|
|
257
|
+
const topOverlayHorizontalInset = 16
|
|
275
258
|
const showFlashControl = !isTightLayout
|
|
276
259
|
const showCameraSwitchControl = !isTightLayout
|
|
277
260
|
const showSecondaryControls = showFlashControl || showCameraSwitchControl
|
|
278
261
|
|
|
279
|
-
const
|
|
262
|
+
const closeGalleryRef = useRef<((type?: string) => void) | null>(null)
|
|
280
263
|
const shutterFlashAnim = useRef(new Animated.Value(0)).current
|
|
264
|
+
const knobTop = useRef(new Animated.Value(0)).current
|
|
265
|
+
const isSliderDragging = useRef(false)
|
|
266
|
+
const zoomRailRef = useRef<View>(null)
|
|
267
|
+
const zoomRailTopRef = useRef<number | null>(null)
|
|
268
|
+
const [isZoomSliderVisible, setIsZoomSliderVisible] = useState(false)
|
|
269
|
+
const pinchStart = useRef<{ distance: number; zoom: number } | null>(null)
|
|
270
|
+
const suppressFocusAfterPinch = useRef(false)
|
|
281
271
|
const [currentZoom, setCurrentZoom] = useState<number>(DEFAULT_ZOOM)
|
|
282
272
|
const [isDepthEnabled, setIsDepthEnabled] = useState<boolean>(true)
|
|
283
273
|
const [isFlashEnabled, setIsFlashEnabled] = useState<boolean>(false)
|
|
@@ -293,16 +283,30 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
293
283
|
const [isGalleryModalVisible, setIsGalleryModalVisible] = useState<boolean>(false)
|
|
294
284
|
const [isDoneButtonDisabled, setIsDoneButtonDisabled] = useState<boolean>(false)
|
|
295
285
|
const [focusPoint, setFocusPoint] = useState<{ x: number; y: number } | null>(null)
|
|
296
|
-
const [cameraPermissionState, setCameraPermissionState] = useState<CameraPermissionState>('checking')
|
|
286
|
+
const [cameraPermissionState, setCameraPermissionState] = useState<CameraPermissionState>(testImageSource ? 'granted' : 'checking')
|
|
297
287
|
const [isCapturePending, setIsCapturePending] = useState<boolean>(false)
|
|
298
288
|
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
289
|
const capturePendingRef = useRef(false)
|
|
304
|
-
const
|
|
305
|
-
const
|
|
290
|
+
const testCapturePaths = useRef<string[]>([])
|
|
291
|
+
const isMounted = useRef(true)
|
|
292
|
+
const currentZoomRange = testImageSource
|
|
293
|
+
? { min: isFrontCamera ? 1 : 0.5, max: isFrontCamera ? 1 : 5 }
|
|
294
|
+
: isFrontCamera ? zoomRangeByPosition.front : zoomRangeByPosition.back
|
|
295
|
+
|
|
296
|
+
React.useEffect(() => {
|
|
297
|
+
isMounted.current = true
|
|
298
|
+
return () => {
|
|
299
|
+
isMounted.current = false
|
|
300
|
+
testCapturePaths.current.forEach(path => Api.getApi().RNFS.unlink(path).catch(() => {}))
|
|
301
|
+
testCapturePaths.current = []
|
|
302
|
+
}
|
|
303
|
+
}, [])
|
|
304
|
+
const availableZoomPresets = ZOOM_PRESETS.filter(zoom => zoom >= currentZoomRange.min && zoom <= currentZoomRange.max)
|
|
305
|
+
const displayZoom = roundZoomValue(currentZoom)
|
|
306
|
+
// Keep the lower preset selected at an exact midpoint between two presets.
|
|
307
|
+
const selectedZoomPreset = availableZoomPresets.reduce((nearest, zoom) =>
|
|
308
|
+
Math.abs(zoom - currentZoom) < Math.abs(nearest - currentZoom) ? zoom : nearest,
|
|
309
|
+
availableZoomPresets[0])
|
|
306
310
|
const captureLimit = typeof limit === 'number' && limit > 0 ? limit : null
|
|
307
311
|
const hasReachedCaptureLimit = captureLimit !== null && capturedImages.length >= captureLimit
|
|
308
312
|
const isShutterDisabled = isCapturePending || hasReachedCaptureLimit
|
|
@@ -326,6 +330,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
326
330
|
}, [])
|
|
327
331
|
|
|
328
332
|
React.useEffect(() => {
|
|
333
|
+
if (testImageSource) return
|
|
329
334
|
let isCancelled = false
|
|
330
335
|
|
|
331
336
|
const ensureCameraPermission = async () => {
|
|
@@ -463,6 +468,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
463
468
|
|
|
464
469
|
const handleCameraPress = React.useCallback(
|
|
465
470
|
(event: { nativeEvent: { locationX: number; locationY: number } }) => {
|
|
471
|
+
if (suppressFocusAfterPinch.current) return
|
|
466
472
|
const { locationX, locationY } = event.nativeEvent
|
|
467
473
|
triggerFocusRing(locationX, locationY)
|
|
468
474
|
if (cameraRef.current) {
|
|
@@ -488,7 +494,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
488
494
|
})
|
|
489
495
|
}
|
|
490
496
|
|
|
491
|
-
const
|
|
497
|
+
const handleCapturePhoto = async () => {
|
|
492
498
|
if (capturePendingRef.current) {
|
|
493
499
|
return
|
|
494
500
|
}
|
|
@@ -501,6 +507,27 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
501
507
|
console.log('CAMERA: Attempting to capture photo')
|
|
502
508
|
updateCapturePending(true)
|
|
503
509
|
triggerShutterFlash() // Trigger the flash effect
|
|
510
|
+
if (testImageSource) {
|
|
511
|
+
try {
|
|
512
|
+
const source = Image.resolveAssetSource(testImageSource)
|
|
513
|
+
const image = await ImageResizer.createResizedImage(source.uri, source.width, source.height, 'JPEG', 90)
|
|
514
|
+
if (!isMounted.current) {
|
|
515
|
+
await Api.getApi().RNFS.unlink(image.path).catch(() => {})
|
|
516
|
+
return
|
|
517
|
+
}
|
|
518
|
+
testCapturePaths.current.push(image.path)
|
|
519
|
+
handlePhotoCaptured({ nativeEvent: {
|
|
520
|
+
imageUri: image.uri,
|
|
521
|
+
depthMapUri: '',
|
|
522
|
+
imageSize: { width: image.width, height: image.height }
|
|
523
|
+
} })
|
|
524
|
+
} catch (error) {
|
|
525
|
+
if (isMounted.current) Alert.alert('Sample photo unavailable', 'Unable to create a test photo. Close and reopen the camera tester.')
|
|
526
|
+
} finally {
|
|
527
|
+
if (isMounted.current) updateCapturePending(false)
|
|
528
|
+
}
|
|
529
|
+
return
|
|
530
|
+
}
|
|
504
531
|
if (cameraRef.current) {
|
|
505
532
|
try {
|
|
506
533
|
cameraRef.current.capturePhoto()
|
|
@@ -514,7 +541,12 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
514
541
|
}
|
|
515
542
|
}
|
|
516
543
|
|
|
517
|
-
const
|
|
544
|
+
const handleToggleCamera = () => {
|
|
545
|
+
if (testImageSource) {
|
|
546
|
+
setIsFrontCamera(prev => !prev)
|
|
547
|
+
setIsFlashEnabled(false)
|
|
548
|
+
return
|
|
549
|
+
}
|
|
518
550
|
console.log('CAMERA: Attempting to switch camera')
|
|
519
551
|
if (cameraRef.current) {
|
|
520
552
|
cameraRef.current.switchCamera()
|
|
@@ -538,10 +570,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
538
570
|
}
|
|
539
571
|
}, [isFrontCamera, isDepthEnabled, isFlashEnabled])
|
|
540
572
|
|
|
541
|
-
const
|
|
573
|
+
const handleToggleFlash = () => {
|
|
542
574
|
if (isFrontCamera) {
|
|
543
575
|
return
|
|
544
576
|
}
|
|
577
|
+
if (testImageSource) {
|
|
578
|
+
setIsFlashEnabled(prev => !prev)
|
|
579
|
+
return
|
|
580
|
+
}
|
|
545
581
|
console.log('CAMERA: Attempting to toggle flash')
|
|
546
582
|
if (cameraRef.current) {
|
|
547
583
|
cameraRef.current.toggleFlash()
|
|
@@ -551,6 +587,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
551
587
|
}
|
|
552
588
|
}
|
|
553
589
|
|
|
590
|
+
const handleToggleZoomSlider = () => setIsZoomSliderVisible(visible => !visible)
|
|
591
|
+
|
|
554
592
|
const handleZoomChange = React.useCallback((newZoom: number) => {
|
|
555
593
|
setCurrentZoom((prevZoom) => {
|
|
556
594
|
const nextZoom = snapZoomValue(newZoom, currentZoomRange.min, currentZoomRange.max)
|
|
@@ -559,17 +597,44 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
559
597
|
}, [currentZoomRange.max, currentZoomRange.min])
|
|
560
598
|
|
|
561
599
|
React.useEffect(() => {
|
|
562
|
-
const clampedZoom =
|
|
600
|
+
const clampedZoom = clamp(currentZoom, currentZoomRange.min, currentZoomRange.max)
|
|
563
601
|
if (!isSameZoomLevel(clampedZoom, currentZoom)) {
|
|
564
602
|
setCurrentZoom(clampedZoom)
|
|
565
603
|
}
|
|
566
604
|
}, [currentZoom, currentZoomRange.max, currentZoomRange.min])
|
|
567
605
|
|
|
568
606
|
React.useEffect(() => {
|
|
569
|
-
|
|
570
|
-
|
|
607
|
+
pinchStart.current = null
|
|
608
|
+
}, [isFrontCamera, currentZoomRange.min, currentZoomRange.max])
|
|
609
|
+
|
|
610
|
+
const handleShouldCapturePinch = (event: GestureResponderEvent) => {
|
|
611
|
+
if (event.nativeEvent.touches.length === 1 && !pinchStart.current) {
|
|
612
|
+
suppressFocusAfterPinch.current = false
|
|
613
|
+
}
|
|
614
|
+
return !capturePendingRef.current && currentZoomRange.max > currentZoomRange.min && pinchDistance(event) > 0
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
const handlePinchStart = (event: GestureResponderEvent) => {
|
|
618
|
+
const distance = pinchDistance(event)
|
|
619
|
+
pinchStart.current = distance > 0 ? { distance, zoom: currentZoom } : null
|
|
620
|
+
suppressFocusAfterPinch.current = true
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
const handlePinchMove = (event: GestureResponderEvent) => {
|
|
624
|
+
const distance = pinchDistance(event)
|
|
625
|
+
if (!distance || capturePendingRef.current) {
|
|
626
|
+
pinchStart.current = null
|
|
627
|
+
return
|
|
628
|
+
}
|
|
629
|
+
if (!pinchStart.current) {
|
|
630
|
+
handlePinchStart(event)
|
|
631
|
+
return
|
|
571
632
|
}
|
|
572
|
-
|
|
633
|
+
const zoom = pinchStart.current.zoom * distance / pinchStart.current.distance
|
|
634
|
+
setCurrentZoom(Math.round(clamp(zoom, currentZoomRange.min, currentZoomRange.max) * 100) / 100)
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
const handlePinchEnd = () => { pinchStart.current = null }
|
|
573
638
|
|
|
574
639
|
React.useEffect(() => {
|
|
575
640
|
const targetTop = getTopPositionForZoom(currentZoom, currentZoomRange.min, currentZoomRange.max)
|
|
@@ -578,12 +643,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
578
643
|
return
|
|
579
644
|
}
|
|
580
645
|
|
|
581
|
-
Animated.spring(knobTop, {
|
|
646
|
+
const animation = Animated.spring(knobTop, {
|
|
582
647
|
toValue: targetTop,
|
|
583
648
|
useNativeDriver: false,
|
|
584
649
|
tension: 180,
|
|
585
650
|
friction: 20
|
|
586
|
-
})
|
|
651
|
+
})
|
|
652
|
+
animation.start()
|
|
653
|
+
return () => animation.stop()
|
|
587
654
|
}, [currentZoom, currentZoomRange.max, currentZoomRange.min, knobTop])
|
|
588
655
|
|
|
589
656
|
const measureZoomRail = React.useCallback(() => {
|
|
@@ -614,8 +681,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
614
681
|
const sliderPanResponder = React.useMemo(
|
|
615
682
|
() =>
|
|
616
683
|
PanResponder.create({
|
|
617
|
-
onStartShouldSetPanResponder: () =>
|
|
618
|
-
onMoveShouldSetPanResponder: () =>
|
|
684
|
+
onStartShouldSetPanResponder: () => (currentZoomRange.max > currentZoomRange.min),
|
|
685
|
+
onMoveShouldSetPanResponder: () => (currentZoomRange.max > currentZoomRange.min),
|
|
619
686
|
onPanResponderGrant: (event, gestureState) => {
|
|
620
687
|
isSliderDragging.current = true
|
|
621
688
|
measureZoomRail()
|
|
@@ -641,9 +708,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
641
708
|
isSliderDragging.current = false
|
|
642
709
|
}
|
|
643
710
|
}),
|
|
644
|
-
[getSliderTopFromGesture,
|
|
711
|
+
[getSliderTopFromGesture, (currentZoomRange.max > currentZoomRange.min), measureZoomRail, updateZoomFromSliderPosition]
|
|
645
712
|
)
|
|
646
713
|
|
|
714
|
+
const handleGalleryCloseReady = React.useCallback((closeModal: ((type?: string) => void) | null) => {
|
|
715
|
+
closeGalleryRef.current = closeModal
|
|
716
|
+
}, [])
|
|
717
|
+
const handleCloseGallery = () => closeGalleryRef.current?.('cancel')
|
|
718
|
+
|
|
647
719
|
const openGalleryModal = () => {
|
|
648
720
|
console.log('OPENING GALLERY MODAL', capturedImages.length)
|
|
649
721
|
if (limit !== 1 && capturedImages.length > 0) {
|
|
@@ -662,18 +734,23 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
662
734
|
const hasCapturedImages = capturedImages.length > 0
|
|
663
735
|
const shouldShowGalleryPreview = limit !== 1
|
|
664
736
|
const shouldShowDoneButton = limit !== 1
|
|
665
|
-
const
|
|
666
|
-
const
|
|
737
|
+
const shouldShowZoomControls = currentZoomRange.max > currentZoomRange.min && !isTightLayout
|
|
738
|
+
const showZoomSlider = enableZoomSlider && isZoomSliderVisible && shouldShowZoomControls
|
|
739
|
+
const zoomControlsLength = availableZoomPresets.length * 40 + 16
|
|
667
740
|
const gallerySubtitle = `${capturedImages.length} ${capturedImages.length === 1 ? 'image' : 'images'}`
|
|
668
|
-
|
|
741
|
+
// Sketch 16:9: shutter ends 16pt above the photo edge (20pt on SE).
|
|
742
|
+
const phoneControlsBottom = isLandscape ? insets.bottom + 8 : insets.bottom > 0 ? 16 : 20
|
|
669
743
|
const primaryControlsTop = Math.max(insets.top + 96, windowHeight / 2 - shutterButtonSize / 2)
|
|
670
|
-
|
|
671
|
-
const secondaryControlsTop = isPhoneSized
|
|
672
|
-
|
|
673
|
-
|
|
744
|
+
// SVT artboard: shutter center y=540, flash y=256, switch y=304.
|
|
745
|
+
const secondaryControlsTop = isPhoneSized ? insets.top + 8 : primaryControlsTop - 248
|
|
746
|
+
const zoomControlsTop = isPhoneSized
|
|
747
|
+
? windowHeight - phoneControlsBottom - shutterButtonSize - 63
|
|
748
|
+
: windowHeight / 2 - zoomControlsLength / 2
|
|
749
|
+
|
|
674
750
|
const zoomSliderHeight = ZOOM_SLIDER_TRACK_LENGTH + ZOOM_SLIDER_THUMB_SIZE
|
|
675
751
|
const zoomSliderTop = Math.max(insets.top + (isPhoneSized ? 88 : 104), Math.round(windowHeight * 0.5 - zoomSliderHeight / 2))
|
|
676
752
|
|
|
753
|
+
|
|
677
754
|
const handleCancelPress = () => {
|
|
678
755
|
if (capturePendingRef.current) {
|
|
679
756
|
return
|
|
@@ -766,25 +843,37 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
766
843
|
isCancelDisabled && styles.cancelButtonDisabled
|
|
767
844
|
]}
|
|
768
845
|
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
|
846
|
+
accessibilityLabel="Cancel"
|
|
769
847
|
onPress={handleCancelPress}
|
|
770
848
|
disabled={isCancelDisabled}
|
|
771
849
|
>
|
|
772
850
|
<Text style={[styles.cancelButtonText, { fontSize: cancelButtonFontSize }]}>Cancel</Text>
|
|
773
851
|
</TouchableOpacity>
|
|
774
852
|
|
|
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
|
-
)}
|
|
853
|
+
|
|
782
854
|
</View>
|
|
783
855
|
|
|
784
856
|
{/* Camera View */}
|
|
785
|
-
<View
|
|
857
|
+
<View
|
|
858
|
+
style={styles.cameraContainer}
|
|
859
|
+
testID="camera-pinch-surface"
|
|
860
|
+
onStartShouldSetResponderCapture={handleShouldCapturePinch}
|
|
861
|
+
onMoveShouldSetResponderCapture={handleShouldCapturePinch}
|
|
862
|
+
onResponderGrant={handlePinchStart}
|
|
863
|
+
onResponderMove={handlePinchMove}
|
|
864
|
+
onResponderRelease={handlePinchEnd}
|
|
865
|
+
onResponderTerminate={handlePinchEnd}
|
|
866
|
+
>
|
|
786
867
|
<Pressable style={styles.cameraTouchLayer} onPress={handleCameraPress}>
|
|
787
|
-
|
|
868
|
+
{testImageSource ? (
|
|
869
|
+
<View style={[styles.camera, { overflow: 'hidden' }]}>
|
|
870
|
+
<Image
|
|
871
|
+
source={testImageSource}
|
|
872
|
+
resizeMode="cover"
|
|
873
|
+
style={[StyleSheet.absoluteFillObject, { width: '100%', height: '100%', transform: [{ scale: currentZoom / 0.5 }, { scaleX: isFrontCamera ? -1 : 1 }] }]}
|
|
874
|
+
/>
|
|
875
|
+
</View>
|
|
876
|
+
) : <CameraView
|
|
788
877
|
ref={cameraRef}
|
|
789
878
|
isDepthEnabled={isDepthEnabled}
|
|
790
879
|
zoomLevel={formatZoomLabel(currentZoom)}
|
|
@@ -794,7 +883,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
794
883
|
onCaptureStateChange={handleCaptureStateChange}
|
|
795
884
|
onError={handleCameraError}
|
|
796
885
|
style={styles.camera}
|
|
797
|
-
/>
|
|
886
|
+
/>}
|
|
798
887
|
{focusPoint ? (
|
|
799
888
|
<Animated.View
|
|
800
889
|
style={[
|
|
@@ -827,29 +916,33 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
827
916
|
|
|
828
917
|
<View
|
|
829
918
|
pointerEvents="box-none"
|
|
830
|
-
style={[styles.rightOverlay, { width:
|
|
919
|
+
style={[styles.rightOverlay, { width: isPhoneSized ? 88 : 40, right: (isPhoneSized ? 16 : 32) + insets.right, top: secondaryControlsTop }]}
|
|
831
920
|
>
|
|
832
921
|
{showSecondaryControls && (
|
|
833
|
-
<View style={[styles.sideActionGroup, {
|
|
922
|
+
<View style={[styles.sideActionGroup, { flexDirection: isPhoneSized ? 'row' : 'column' }]}>
|
|
834
923
|
{showFlashControl && (
|
|
835
924
|
<TouchableOpacity
|
|
836
925
|
style={[
|
|
837
926
|
styles.sideButton,
|
|
838
927
|
{ width: sideButtonSize, height: sideButtonSize, borderRadius: sideButtonSize / 2 },
|
|
839
|
-
showCameraSwitchControl && { marginBottom: sideButtonGap },
|
|
928
|
+
showCameraSwitchControl && (isPhoneSized ? { marginRight: sideButtonGap } : { marginBottom: sideButtonGap }),
|
|
840
929
|
isFlashEnabled && styles.sideButtonActive,
|
|
841
930
|
isFrontCamera && styles.sideButtonDisabled
|
|
842
931
|
]}
|
|
843
|
-
|
|
932
|
+
accessibilityRole="button"
|
|
933
|
+
accessibilityLabel="Toggle flash"
|
|
934
|
+
onPress={handleToggleFlash}
|
|
844
935
|
disabled={isFrontCamera}
|
|
845
936
|
>
|
|
846
|
-
<
|
|
937
|
+
<FlashIcon enabled={isFlashEnabled} />
|
|
847
938
|
</TouchableOpacity>
|
|
848
939
|
)}
|
|
849
940
|
{showCameraSwitchControl && (
|
|
850
941
|
<TouchableOpacity
|
|
851
942
|
style={[styles.sideButton, { width: sideButtonSize, height: sideButtonSize, borderRadius: sideButtonSize / 2 }]}
|
|
852
|
-
|
|
943
|
+
accessibilityRole="button"
|
|
944
|
+
accessibilityLabel="Switch camera"
|
|
945
|
+
onPress={handleToggleCamera}
|
|
853
946
|
>
|
|
854
947
|
<FlipCameraIcon size={sideButtonIconSize} color={colors.white} />
|
|
855
948
|
</TouchableOpacity>
|
|
@@ -880,6 +973,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
880
973
|
},
|
|
881
974
|
!hasCapturedImages && styles.galleryPreviewButtonEmpty
|
|
882
975
|
]}
|
|
976
|
+
accessibilityLabel="Open Session Roll"
|
|
883
977
|
onPress={openGalleryModal}
|
|
884
978
|
activeOpacity={0.9}
|
|
885
979
|
>
|
|
@@ -915,13 +1009,14 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
915
1009
|
isPhoneSized && { position: 'absolute', left: '50%', marginLeft: -shutterButtonSize / 2 },
|
|
916
1010
|
isShutterDisabled && styles.shutterButtonDisabled
|
|
917
1011
|
]}
|
|
918
|
-
|
|
1012
|
+
accessibilityLabel="Take photo"
|
|
1013
|
+
onPress={handleCapturePhoto}
|
|
919
1014
|
disabled={isShutterDisabled}
|
|
920
1015
|
>
|
|
921
1016
|
<View
|
|
922
1017
|
style={[
|
|
923
1018
|
styles.shutterButtonOuter,
|
|
924
|
-
{ width: shutterButtonSize, height: shutterButtonSize, borderRadius: shutterButtonSize / 2, borderWidth:
|
|
1019
|
+
{ width: shutterButtonSize, height: shutterButtonSize, borderRadius: shutterButtonSize / 2, borderWidth: 4 },
|
|
925
1020
|
isShutterDisabled && styles.shutterButtonOuterDisabled
|
|
926
1021
|
]}
|
|
927
1022
|
/>
|
|
@@ -939,9 +1034,10 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
939
1034
|
style={[
|
|
940
1035
|
styles.doneButton,
|
|
941
1036
|
{ width: 95, height: doneButtonHeight, paddingHorizontal: doneButtonHorizontalPadding, borderRadius: doneButtonHeight / 2, marginBottom: doneButtonMarginBottom },
|
|
942
|
-
isPhoneSized && { position: 'absolute', right: 0 },
|
|
1037
|
+
isPhoneSized && { position: 'absolute', right: 0, top: !isLandscape && insets.bottom > 0 ? 17 : 16 },
|
|
943
1038
|
isDoneDisabled && styles.doneButtonDisabled
|
|
944
1039
|
]}
|
|
1040
|
+
accessibilityLabel="Done"
|
|
945
1041
|
onPress={handleDonePress}
|
|
946
1042
|
disabled={isDoneDisabled}
|
|
947
1043
|
>
|
|
@@ -961,22 +1057,75 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
961
1057
|
</View>
|
|
962
1058
|
) : null}
|
|
963
1059
|
|
|
964
|
-
{
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
<View
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1060
|
+
{shouldShowZoomControls ? (
|
|
1061
|
+
<>
|
|
1062
|
+
{showZoomSlider ? (
|
|
1063
|
+
<View style={[styles.zoomSliderContainer, { left: 12 + insets.left, top: zoomSliderTop }]}>
|
|
1064
|
+
<View style={styles.zoomSlider}>
|
|
1065
|
+
<View
|
|
1066
|
+
ref={zoomRailRef}
|
|
1067
|
+
testID="camera-zoom-slider"
|
|
1068
|
+
style={styles.zoomRailContainer}
|
|
1069
|
+
onLayout={measureZoomRail}
|
|
1070
|
+
{...sliderPanResponder.panHandlers}
|
|
1071
|
+
>
|
|
1072
|
+
<View style={styles.zoomRail} />
|
|
1073
|
+
<Animated.View style={[styles.zoomThumb, { top: knobTop }]}>
|
|
1074
|
+
<Text style={styles.zoomThumbText}>{formatZoomLabel(currentZoom)}</Text>
|
|
1075
|
+
</Animated.View>
|
|
1076
|
+
</View>
|
|
1077
|
+
</View>
|
|
977
1078
|
</View>
|
|
1079
|
+
) : (
|
|
1080
|
+
<View
|
|
1081
|
+
style={[
|
|
1082
|
+
styles.zoomContainer,
|
|
1083
|
+
isPhoneSized
|
|
1084
|
+
? { width: zoomControlsLength, height: 48, left: (windowWidth - zoomControlsLength) / 2, top: zoomControlsTop, flexDirection: 'row' }
|
|
1085
|
+
: { width: 48, height: zoomControlsLength, left: 16 + insets.left, top: zoomControlsTop }
|
|
1086
|
+
]}
|
|
1087
|
+
>
|
|
1088
|
+
{availableZoomPresets.map(zoom => {
|
|
1089
|
+
const selected = zoom === selectedZoomPreset
|
|
1090
|
+
const handlePress = () => handleZoomChange(zoom)
|
|
1091
|
+
return (
|
|
1092
|
+
<TouchableOpacity
|
|
1093
|
+
key={zoom}
|
|
1094
|
+
accessibilityRole="button"
|
|
1095
|
+
accessibilityLabel={`${zoom} times zoom`}
|
|
1096
|
+
accessibilityState={{ selected }}
|
|
1097
|
+
accessibilityValue={selected ? { text: `${displayZoom} times zoom` } : undefined}
|
|
1098
|
+
onPress={handlePress}
|
|
1099
|
+
style={[styles.zoomButton, selected && styles.zoomButtonSelected]}
|
|
1100
|
+
>
|
|
1101
|
+
<Text numberOfLines={1} adjustsFontSizeToFit style={[styles.zoomText, selected && styles.zoomTextSelected]}>
|
|
1102
|
+
{selected ? `${displayZoom === 0.5 ? '.5' : displayZoom}×` : zoom === 0.5 ? '.5' : zoom}
|
|
1103
|
+
</Text>
|
|
1104
|
+
</TouchableOpacity>
|
|
1105
|
+
)
|
|
1106
|
+
})}
|
|
978
1107
|
</View>
|
|
979
|
-
|
|
1108
|
+
)}
|
|
1109
|
+
{enableZoomSlider && (
|
|
1110
|
+
<TouchableOpacity
|
|
1111
|
+
accessibilityRole="button"
|
|
1112
|
+
accessibilityLabel={showZoomSlider ? 'Show zoom presets' : 'Show zoom slider'}
|
|
1113
|
+
accessibilityState={{ expanded: showZoomSlider }}
|
|
1114
|
+
onPress={handleToggleZoomSlider}
|
|
1115
|
+
style={[
|
|
1116
|
+
styles.sideButton,
|
|
1117
|
+
{ position: 'absolute', zIndex: 12 },
|
|
1118
|
+
showZoomSlider
|
|
1119
|
+
? { left: 22 + insets.left, top: zoomSliderTop + zoomSliderHeight + 8 }
|
|
1120
|
+
: isPhoneSized
|
|
1121
|
+
? { left: (windowWidth + zoomControlsLength) / 2 + 8, top: zoomControlsTop + 4 }
|
|
1122
|
+
: { left: 20 + insets.left, top: zoomControlsTop + zoomControlsLength + 8 }
|
|
1123
|
+
]}
|
|
1124
|
+
>
|
|
1125
|
+
<Icons.IconAdjust size={24} fill={colors.white} fillOpacity={1} />
|
|
1126
|
+
</TouchableOpacity>
|
|
1127
|
+
)}
|
|
1128
|
+
</>
|
|
980
1129
|
) : null}
|
|
981
1130
|
|
|
982
1131
|
{/* Shutter Flash Overlay */}
|
|
@@ -985,7 +1134,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
985
1134
|
{/* Gallery SwipeModal */}
|
|
986
1135
|
<SwipeModal
|
|
987
1136
|
key={`gallery-${isGalleryModalVisible}`}
|
|
988
|
-
|
|
1137
|
+
implicit={handleGalleryCloseReady}
|
|
989
1138
|
visible={isGalleryModalVisible}
|
|
990
1139
|
onClose={() => setIsGalleryModalVisible(false)}
|
|
991
1140
|
scrollOffset={1}
|
|
@@ -998,7 +1147,9 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
998
1147
|
<View style={styles.gallerySheetHeader}>
|
|
999
1148
|
<TouchableOpacity
|
|
1000
1149
|
style={styles.gallerySheetClose}
|
|
1001
|
-
onPress={
|
|
1150
|
+
onPress={handleCloseGallery}
|
|
1151
|
+
accessibilityRole="button"
|
|
1152
|
+
accessibilityLabel="Close Session Roll"
|
|
1002
1153
|
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
|
1003
1154
|
>
|
|
1004
1155
|
<Icons.IconClose_WithPad size={18} fill={colors.white} fillOpacity={1} />
|
|
@@ -1103,16 +1254,12 @@ const styles = StyleSheet.create({
|
|
|
1103
1254
|
justifyContent: 'space-between',
|
|
1104
1255
|
zIndex: 10
|
|
1105
1256
|
},
|
|
1106
|
-
topOverlaySpacer: {
|
|
1107
|
-
width: 30,
|
|
1108
|
-
height: 30
|
|
1109
|
-
},
|
|
1110
1257
|
cancelButton: {
|
|
1111
1258
|
minWidth: 56,
|
|
1112
1259
|
height: 34,
|
|
1113
1260
|
paddingHorizontal: 14,
|
|
1114
1261
|
borderRadius: 17,
|
|
1115
|
-
backgroundColor:
|
|
1262
|
+
backgroundColor: colors.black18,
|
|
1116
1263
|
alignItems: 'center',
|
|
1117
1264
|
justifyContent: 'center'
|
|
1118
1265
|
},
|
|
@@ -1120,30 +1267,8 @@ const styles = StyleSheet.create({
|
|
|
1120
1267
|
opacity: 0.45
|
|
1121
1268
|
},
|
|
1122
1269
|
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'
|
|
1270
|
+
...stdStyles.S3,
|
|
1271
|
+
color: colors.white
|
|
1147
1272
|
},
|
|
1148
1273
|
cameraContainer: {
|
|
1149
1274
|
position: 'absolute',
|
|
@@ -1204,22 +1329,18 @@ const styles = StyleSheet.create({
|
|
|
1204
1329
|
},
|
|
1205
1330
|
sideActionGroup: {
|
|
1206
1331
|
width: '100%',
|
|
1207
|
-
alignItems: 'center'
|
|
1208
|
-
marginBottom: SIDE_ACTION_GROUP_MARGIN_BOTTOM
|
|
1209
|
-
},
|
|
1210
|
-
sideButtonSpacing: {
|
|
1211
|
-
marginBottom: SIDE_BUTTON_GAP
|
|
1332
|
+
alignItems: 'center'
|
|
1212
1333
|
},
|
|
1213
1334
|
sideButton: {
|
|
1214
1335
|
width: SIDE_BUTTON_SIZE,
|
|
1215
1336
|
height: SIDE_BUTTON_SIZE,
|
|
1216
1337
|
borderRadius: SIDE_BUTTON_SIZE / 2,
|
|
1217
|
-
backgroundColor:
|
|
1338
|
+
backgroundColor: colors.black18,
|
|
1218
1339
|
alignItems: 'center',
|
|
1219
1340
|
justifyContent: 'center'
|
|
1220
1341
|
},
|
|
1221
1342
|
sideButtonActive: {
|
|
1222
|
-
backgroundColor:
|
|
1343
|
+
backgroundColor: colors.blue
|
|
1223
1344
|
},
|
|
1224
1345
|
sideButtonDisabled: {
|
|
1225
1346
|
opacity: 0.42
|
|
@@ -1229,7 +1350,7 @@ const styles = StyleSheet.create({
|
|
|
1229
1350
|
height: GALLERY_PREVIEW_SIZE,
|
|
1230
1351
|
borderRadius: GALLERY_PREVIEW_BORDER_RADIUS,
|
|
1231
1352
|
backgroundColor: 'rgba(255,255,255,0.12)',
|
|
1232
|
-
borderWidth:
|
|
1353
|
+
borderWidth: 2,
|
|
1233
1354
|
borderColor: colors.white,
|
|
1234
1355
|
overflow: 'visible',
|
|
1235
1356
|
alignItems: 'center',
|
|
@@ -1264,9 +1385,9 @@ const styles = StyleSheet.create({
|
|
|
1264
1385
|
justifyContent: 'center'
|
|
1265
1386
|
},
|
|
1266
1387
|
galleryPreviewBadgeText: {
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1388
|
+
...stdStyles.Caption2,
|
|
1389
|
+
letterSpacing: 0.39,
|
|
1390
|
+
color: colors.white
|
|
1270
1391
|
},
|
|
1271
1392
|
zoomSliderContainer: {
|
|
1272
1393
|
position: 'absolute',
|
|
@@ -1307,6 +1428,40 @@ const styles = StyleSheet.create({
|
|
|
1307
1428
|
fontSize: 12,
|
|
1308
1429
|
fontWeight: 'bold'
|
|
1309
1430
|
},
|
|
1431
|
+
zoomContainer: {
|
|
1432
|
+
position: 'absolute',
|
|
1433
|
+
borderRadius: 24,
|
|
1434
|
+
backgroundColor: colors.black18,
|
|
1435
|
+
alignItems: 'center',
|
|
1436
|
+
justifyContent: 'center',
|
|
1437
|
+
gap: 8,
|
|
1438
|
+
padding: 4,
|
|
1439
|
+
zIndex: 12
|
|
1440
|
+
},
|
|
1441
|
+
zoomButton: {
|
|
1442
|
+
width: 32,
|
|
1443
|
+
height: 32,
|
|
1444
|
+
borderRadius: 16,
|
|
1445
|
+
backgroundColor: colors.black62,
|
|
1446
|
+
alignItems: 'center',
|
|
1447
|
+
justifyContent: 'center'
|
|
1448
|
+
},
|
|
1449
|
+
zoomButtonSelected: {
|
|
1450
|
+
paddingHorizontal: 4,
|
|
1451
|
+
width: 40,
|
|
1452
|
+
height: 40,
|
|
1453
|
+
borderRadius: 20,
|
|
1454
|
+
backgroundColor: colors.blue
|
|
1455
|
+
},
|
|
1456
|
+
zoomText: {
|
|
1457
|
+
...stdStyles.Caption2,
|
|
1458
|
+
letterSpacing: 0.39,
|
|
1459
|
+
color: colors.white
|
|
1460
|
+
},
|
|
1461
|
+
zoomTextSelected: {
|
|
1462
|
+
...stdStyles.S1,
|
|
1463
|
+
color: colors.white
|
|
1464
|
+
},
|
|
1310
1465
|
shutterButton: {
|
|
1311
1466
|
width: SHUTTER_BUTTON_SIZE,
|
|
1312
1467
|
height: SHUTTER_BUTTON_SIZE,
|
|
@@ -1323,9 +1478,9 @@ const styles = StyleSheet.create({
|
|
|
1323
1478
|
width: SHUTTER_BUTTON_SIZE,
|
|
1324
1479
|
height: SHUTTER_BUTTON_SIZE,
|
|
1325
1480
|
borderRadius: SHUTTER_BUTTON_SIZE / 2,
|
|
1326
|
-
borderWidth:
|
|
1481
|
+
borderWidth: 4,
|
|
1327
1482
|
borderColor: colors.white,
|
|
1328
|
-
backgroundColor: '
|
|
1483
|
+
backgroundColor: 'transparent'
|
|
1329
1484
|
},
|
|
1330
1485
|
shutterButtonOuterDisabled: {
|
|
1331
1486
|
borderColor: 'rgba(255,255,255,0.6)',
|
|
@@ -1351,9 +1506,8 @@ const styles = StyleSheet.create({
|
|
|
1351
1506
|
marginBottom: 30
|
|
1352
1507
|
},
|
|
1353
1508
|
doneButtonText: {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
fontWeight: 'bold'
|
|
1509
|
+
...stdStyles.S3,
|
|
1510
|
+
color: colors.white
|
|
1357
1511
|
},
|
|
1358
1512
|
doneButtonIcon: {
|
|
1359
1513
|
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
|
)}
|