@supportworks/multi-imagepicker 5.0.7 → 7.0.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/TestMIP.js +103 -0
- package/changes.md +11 -0
- package/index.js +15 -9
- package/package.json +2 -2
- package/src/components/ActionBar.js +104 -0
- package/src/components/AddImages.js +473 -304
- package/src/components/ImageDetailsModal.js +134 -0
- package/src/components/ImageIndicators.js +85 -0
- package/src/components/MultiImagePicker.js +268 -248
- package/src/components/SelectedImages.js +130 -67
- package/src/components/SingleImage.js +320 -182
- package/src/components/UploadWarningModal.js +105 -0
- package/src/components/loaderHandler.js +5 -5
- package/src/lib/MIPickerApi.js +78 -39
|
@@ -1,285 +1,305 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import React, { useCallback, useMemo, useRef, forwardRef, useImperativeHandle } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
Alert,
|
|
6
|
+
Platform,
|
|
7
|
+
Linking
|
|
8
|
+
} from 'react-native'
|
|
9
|
+
import ActionSheet from '@alessiocancian/react-native-actionsheet'
|
|
10
|
+
import ImagePicker from 'react-native-image-crop-picker'
|
|
11
|
+
import ImageResizer from '@bam.tech/react-native-image-resizer'
|
|
12
|
+
import { Api } from '@supportworks/api-core'
|
|
13
|
+
import { check, request, PERMISSIONS, RESULTS, openSettings } from 'react-native-permissions'
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const MultiImagePicker = forwardRef((props, ref) => {
|
|
16
|
+
// Destructure known props and collect any remaining props to forward to the TouchableOpacity.
|
|
17
|
+
const {
|
|
18
|
+
useCamera = 'Take Photo...',
|
|
19
|
+
useLibrary = 'Choose from Library...',
|
|
20
|
+
title = 'Add Photo(s)',
|
|
21
|
+
parentStyle = null, // style applied to the parent View; otherwise style prop will be forwarded to TouchableOpacity
|
|
22
|
+
customButtons = [], // array of titles of custom buttons to display, pre-pended to action sheet buttons (optional)
|
|
23
|
+
maxCount = 25, // max number of images that can be selected
|
|
24
|
+
callbackData = null, // data appended to payload and passed with callback function (optional)
|
|
25
|
+
callback = null, // callback function (optional)
|
|
26
|
+
children,
|
|
27
|
+
...touchableProps // any other props passed into MultiImagePicker will be spread onto the TouchableOpacity below
|
|
28
|
+
} = props
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const imgArrRef = useRef([]) // temp array for holding selected images to attach, before title & desc updated
|
|
31
|
+
const imgDescArrRef = useRef([]) // temp array for holding descriptions of selected images, before saved to project
|
|
32
|
+
const imgValidArrRef = useRef([]) // temp array for holding boolean value specifying whether each image title is valid or not
|
|
33
|
+
const actionSheetRef = useRef(null)
|
|
34
|
+
|
|
35
|
+
const showPermissionAlert = useCallback((type) => {
|
|
36
|
+
const platformMessage = Platform.select({
|
|
37
|
+
ios:
|
|
38
|
+
'Photo library access is required. Please go to Settings > Privacy > Photos and grant full access for this app.',
|
|
39
|
+
android:
|
|
40
|
+
`${type} access is required to select photos. Please go to Settings > Apps > THIS_APP > Permissions and enable access.`
|
|
41
|
+
})
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (requestResponse === RESULTS.BLOCKED) {
|
|
40
|
-
this.showPermissionAlert('Storage');
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return requestResponse === RESULTS.GRANTED;
|
|
44
|
-
case RESULTS.BLOCKED:
|
|
45
|
-
this.showPermissionAlert('Storage');
|
|
46
|
-
return false;
|
|
47
|
-
default:
|
|
48
|
-
return false;
|
|
43
|
+
Alert.alert(
|
|
44
|
+
'Permission Required',
|
|
45
|
+
`${platformMessage || 'Permission is required.'} You need to enable access to continue.`,
|
|
46
|
+
[
|
|
47
|
+
{ text: 'Cancel', style: 'cancel' },
|
|
48
|
+
{
|
|
49
|
+
text: 'Open Settings',
|
|
50
|
+
onPress: () => openSettings().catch(() => Linking.openURL('app-settings:'))
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
}, [])
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
const checkAndRequestSinglePermission = useCallback(async (permission) => {
|
|
57
|
+
const result = await check(permission)
|
|
58
|
+
switch (result) {
|
|
59
|
+
case RESULTS.GRANTED:
|
|
60
|
+
return true
|
|
61
|
+
case RESULTS.DENIED: {
|
|
62
|
+
// if request is blocked, show persmission
|
|
63
|
+
const requestResponse = await request(permission)
|
|
64
|
+
if (requestResponse === RESULTS.BLOCKED) {
|
|
65
|
+
showPermissionAlert('Storage')
|
|
66
|
+
return false
|
|
60
67
|
}
|
|
68
|
+
return requestResponse === RESULTS.GRANTED
|
|
69
|
+
}
|
|
70
|
+
case RESULTS.BLOCKED:
|
|
71
|
+
showPermissionAlert('Storage')
|
|
72
|
+
return false
|
|
73
|
+
default:
|
|
74
|
+
return false
|
|
61
75
|
}
|
|
76
|
+
}, [showPermissionAlert])
|
|
62
77
|
|
|
78
|
+
const requestPermissions = useCallback(async (permission) => {
|
|
79
|
+
if (Array.isArray(permission)) {
|
|
80
|
+
// Handle multiple permissions
|
|
81
|
+
const results = await Promise.all(permission.map((p) => checkAndRequestSinglePermission(p)))
|
|
82
|
+
return results.every((result) => result)
|
|
83
|
+
}
|
|
84
|
+
// Handle single permission
|
|
85
|
+
return checkAndRequestSinglePermission(permission)
|
|
86
|
+
}, [checkAndRequestSinglePermission])
|
|
63
87
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const result = await check(permission);
|
|
88
|
+
const requestCameraPermission = useCallback(async () => {
|
|
89
|
+
const permission = Platform.select({
|
|
90
|
+
ios: PERMISSIONS.IOS.CAMERA,
|
|
91
|
+
android: PERMISSIONS.ANDROID.CAMERA
|
|
92
|
+
})
|
|
71
93
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return true;
|
|
75
|
-
case RESULTS.DENIED:
|
|
76
|
-
const requestResult = await request(permission);
|
|
77
|
-
return requestResult === RESULTS.GRANTED;
|
|
78
|
-
case RESULTS.BLOCKED:
|
|
79
|
-
this.showPermissionAlert('Camera');
|
|
80
|
-
return false;
|
|
81
|
-
default:
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
94
|
+
if (!permission) {
|
|
95
|
+
return true
|
|
84
96
|
}
|
|
85
97
|
|
|
86
|
-
|
|
98
|
+
const result = await check(permission)
|
|
87
99
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
text: 'Open Settings',
|
|
102
|
-
onPress: () => openSettings().catch(() => Linking.openURL('app-settings:'))
|
|
103
|
-
},
|
|
104
|
-
]
|
|
105
|
-
);
|
|
100
|
+
switch (result) {
|
|
101
|
+
case RESULTS.GRANTED:
|
|
102
|
+
return true
|
|
103
|
+
case RESULTS.DENIED: {
|
|
104
|
+
const requestResult = await request(permission)
|
|
105
|
+
return requestResult === RESULTS.GRANTED
|
|
106
|
+
}
|
|
107
|
+
case RESULTS.BLOCKED:
|
|
108
|
+
showPermissionAlert('Camera')
|
|
109
|
+
return false
|
|
110
|
+
default:
|
|
111
|
+
return false
|
|
106
112
|
}
|
|
113
|
+
}, [showPermissionAlert])
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
//if its android 33+ then we don't need to check read external sorage. we need to check media images and video
|
|
111
|
-
let permission;
|
|
115
|
+
const checkAndOpenPicker = useCallback(async (options, action) => {
|
|
116
|
+
let permission
|
|
112
117
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
if (Platform.OS === 'android') {
|
|
119
|
+
// Check Android version
|
|
120
|
+
const androidVersion = parseInt(String(Platform.Version), 10)
|
|
121
|
+
if (androidVersion >= 33) {
|
|
122
|
+
// Android 13+ requires specific media permissions -
|
|
123
|
+
// UPDATE 9/24/25: these are no longer needed and in fact Google Play Store prohibits use of them in our case
|
|
124
|
+
/* permission = [
|
|
125
|
+
PERMISSIONS.ANDROID.READ_MEDIA_IMAGES,
|
|
126
|
+
PERMISSIONS.ANDROID.READ_MEDIA_VIDEO,
|
|
127
|
+
]; */
|
|
128
|
+
permission = undefined
|
|
129
|
+
} else {
|
|
130
|
+
// Use legacy storage permission for Android < 33
|
|
131
|
+
permission = PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
// iOS permission
|
|
135
|
+
permission = PERMISSIONS.IOS.PHOTO_LIBRARY
|
|
136
|
+
}
|
|
130
137
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
this.showPermissionAlert('Both Storage and the Photos and Videos');
|
|
137
|
-
}
|
|
138
|
+
const hasPermission = permission ? await requestPermissions(permission) : true
|
|
139
|
+
if (hasPermission) {
|
|
140
|
+
action(options) // Proceed if permission granted
|
|
141
|
+
} else {
|
|
142
|
+
showPermissionAlert('Both Storage and the Photos and Videos')
|
|
138
143
|
}
|
|
144
|
+
}, [requestPermissions, showPermissionAlert])
|
|
139
145
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
const pickerDone = useCallback(async (index, cancelIndex, imageSource = null) => {
|
|
147
|
+
// user is done using the picker to select images. index: index of button that was clicked.
|
|
148
|
+
// cancelIndex: index of the cancel button, so we know which button was clicked, since we know cancel is the last index available.
|
|
149
|
+
// imageSource: "taken" if image was taken from device now, "library" if image(s) were selected from library
|
|
144
150
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
for (let i = 0; i < this.imgArr.length; i++) {
|
|
148
|
-
const resizedImage = await ImageResizer.createResizedImage(
|
|
149
|
-
this.imgArr[i].path,
|
|
150
|
-
2000,
|
|
151
|
-
2000,
|
|
152
|
-
'JPEG',
|
|
153
|
-
80
|
|
154
|
-
);
|
|
155
|
-
await Api.getApi().moveLocalFile(resizedImage.path, this.imgArr[i].path, true);
|
|
156
|
-
}
|
|
157
|
-
callback({
|
|
158
|
-
index,
|
|
159
|
-
cancelIndex,
|
|
160
|
-
imageArray: this.imgArr,
|
|
161
|
-
imageDescArray: this.imgDescArr,
|
|
162
|
-
imageValidArray: this.imgValidArr,
|
|
163
|
-
imageSource,
|
|
164
|
-
callbackData,
|
|
165
|
-
});
|
|
166
|
-
}
|
|
151
|
+
if (!callback) {
|
|
152
|
+
return
|
|
167
153
|
}
|
|
168
154
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
try {
|
|
183
|
-
const image = await ImagePicker.openCamera(options);
|
|
184
|
-
console.log("SWSI take photo, image: " + JSON.stringify(image));
|
|
155
|
+
for (let i = 0; i < imgArrRef.current.length; i++) {
|
|
156
|
+
const resizedImage = await ImageResizer.createResizedImage(
|
|
157
|
+
imgArrRef.current[i].path,
|
|
158
|
+
2000,
|
|
159
|
+
2000,
|
|
160
|
+
'JPEG',
|
|
161
|
+
80
|
|
162
|
+
)
|
|
163
|
+
await Api.getApi().moveLocalFile(resizedImage.path, imgArrRef.current[i].path, true)
|
|
164
|
+
}
|
|
185
165
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
166
|
+
callback({
|
|
167
|
+
index,
|
|
168
|
+
cancelIndex,
|
|
169
|
+
imageArray: imgArrRef.current,
|
|
170
|
+
imageDescArray: imgDescArrRef.current,
|
|
171
|
+
imageValidArray: imgValidArrRef.current,
|
|
172
|
+
imageSource,
|
|
173
|
+
callbackData
|
|
174
|
+
})
|
|
175
|
+
}, [callback, callbackData])
|
|
176
|
+
|
|
177
|
+
const takeOnePicture = useCallback(async (
|
|
178
|
+
index,
|
|
179
|
+
cancelIndex,
|
|
180
|
+
options,
|
|
181
|
+
depth,
|
|
182
|
+
done
|
|
183
|
+
) => {
|
|
184
|
+
if (depth > maxCount) {
|
|
185
|
+
done()
|
|
186
|
+
return
|
|
193
187
|
}
|
|
194
188
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
189
|
+
const hasPermission = await requestCameraPermission()
|
|
190
|
+
if (!hasPermission) {
|
|
191
|
+
showPermissionAlert('Camera')
|
|
192
|
+
done()
|
|
193
|
+
return
|
|
194
|
+
}
|
|
201
195
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
196
|
+
try {
|
|
197
|
+
const image = await ImagePicker.openCamera(options)
|
|
198
|
+
console.log('SWSI take photo, image: ' + JSON.stringify(image))
|
|
199
|
+
imgArrRef.current.push(image)
|
|
200
|
+
imgDescArrRef.current.push('')
|
|
201
|
+
imgValidArrRef.current.push(true)
|
|
202
|
+
await takeOnePicture(index, cancelIndex, options, depth + 1, done)
|
|
203
|
+
} catch (e) {
|
|
204
|
+
done()
|
|
205
|
+
}
|
|
206
|
+
}, [maxCount, requestCameraPermission, showPermissionAlert])
|
|
211
207
|
|
|
208
|
+
const usePicker = useCallback((index, cancelIndex) => {
|
|
209
|
+
// index: index of ActionSheet. Depends on whether custom buttons added. Last 3 are fixed (Take Photo, Choose from Library, Cancel). Anything before that is custom button.
|
|
210
|
+
// Custom buttons can be sent using customButtons prop.
|
|
211
|
+
// results - sets cRef.imgArr to an array of image info that the picker library provided
|
|
212
|
+
// sets cRef.imgDescArray to an array of the image descriptions
|
|
213
|
+
// initializes cRef.imgValidArr to an array of booleans (all true) for all selected images, to be used/updated by calling code as needed
|
|
212
214
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
const options = {
|
|
216
|
+
multiple: true,
|
|
217
|
+
maxFiles: maxCount, // ios only
|
|
218
|
+
cropping: false,
|
|
219
|
+
mediaType: 'photo'
|
|
220
|
+
}
|
|
216
221
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
this.checkAndOpenPicker(options, () =>
|
|
221
|
-
this.takeOnePicture(index, cancelIndex, options, 1, () => {
|
|
222
|
-
if (this.imgArr.length > 0) {
|
|
223
|
-
imageSource = 'taken';
|
|
224
|
-
this.pickerDone(index, cancelIndex, imageSource);
|
|
225
|
-
}
|
|
226
|
-
})
|
|
227
|
-
);
|
|
228
|
-
break;
|
|
222
|
+
imgArrRef.current = [] // clear selected images
|
|
223
|
+
imgDescArrRef.current = [] // clear descriptions for selected images
|
|
224
|
+
imgValidArrRef.current = [] // clear valid flags for selected images
|
|
229
225
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
.then((images) => {
|
|
234
|
-
if (images.length > this.props.maxCount) {
|
|
235
|
-
alert(`You may only select a max of ${this.props.maxCount} photo(s)`);
|
|
236
|
-
} else {
|
|
237
|
-
this.imgArr = images;
|
|
238
|
-
this.imgDescArr = Array(images.length).fill('');
|
|
239
|
-
this.imgValidArr = Array(images.length).fill(true);
|
|
240
|
-
imageSource = 'library';
|
|
241
|
-
this.pickerDone(index, cancelIndex, imageSource);
|
|
242
|
-
}
|
|
243
|
-
})
|
|
244
|
-
.catch((err) => {
|
|
245
|
-
console.log(`----usePicker Image Picker Error: ${err.message}`);
|
|
246
|
-
})
|
|
247
|
-
);
|
|
248
|
-
break;
|
|
226
|
+
const takePhotoIndex = cancelIndex - 2
|
|
227
|
+
const chooseLibIndex = cancelIndex - 1
|
|
228
|
+
let imageSource = null
|
|
249
229
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
230
|
+
switch (index) {
|
|
231
|
+
case takePhotoIndex:
|
|
232
|
+
console.log('User pressed take photo')
|
|
233
|
+
checkAndOpenPicker(options, () =>
|
|
234
|
+
takeOnePicture(index, cancelIndex, options, 1, () => {
|
|
235
|
+
if (imgArrRef.current.length > 0) {
|
|
236
|
+
imageSource = 'taken'
|
|
237
|
+
pickerDone(index, cancelIndex, imageSource)
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
)
|
|
241
|
+
break
|
|
242
|
+
case chooseLibIndex:
|
|
243
|
+
checkAndOpenPicker(options, () =>
|
|
244
|
+
ImagePicker.openPicker(options)
|
|
245
|
+
.then((imagesOrImage) => {
|
|
246
|
+
const images = Array.isArray(imagesOrImage) ? imagesOrImage : [imagesOrImage]
|
|
247
|
+
if (images.length > maxCount) {
|
|
248
|
+
Alert.alert('Selection Limit', `You may only select a max of ${maxCount} photo(s)`)
|
|
249
|
+
} else {
|
|
250
|
+
imgArrRef.current = images
|
|
251
|
+
imgDescArrRef.current = Array(images.length).fill('')
|
|
252
|
+
imgValidArrRef.current = Array(images.length).fill(true)
|
|
253
|
+
imageSource = 'library'
|
|
254
|
+
pickerDone(index, cancelIndex, imageSource)
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
.catch((err) => {
|
|
258
|
+
console.log(`----usePicker Image Picker Error: ${err.message}`)
|
|
259
|
+
})
|
|
260
|
+
)
|
|
261
|
+
break
|
|
262
|
+
case cancelIndex:
|
|
263
|
+
console.log('----usePicker User pressed cancel')
|
|
264
|
+
break
|
|
265
|
+
default:
|
|
266
|
+
console.log('----usePicker User pressed custom button')
|
|
267
|
+
pickerDone(index, cancelIndex)
|
|
268
|
+
}
|
|
269
|
+
}, [checkAndOpenPicker, maxCount, pickerDone, takeOnePicture])
|
|
253
270
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
271
|
+
const showActionSheet = useCallback(() => {
|
|
272
|
+
if (actionSheetRef.current && typeof actionSheetRef.current.show === 'function') {
|
|
273
|
+
actionSheetRef.current.show()
|
|
258
274
|
}
|
|
275
|
+
}, [])
|
|
259
276
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
277
|
+
useImperativeHandle(ref, () => ({
|
|
278
|
+
showActionSheet
|
|
279
|
+
}), [showActionSheet])
|
|
263
280
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
281
|
+
const buttonArr = useMemo(
|
|
282
|
+
() => [...customButtons, useCamera, useLibrary, 'Cancel'],
|
|
283
|
+
[customButtons, useCamera, useLibrary]
|
|
284
|
+
)
|
|
285
|
+
const cancelIndex = buttonArr.length - 1
|
|
267
286
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
287
|
+
return (
|
|
288
|
+
<View style={parentStyle}>
|
|
289
|
+
<ActionSheet
|
|
290
|
+
ref={(node) => {
|
|
291
|
+
actionSheetRef.current = node
|
|
292
|
+
}}
|
|
293
|
+
title={title}
|
|
294
|
+
options={buttonArr}
|
|
295
|
+
cancelButtonIndex={cancelIndex}
|
|
296
|
+
onPress={(buttonIndex) => usePicker(buttonIndex, cancelIndex)}
|
|
297
|
+
/>
|
|
298
|
+
<TouchableOpacity {...touchableProps} onPress={showActionSheet}>
|
|
299
|
+
{children}
|
|
300
|
+
</TouchableOpacity>
|
|
301
|
+
</View>
|
|
302
|
+
)
|
|
303
|
+
})
|
|
284
304
|
|
|
285
|
-
export default MultiImagePicker
|
|
305
|
+
export default MultiImagePicker
|