@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "1.9.18",
3
+ "version": "1.9.19",
4
4
  "main": "src/index.ts",
5
5
  "author": "Paulo Henrique De Souza <paulosouza300272@gmail.com>",
6
6
  "license": "UNLICENSED",
@@ -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
- OSAlert.ask({
154
- title: 'Change Image',
155
- body: 'Do you want to take a new picture or select an existing one?',
156
- ...alertProps,
157
- options: [
158
- {
159
- text: alertProps?.options?.[0]?.text || 'Camera',
160
- onPress: () => {
161
- if (onOpenCamera) {
162
- onOpenCamera(() => onPress('camera'))
163
- } else {
164
- onPress('camera')
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
- ...alertProps?.options[1],
169
- },
170
- {
171
- text: 'Library',
172
- onPress: () => {
173
- if (onOpenGallery) {
174
- onOpenGallery(() => onPress('library'))
175
- } else {
176
- onPress('library')
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
- ...alertProps?.options[2],
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'))