@supportworks/multi-imagepicker 6.0.0 → 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 +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/TestMIP.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Text, View, StyleSheet } from 'react-native'
|
|
3
|
+
import AddImages from './src/components/AddImages'
|
|
4
|
+
// import { AddImages as AddImagesOLD } from '../../../../node_modules/@supportworks/multi-imagepicker/index'
|
|
5
|
+
import Project from '../../../lib/Project'
|
|
6
|
+
import { SafeAreaView } from 'react-native-safe-area-context'
|
|
7
|
+
import { CommonButton } from '@supportworks/core-controls'
|
|
8
|
+
import { MultiImagePicker } from './index'
|
|
9
|
+
import { colors } from '@supportworks/app-styler'
|
|
10
|
+
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
11
|
+
|
|
12
|
+
export class TestMIP extends React.Component {
|
|
13
|
+
constructor (props) {
|
|
14
|
+
super(props)
|
|
15
|
+
this.onImagesAddedAI = this.onImagesAddedAI.bind(this)
|
|
16
|
+
this.onImagesAddedMIP = this.onImagesAddedMIP.bind(this)
|
|
17
|
+
this.addOnePictureToProject = this.addOnePictureToProject.bind(this)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
triggerAction () {
|
|
21
|
+
this.addImages.triggerAction()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* triggerActionOLD () {
|
|
25
|
+
this.addImagesOLD.triggerAction()
|
|
26
|
+
} */
|
|
27
|
+
|
|
28
|
+
onImagesAddedAI () {
|
|
29
|
+
// callback from AddImages, after images added
|
|
30
|
+
const cRef = this
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
addOnePictureToProject (imgObj, description, prospect) {
|
|
34
|
+
console.log('-----TestMIP addOnePictureToProject, imgObj: ' + JSON.stringify(imgObj))
|
|
35
|
+
console.log('-----TestMIP addOnePictureToProject, description: ' + description)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onImagesAddedMIP (payload) {
|
|
39
|
+
// callback from MultiImagePicker, after images added
|
|
40
|
+
const cRef = this
|
|
41
|
+
|
|
42
|
+
const imgArr = payload.imageArray
|
|
43
|
+
const imgDescArr = payload.imageDescArray
|
|
44
|
+
const imgValidArr = payload.imageValidArray
|
|
45
|
+
console.log('-----TestMIP onImagesAddedMIP: ' + JSON.stringify(payload))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
render () {
|
|
49
|
+
const cRef = this
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<SafeAreaView>
|
|
53
|
+
<View style={{ padding: 16 }}>
|
|
54
|
+
<CommonButton variant='filled' size='large' label='Open Multi Image Picker - AddImages' onPress={() => cRef.triggerAction()} />
|
|
55
|
+
</View>
|
|
56
|
+
<AddImages
|
|
57
|
+
ref={o => cRef.addImages = o} prospectInst={Project} callback={cRef.onImagesAddedAI}
|
|
58
|
+
annotationAllowed
|
|
59
|
+
showToCustomerAllowed
|
|
60
|
+
addPicture={(imgObj, description, prospect) => cRef.addOnePictureToProject(imgObj, description, null)}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<MultiImagePicker callback={cRef.onImagesAddedMIP}>
|
|
64
|
+
<View style={styles.MIP}>
|
|
65
|
+
<Text style={{ color: 'white' }}>Open Multi Image Picker - MultiImagePicker</Text>
|
|
66
|
+
</View>
|
|
67
|
+
</MultiImagePicker>
|
|
68
|
+
|
|
69
|
+
<View style={{ padding: 16 }}>
|
|
70
|
+
<CommonButton variant='filled' size='large' label='Reset CRM Dialog Flag' onPress={async () => await AsyncStorage.removeItem('@MIP_UploadWarningsModal_Skip')} />
|
|
71
|
+
</View>
|
|
72
|
+
|
|
73
|
+
<View style={{ padding: 16 }}>
|
|
74
|
+
<CommonButton variant='filled' size='large' label='Reset ShowToCust Flag' onPress={async () => await AsyncStorage.removeItem('@MIP_ShowToCustomer')} />
|
|
75
|
+
</View>
|
|
76
|
+
|
|
77
|
+
{/* <View style={{ padding: 16 }}>
|
|
78
|
+
<CommonButton variant='filled' size='large' label='Open Multi Image Picker - AddImages OLD' onPress={() => cRef.triggerActionOLD()} color={'secondary'} />
|
|
79
|
+
</View>
|
|
80
|
+
<AddImagesOLD
|
|
81
|
+
ref={o => cRef.addImagesOLD = o} prospectInst={Project} callback={cRef.onImagesAddedAI}
|
|
82
|
+
annotationAllowed
|
|
83
|
+
showToCustomerAllowed
|
|
84
|
+
addPicture={(imgObj, description, prospect) => cRef.addOnePictureToProject(imgObj, description, null)}
|
|
85
|
+
/> */}
|
|
86
|
+
</SafeAreaView>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const styles = StyleSheet.create({
|
|
92
|
+
MIP: {
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'center',
|
|
96
|
+
padding: 16,
|
|
97
|
+
backgroundColor: colors.buttonPrimary,
|
|
98
|
+
borderRadius: 16,
|
|
99
|
+
margin: 16
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
export default TestMIP
|
package/changes.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
|
|
2
|
+
# v7.0.0 2025-11-21
|
|
3
|
+
* converted components to functional components
|
|
4
|
+
* made significant UI updates based on DEV-7191 (Photos To Add)
|
|
5
|
+
* this version likely only useful for RN <= 0.72 due to SafeAreaView changes later
|
|
6
|
+
|
|
2
7
|
# v6.0.0 2025-06-08
|
|
3
8
|
* removed runtime permissions request for android photos and videos, as necessary for Google Play Store compliance
|
|
4
9
|
|
package/index.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import MultiImagePicker from './src/components/MultiImagePicker'
|
|
2
|
-
import SelectedImages from './src/components/SelectedImages'
|
|
3
|
-
import AddImages from
|
|
4
|
-
import MIPickerApi from
|
|
1
|
+
import MultiImagePicker from './src/components/MultiImagePicker'
|
|
2
|
+
import SelectedImages from './src/components/SelectedImages'
|
|
3
|
+
import AddImages from './src/components/AddImages'
|
|
4
|
+
import MIPickerApi from './src/lib/MIPickerApi'
|
|
5
|
+
import ImageIndicators from './src/components/ImageIndicators'
|
|
6
|
+
import ActionBar from './src/components/ActionBar'
|
|
7
|
+
import ImageDetailsModal from './src/components/ImageDetailsModal'
|
|
5
8
|
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
MultiImagePicker,
|
|
11
|
+
SelectedImages,
|
|
12
|
+
AddImages,
|
|
13
|
+
MIPickerApi,
|
|
14
|
+
ImageIndicators,
|
|
15
|
+
ActionBar,
|
|
16
|
+
ImageDetailsModal
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supportworks/multi-imagepicker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Android and iOS customized multiple image picker. For react-native >= 0.60.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@supportworks/analytics": ">=1.0.1",
|
|
18
18
|
"@supportworks/api-core": ">=1.0.9",
|
|
19
19
|
"@supportworks/app-styler": ">=1.0.6",
|
|
20
|
-
"@supportworks/core-controls": ">=
|
|
20
|
+
"@supportworks/core-controls": ">=5.0.0",
|
|
21
21
|
"@supportworks/icon-library": ">=1.4.3",
|
|
22
22
|
"@supportworks/navbars": ">=0.1.3",
|
|
23
23
|
"@supportworks/swmaterialdesign": ">=1.1.3",
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet } from 'react-native'
|
|
3
|
+
import { Icons } from '@supportworks/icon-library'
|
|
4
|
+
import { colors } from '@supportworks/app-styler'
|
|
5
|
+
|
|
6
|
+
const ActionBar = (
|
|
7
|
+
{
|
|
8
|
+
onPressTrash = null,
|
|
9
|
+
onPressDetails = null,
|
|
10
|
+
saveToDevice = false,
|
|
11
|
+
allowSaveToDevice = null,
|
|
12
|
+
onToggleSaveToDevice = null,
|
|
13
|
+
annotationAllowed = false,
|
|
14
|
+
onAnnotate = null,
|
|
15
|
+
allowShowToCustomer = null,
|
|
16
|
+
showToCust = false,
|
|
17
|
+
onToggleShowToCust = null,
|
|
18
|
+
trashDisabled = false,
|
|
19
|
+
style = null
|
|
20
|
+
}) => {
|
|
21
|
+
return (
|
|
22
|
+
<View style={[styles.ActionBar, style]}>
|
|
23
|
+
<View style={styles.LeftGroup}>
|
|
24
|
+
<TouchableOpacity
|
|
25
|
+
style={[styles.IconContainer, styles.IconContainerFirst, trashDisabled && styles.IconDisabled]}
|
|
26
|
+
onPress={onPressTrash}
|
|
27
|
+
disabled={trashDisabled}
|
|
28
|
+
>
|
|
29
|
+
<Icons.IconTrash2_WithPad />
|
|
30
|
+
</TouchableOpacity>
|
|
31
|
+
</View>
|
|
32
|
+
<View style={styles.RightGroup}>
|
|
33
|
+
{false && <TouchableOpacity style={styles.IconContainer} onPress={onPressDetails}>
|
|
34
|
+
<Icons.IconArrowRightTop />
|
|
35
|
+
</TouchableOpacity>}
|
|
36
|
+
<TouchableOpacity style={styles.IconContainer} onPress={onPressDetails}>
|
|
37
|
+
<Icons.IconNotesWrite />
|
|
38
|
+
</TouchableOpacity>
|
|
39
|
+
{allowSaveToDevice && (
|
|
40
|
+
<TouchableOpacity
|
|
41
|
+
style={styles.IconContainer}
|
|
42
|
+
onPress={onToggleSaveToDevice}
|
|
43
|
+
>
|
|
44
|
+
{saveToDevice
|
|
45
|
+
? <Icons.IconDownloadDone2 fill={colors.buttonPrimary} fillOpacity={1} />
|
|
46
|
+
: <Icons.IconSave_WithPad />}
|
|
47
|
+
</TouchableOpacity>
|
|
48
|
+
)}
|
|
49
|
+
{annotationAllowed && (
|
|
50
|
+
<TouchableOpacity style={styles.IconContainer} onPress={onAnnotate}>
|
|
51
|
+
<Icons.IconAnnotate />
|
|
52
|
+
</TouchableOpacity>
|
|
53
|
+
)}
|
|
54
|
+
{allowShowToCustomer && <TouchableOpacity
|
|
55
|
+
style={[styles.IconContainer, styles.IconContainerLast]}
|
|
56
|
+
onPress={onToggleShowToCust}
|
|
57
|
+
>
|
|
58
|
+
{showToCust
|
|
59
|
+
? <Icons.IconSeen fill={colors.buttonPrimary} fillOpacity={1} />
|
|
60
|
+
: <Icons.IconEyeOutline_WithPad />}
|
|
61
|
+
</TouchableOpacity>}
|
|
62
|
+
</View>
|
|
63
|
+
</View>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const styles = StyleSheet.create({
|
|
68
|
+
ActionBar: {
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'space-between',
|
|
72
|
+
marginTop: 8
|
|
73
|
+
},
|
|
74
|
+
LeftGroup: {
|
|
75
|
+
flexDirection: 'row',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
justifyContent: 'flex-start',
|
|
78
|
+
flex: 1
|
|
79
|
+
},
|
|
80
|
+
RightGroup: {
|
|
81
|
+
flexDirection: 'row',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'flex-end',
|
|
84
|
+
flex: 1
|
|
85
|
+
},
|
|
86
|
+
IconContainer: {
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
width: 40,
|
|
90
|
+
height: 40,
|
|
91
|
+
marginHorizontal: 4
|
|
92
|
+
},
|
|
93
|
+
IconContainerFirst: {
|
|
94
|
+
marginLeft: 0
|
|
95
|
+
},
|
|
96
|
+
IconContainerLast: {
|
|
97
|
+
marginRight: 0
|
|
98
|
+
},
|
|
99
|
+
IconDisabled: {
|
|
100
|
+
opacity: 0.32
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
export default ActionBar
|