@supportworks/multi-imagepicker 8.3.9 → 8.4.0
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/changes.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
|
|
2
|
+
# v8.4.0 2026-07-15
|
|
3
|
+
* DEV-9653: Fixed iOS camera modal handoff so captured photos are processed only after the native modal has fully dismissed. This prevents the Add Images editor from opening behind an invisible modal layer that can swallow touches and make the app appear frozen.
|
|
4
|
+
|
|
2
5
|
# v8.3.9 2026-06-03
|
|
3
6
|
* removed deprecated absoluteFillObject
|
|
4
7
|
|
package/package.json
CHANGED
|
@@ -241,11 +241,6 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
|
|
|
241
241
|
const showCameraSwitchControl = !isTightLayout
|
|
242
242
|
const showSecondaryControls = showFlashControl || showCameraSwitchControl
|
|
243
243
|
|
|
244
|
-
// Debug logging
|
|
245
|
-
React.useEffect(() => {
|
|
246
|
-
console.log('CameraModal: cameraRef is', externalCameraRef ? 'external' : 'internal')
|
|
247
|
-
console.log('CameraModal: cameraRef.current is', cameraRef.current ? 'not null' : 'null')
|
|
248
|
-
}, [externalCameraRef, cameraRef])
|
|
249
244
|
const swipeModalRef = useRef<any>(null)
|
|
250
245
|
const shutterFlashAnim = useRef(new Animated.Value(0)).current
|
|
251
246
|
const [currentZoom, setCurrentZoom] = useState<number>(DEFAULT_ZOOM)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
1
|
+
import React, { useCallback, useMemo, useRef, forwardRef, useImperativeHandle, useState } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
AppState,
|
|
4
4
|
View,
|
|
@@ -48,6 +48,7 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
48
48
|
} = props
|
|
49
49
|
|
|
50
50
|
const [showCameraModal, setShowCameraModal] = useState(false)
|
|
51
|
+
const [isCameraModalMounted, setIsCameraModalMounted] = useState(false)
|
|
51
52
|
const [pendingPickerIndex, setPendingPickerIndex] = useState(null)
|
|
52
53
|
const [pendingCancelIndex, setPendingCancelIndex] = useState(null)
|
|
53
54
|
const [actionSheetInstanceKey, setActionSheetInstanceKey] = useState(0)
|
|
@@ -56,7 +57,7 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
56
57
|
const imgDescArrRef = useRef([]) // temp array for holding descriptions of selected images, before saved to project
|
|
57
58
|
const imgValidArrRef = useRef([]) // temp array for holding boolean value specifying whether each image title is valid or not
|
|
58
59
|
const actionSheetRef = useRef(null)
|
|
59
|
-
const
|
|
60
|
+
const pendingCameraResultRef = useRef(null)
|
|
60
61
|
|
|
61
62
|
const resolvedMaxCount = useMemo(() => {
|
|
62
63
|
const parsedMaxCount = Number(maxCount)
|
|
@@ -84,13 +85,6 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
84
85
|
setActionSheetInstanceKey((prevKey) => prevKey + 1)
|
|
85
86
|
}, [])
|
|
86
87
|
|
|
87
|
-
const clearPendingCameraProcessTimeout = useCallback(() => {
|
|
88
|
-
if (pendingCameraProcessTimeoutRef.current) {
|
|
89
|
-
clearTimeout(pendingCameraProcessTimeoutRef.current)
|
|
90
|
-
pendingCameraProcessTimeoutRef.current = null
|
|
91
|
-
}
|
|
92
|
-
}, [])
|
|
93
|
-
|
|
94
88
|
const showSelectionLimitAlert = useCallback(() => {
|
|
95
89
|
const message = remainingCount <= 0
|
|
96
90
|
? `You already have the maximum of ${resolvedMaxCount} photo(s)`
|
|
@@ -279,31 +273,39 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
279
273
|
const pickerIndex = pendingPickerIndex
|
|
280
274
|
const cancelIndex = pendingCancelIndex
|
|
281
275
|
|
|
282
|
-
|
|
276
|
+
pendingCameraResultRef.current = {
|
|
277
|
+
images,
|
|
278
|
+
pickerIndex,
|
|
279
|
+
cancelIndex
|
|
280
|
+
}
|
|
281
|
+
|
|
283
282
|
setShowCameraModal(false)
|
|
284
283
|
resetActionSheet()
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
284
|
+
}, [pendingCancelIndex, pendingPickerIndex, resetActionSheet])
|
|
285
|
+
|
|
286
|
+
const handleCameraModalDismiss = useCallback(() => {
|
|
287
|
+
const pendingResult = pendingCameraResultRef.current
|
|
288
|
+
pendingCameraResultRef.current = null
|
|
289
|
+
|
|
290
|
+
setIsCameraModalMounted(false)
|
|
291
|
+
|
|
292
|
+
// Wait for native Modal dismissal before opening the image editor; otherwise
|
|
293
|
+
// iOS can leave an invisible modal layer above the editor and swallow touches.
|
|
294
|
+
if (pendingResult?.images?.length > 0) {
|
|
295
|
+
if (pendingResult.pickerIndex !== null && pendingResult.cancelIndex !== null) {
|
|
296
|
+
processCameraModalImages(
|
|
297
|
+
pendingResult.images,
|
|
298
|
+
pendingResult.pickerIndex,
|
|
299
|
+
pendingResult.cancelIndex
|
|
300
|
+
)
|
|
292
301
|
} else {
|
|
293
302
|
console.log('SWSI Camera modal missing picker indices; skipping captured image handoff')
|
|
294
303
|
}
|
|
295
304
|
}
|
|
296
305
|
|
|
297
|
-
// Reset pending indices
|
|
298
306
|
setPendingPickerIndex(null)
|
|
299
307
|
setPendingCancelIndex(null)
|
|
300
|
-
}, [
|
|
301
|
-
|
|
302
|
-
useEffect(() => {
|
|
303
|
-
return () => {
|
|
304
|
-
clearPendingCameraProcessTimeout()
|
|
305
|
-
}
|
|
306
|
-
}, [clearPendingCameraProcessTimeout])
|
|
308
|
+
}, [processCameraModalImages])
|
|
307
309
|
|
|
308
310
|
const takeOnePicture = useCallback(async (
|
|
309
311
|
index,
|
|
@@ -378,6 +380,7 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
378
380
|
setPendingPickerIndex(index)
|
|
379
381
|
setPendingCancelIndex(cancelIndex)
|
|
380
382
|
resetActionSheet()
|
|
383
|
+
setIsCameraModalMounted(true)
|
|
381
384
|
setShowCameraModal(true)
|
|
382
385
|
} else {
|
|
383
386
|
// Fall back to native camera (Android)
|
|
@@ -465,12 +468,13 @@ const MultiImagePicker = forwardRef((props, ref) => {
|
|
|
465
468
|
<TouchableOpacity {...touchableProps} onPress={showActionSheet}>
|
|
466
469
|
{children}
|
|
467
470
|
</TouchableOpacity>
|
|
468
|
-
{Platform.OS === 'ios' &&
|
|
471
|
+
{Platform.OS === 'ios' && isCameraModalMounted && (
|
|
469
472
|
<Modal
|
|
470
473
|
visible={showCameraModal}
|
|
471
474
|
animationType='slide'
|
|
472
475
|
presentationStyle='fullScreen'
|
|
473
476
|
supportedOrientations={['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right']}
|
|
477
|
+
onDismiss={handleCameraModalDismiss}
|
|
474
478
|
onRequestClose={() => handleCameraModalDone([])}
|
|
475
479
|
>
|
|
476
480
|
<CameraModal
|