@codeleap/mobile 1.9.18 → 1.9.19
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/package.json +1 -1
- package/src/components/FileInput.tsx +40 -39
package/package.json
CHANGED
|
@@ -144,50 +144,51 @@ export const FileInput = forwardRef<
|
|
|
144
144
|
} else {
|
|
145
145
|
const call = open === 'camera' ? 'openCamera' : 'openPicker'
|
|
146
146
|
ImageCropPicker[call]({ ...mergedOptions, ...(options || {}) }).then(handlePickerResolution)
|
|
147
|
-
|
|
148
147
|
}
|
|
149
|
-
|
|
150
148
|
}
|
|
151
|
-
const openFilePicker = async () => {
|
|
149
|
+
const openFilePicker = async (imageSource) => {
|
|
152
150
|
if (type === 'image') {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
151
|
+
if (imageSource === 'camera') {
|
|
152
|
+
onPress('camera')
|
|
153
|
+
} else if (imageSource === 'library') {
|
|
154
|
+
onPress('library')
|
|
155
|
+
} else {
|
|
156
|
+
OSAlert.ask({
|
|
157
|
+
title: 'Change Image',
|
|
158
|
+
body: 'Do you want to take a new picture or select an existing one?',
|
|
159
|
+
...alertProps,
|
|
160
|
+
options: [
|
|
161
|
+
{
|
|
162
|
+
text: alertProps?.options?.[0]?.text || 'Camera',
|
|
163
|
+
onPress: () => {
|
|
164
|
+
if (onOpenCamera) {
|
|
165
|
+
onOpenCamera(() => onPress('camera'))
|
|
166
|
+
} else {
|
|
167
|
+
onPress('camera')
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
...alertProps?.options[1],
|
|
167
171
|
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
{
|
|
173
|
+
text: 'Library',
|
|
174
|
+
onPress: () => {
|
|
175
|
+
if (onOpenGallery) {
|
|
176
|
+
onOpenGallery(() => onPress('library'))
|
|
177
|
+
} else {
|
|
178
|
+
onPress('library')
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
...alertProps?.options[2],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
text: 'Cancel',
|
|
185
|
+
style: 'cancel',
|
|
186
|
+
onPress: () => {},
|
|
187
|
+
...alertProps?.options[0],
|
|
179
188
|
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
text: 'Cancel',
|
|
184
|
-
style: 'cancel',
|
|
185
|
-
onPress: () => {},
|
|
186
|
-
...alertProps?.options[0],
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
],
|
|
190
|
-
})
|
|
189
|
+
],
|
|
190
|
+
})
|
|
191
|
+
}
|
|
191
192
|
} else {
|
|
192
193
|
if (onOpenFileSystem) {
|
|
193
194
|
onOpenFileSystem(() => onPress('fs'))
|