@supportworks/multi-imagepicker 6.0.0 → 7.0.1
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 +5 -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 +284 -264
- 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
package/src/lib/MIPickerApi.js
CHANGED
|
@@ -1,47 +1,86 @@
|
|
|
1
|
-
import AsyncStorage from
|
|
1
|
+
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
2
2
|
|
|
3
|
-
export default class MIPickerApi
|
|
4
|
-
|
|
5
|
-
/**
|
|
3
|
+
export default class MIPickerApi {
|
|
4
|
+
/**
|
|
6
5
|
*
|
|
7
6
|
* Initialize property getters and setters
|
|
8
7
|
* */
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
AsyncStorage.setItem('@SavePhotosToDevice', newValStr)
|
|
22
|
-
.then(res => {
|
|
23
|
-
console.log("Set defaultSavePhotosToDevice: AsyncStorage.setItem success, set to value: " + newValStr);
|
|
24
|
-
this._defaultSavePhotosToDevice = newValBool;
|
|
25
|
-
})
|
|
26
|
-
.catch(err => {
|
|
27
|
-
console.log("Set defaultSavePhotosToDevice: AsyncStorage.setItem failed, Error: " + err);
|
|
28
|
-
this._defaultSavePhotosToDevice = newValBool;
|
|
29
|
-
});
|
|
9
|
+
setDefaultSavePhotosToDevice (defaultSavePhotosToDevice) {
|
|
10
|
+
// AsyncStorage must be a string value, so converting boolean to string to save to AS
|
|
11
|
+
let newValBool = defaultSavePhotosToDevice
|
|
12
|
+
let newValStr
|
|
13
|
+
if ((newValBool === null) || (newValBool === true)) {
|
|
14
|
+
newValBool = true // default
|
|
15
|
+
newValStr = 'Y'
|
|
16
|
+
} else {
|
|
17
|
+
newValBool = false
|
|
18
|
+
newValStr = 'N'
|
|
30
19
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
20
|
+
AsyncStorage.setItem('@SavePhotosToDevice', newValStr)
|
|
21
|
+
.then(res => {
|
|
22
|
+
console.log('setDefaultSavePhotosToDevice: AsyncStorage.setItem success, set to value: ' + newValStr)
|
|
23
|
+
this._defaultSavePhotosToDevice = newValBool
|
|
24
|
+
})
|
|
25
|
+
.catch(err => {
|
|
26
|
+
console.log('setDefaultSavePhotosToDevice: AsyncStorage.setItem failed, Error: ' + err)
|
|
27
|
+
this._defaultSavePhotosToDevice = newValBool
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async getDefaultSavePhotosToDevice () {
|
|
32
|
+
console.log('in getDefaultSavePhotosToDevice')
|
|
33
|
+
if ((this._defaultSavePhotosToDevice !== null) && (this._defaultSavePhotosToDevice !== undefined)) {
|
|
34
|
+
return this._defaultSavePhotosToDevice
|
|
35
|
+
}
|
|
36
|
+
console.log('in getDefaultSavePhotosToDevice, trying to get value from AsyncStorage')
|
|
37
|
+
// not a value yet, so look in AsyncStorage
|
|
38
|
+
const retVal = await AsyncStorage.getItem('@SavePhotosToDevice')
|
|
39
|
+
if (retVal === 'N') {
|
|
40
|
+
console.log('getDefaultSavePhotosToDevice: return false')
|
|
41
|
+
return false
|
|
42
|
+
} else {
|
|
43
|
+
console.log('getDefaultSavePhotosToDevice: return true')
|
|
44
|
+
return true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
setDefaultShowToCustomer (defaultShowToCustomer) {
|
|
49
|
+
// AsyncStorage must be a string value, so converting boolean to string to save to AS
|
|
50
|
+
let newValBool = defaultShowToCustomer
|
|
51
|
+
let newValStr
|
|
52
|
+
if ((newValBool === null) || (newValBool === true)) {
|
|
53
|
+
newValBool = true // default
|
|
54
|
+
newValStr = 'Y'
|
|
55
|
+
} else {
|
|
56
|
+
newValBool = false
|
|
57
|
+
newValStr = 'N'
|
|
58
|
+
}
|
|
59
|
+
AsyncStorage.setItem('@MIP_ShowToCustomer', newValStr)
|
|
60
|
+
.then(res => {
|
|
61
|
+
console.log('setDefaultShowToCustomer: AsyncStorage.setItem success, set to value: ' + newValStr)
|
|
62
|
+
this._defaultShowToCustomer = newValBool
|
|
63
|
+
})
|
|
64
|
+
.catch(err => {
|
|
65
|
+
console.log('setDefaultShowToCustomer: AsyncStorage.setItem failed, Error: ' + err)
|
|
66
|
+
this._defaultShowToCustomer = newValBool
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async getDefaultShowToCustomer () {
|
|
71
|
+
console.log('in getDefaultShowToCustomer')
|
|
72
|
+
if ((this._defaultShowToCustomer !== null) && (this._defaultShowToCustomer !== undefined)) {
|
|
73
|
+
return this._defaultShowToCustomer
|
|
74
|
+
}
|
|
75
|
+
console.log('in getDefaultShowToCustomer, trying to get value from AsyncStorage')
|
|
76
|
+
// not a value yet, so look in AsyncStorage
|
|
77
|
+
const retVal = await AsyncStorage.getItem('@MIP_ShowToCustomer')
|
|
78
|
+
if (retVal === 'N') {
|
|
79
|
+
console.log('getDefaultShowToCustomer: return false')
|
|
80
|
+
return false
|
|
81
|
+
} else {
|
|
82
|
+
console.log('getDefaultShowToCustomer: return true')
|
|
83
|
+
return true
|
|
46
84
|
}
|
|
85
|
+
}
|
|
47
86
|
}
|