@supportworks/multi-imagepicker 8.0.15 → 8.0.16
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/README.md
CHANGED
|
@@ -76,21 +76,19 @@ render() {
|
|
|
76
76
|
```
|
|
77
77
|
3: Selected Image component - this allows you to display the images that were selected, before saving them, so you can edit their titles and descriptions.
|
|
78
78
|
```javascript
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
cRef.setState({allImageDataValid: allValid});
|
|
87
|
-
}
|
|
79
|
+
|
|
80
|
+
onItemChange (idx, patch) {
|
|
81
|
+
this.setState((prevState) => {
|
|
82
|
+
const items = prevState.items.map((item, i) => (i === idx ? {...item, ...patch} : item))
|
|
83
|
+
const allValid = items.every(it => it?.isValid !== false)
|
|
84
|
+
return {items, allImageDataValid: allValid}
|
|
85
|
+
})
|
|
88
86
|
}
|
|
89
|
-
|
|
87
|
+
|
|
90
88
|
render() {
|
|
91
89
|
...
|
|
92
90
|
<KeyboardAwareScrollView>
|
|
93
|
-
<SelectedImages
|
|
91
|
+
<SelectedImages items={cRef.state.items} onItemChange={cRef.onItemChange}/>
|
|
94
92
|
</KeyboardAwareScrollView>
|
|
95
93
|
...
|
|
96
94
|
}
|
package/changes.md
CHANGED
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
Modal,
|
|
5
5
|
StyleSheet, ScrollView, KeyboardAvoidingView, Platform, PermissionsAndroid, Alert
|
|
6
6
|
} from 'react-native'
|
|
7
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
8
7
|
import Moment from 'moment'
|
|
9
8
|
import { Icons } from '@supportworks/icon-library'
|
|
10
9
|
import loaderHandler from './loaderHandler'
|
|
@@ -12,7 +11,7 @@ import MultiImagePicker from './MultiImagePicker'
|
|
|
12
11
|
import SelectedImages from './SelectedImages'
|
|
13
12
|
import { colors } from '@supportworks/app-styler'
|
|
14
13
|
import { LoadingOverlay } from '@supportworks/navbars'
|
|
15
|
-
import { CheckBox, AppBarH8, CommonButton, ListItem } from '@supportworks/core-controls'
|
|
14
|
+
import { CheckBox, AppBarH8, CommonButton, ListItem, ScreenSafeAreaView } from '@supportworks/core-controls'
|
|
16
15
|
import { CameraRoll } from '@react-native-camera-roll/camera-roll'
|
|
17
16
|
import { Api } from '@supportworks/api-core'
|
|
18
17
|
import { Analytics } from '@supportworks/analytics'
|
|
@@ -49,7 +48,6 @@ const AddImages = forwardRef((
|
|
|
49
48
|
const isMountedRef = useRef(true)
|
|
50
49
|
const STORAGE_KEY_SKIP_DIALOG = '@MIP_UploadWarningsModal_Skip'
|
|
51
50
|
const allowSaveToDevicePlatform = Platform.OS !== 'android' // TODO: set to true when Android support is added
|
|
52
|
-
const insets = useSafeAreaInsets()
|
|
53
51
|
|
|
54
52
|
useEffect(() => {
|
|
55
53
|
return () => {
|
|
@@ -418,7 +416,7 @@ const AddImages = forwardRef((
|
|
|
418
416
|
if (showAdd) {
|
|
419
417
|
return (
|
|
420
418
|
<Modal presentationStyle='fullScreen' animationType='slide'>
|
|
421
|
-
<
|
|
419
|
+
<ScreenSafeAreaView style={styles.Page} edges={['top','bottom']} includeProvider>
|
|
422
420
|
<AppBarH8
|
|
423
421
|
variant='regular'
|
|
424
422
|
title='Photos to Add'
|
|
@@ -453,13 +451,13 @@ const AddImages = forwardRef((
|
|
|
453
451
|
disabled={!allImageDataValid}
|
|
454
452
|
/>
|
|
455
453
|
</View>
|
|
456
|
-
</
|
|
454
|
+
</ScreenSafeAreaView>
|
|
457
455
|
|
|
458
456
|
{Api.getApi().sendPhotosToCRM() && (
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
457
|
+
<UploadWarningModal
|
|
458
|
+
visible={showInfoDialog}
|
|
459
|
+
onClose={onCloseInfoDialog}
|
|
460
|
+
/>
|
|
463
461
|
)}
|
|
464
462
|
</Modal>
|
|
465
463
|
)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef, useCallback } from 'react'
|
|
2
2
|
import { Modal, View, Image, StyleSheet, TouchableOpacity, Text, KeyboardAvoidingView, Platform } from 'react-native'
|
|
3
|
-
import {
|
|
4
|
-
import { AppBarH8 } from '@supportworks/core-controls'
|
|
3
|
+
import { AppBarH8, ScreenSafeAreaView } from '@supportworks/core-controls'
|
|
5
4
|
import { colors, stdStyles } from '@supportworks/app-styler'
|
|
6
5
|
import { TextInputSWMD } from '@supportworks/swmaterialdesign'
|
|
7
6
|
|
|
@@ -19,7 +18,6 @@ const ImageDetailsModal = (
|
|
|
19
18
|
const [localDesc, setLocalDesc] = useState(initialDesc)
|
|
20
19
|
const [inputResetKey, setInputResetKey] = useState(0)
|
|
21
20
|
const titleValidRef = useRef(true)
|
|
22
|
-
const insets = useSafeAreaInsets()
|
|
23
21
|
|
|
24
22
|
const handleClose = useCallback(() => {
|
|
25
23
|
if (onClose) onClose()
|
|
@@ -44,7 +42,7 @@ const ImageDetailsModal = (
|
|
|
44
42
|
visible={visible}
|
|
45
43
|
onRequestClose={handleClose}
|
|
46
44
|
>
|
|
47
|
-
<
|
|
45
|
+
<ScreenSafeAreaView style={styles.Page} edges={['top','bottom']} includeProvider>
|
|
48
46
|
<AppBarH8
|
|
49
47
|
variant='regular'
|
|
50
48
|
title=''
|
|
@@ -61,13 +59,13 @@ const ImageDetailsModal = (
|
|
|
61
59
|
}
|
|
62
60
|
/>
|
|
63
61
|
<KeyboardAvoidingView style={styles.KeyboardAvoidingView} behavior={Platform.OS === 'ios' ? 'padding' : 'height'} enabled>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
<View style={styles.ImageContainer}>
|
|
63
|
+
<Image
|
|
64
|
+
source={{ uri: imageUri }}
|
|
65
|
+
resizeMode='contain'
|
|
66
|
+
style={[styles.Image]}
|
|
67
|
+
/>
|
|
68
|
+
</View>
|
|
71
69
|
<View style={styles.InputContainer}>
|
|
72
70
|
<TextInputSWMD
|
|
73
71
|
key={`title-${inputResetKey}`}
|
|
@@ -98,7 +96,7 @@ const ImageDetailsModal = (
|
|
|
98
96
|
/>
|
|
99
97
|
</View>
|
|
100
98
|
</KeyboardAvoidingView>
|
|
101
|
-
</
|
|
99
|
+
</ScreenSafeAreaView>
|
|
102
100
|
</Modal>
|
|
103
101
|
)
|
|
104
102
|
}
|
|
@@ -3,10 +3,9 @@ import {
|
|
|
3
3
|
View,
|
|
4
4
|
Modal
|
|
5
5
|
} from 'react-native'
|
|
6
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
7
6
|
import SingleImage from './SingleImage'
|
|
8
7
|
import { Analytics } from '@supportworks/analytics'
|
|
9
|
-
import { MediaPlayer } from '@supportworks/core-controls'
|
|
8
|
+
import { MediaPlayer, ScreenSafeAreaView } from '@supportworks/core-controls'
|
|
10
9
|
import { colors } from '@supportworks/app-styler'
|
|
11
10
|
import { Api } from '@supportworks/api-core'
|
|
12
11
|
|
|
@@ -64,7 +63,6 @@ const SelectedImages = (
|
|
|
64
63
|
}, [])
|
|
65
64
|
|
|
66
65
|
const closeMedia = useCallback(() => setMediaOpen(false), [])
|
|
67
|
-
const insets = useSafeAreaInsets()
|
|
68
66
|
|
|
69
67
|
// When MediaPlayer saves an annotated image, refresh the list and bust cache
|
|
70
68
|
const handleMediaUpdated = useCallback((newPath) => {
|
|
@@ -126,7 +124,7 @@ const SelectedImages = (
|
|
|
126
124
|
onRequestClose={closeMedia}
|
|
127
125
|
visible
|
|
128
126
|
>
|
|
129
|
-
<
|
|
127
|
+
<ScreenSafeAreaView style={{ flex: 1, backgroundColor: colors.black }} includeProvider>
|
|
130
128
|
<MediaPlayer
|
|
131
129
|
mediaId={mediaIndex}
|
|
132
130
|
backgroundColor={colors.black}
|
|
@@ -139,7 +137,7 @@ const SelectedImages = (
|
|
|
139
137
|
fullPath={Api.getApi().fullPath}
|
|
140
138
|
fullImagePath={Api.getApi().fullImagePath}
|
|
141
139
|
/>
|
|
142
|
-
</
|
|
140
|
+
</ScreenSafeAreaView>
|
|
143
141
|
</Modal>
|
|
144
142
|
)}
|
|
145
143
|
</>
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
StyleSheet,
|
|
8
8
|
Image, Dimensions
|
|
9
9
|
} from 'react-native'
|
|
10
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
11
10
|
import { Block, Grid, Section } from 'react-native-responsive-layout'
|
|
12
11
|
import { Api } from '@supportworks/api-core'
|
|
13
12
|
import { colors, stdStyles } from '@supportworks/app-styler'
|
|
@@ -17,6 +16,7 @@ import { Analytics } from '@supportworks/analytics'
|
|
|
17
16
|
import ActionBar from './ActionBar'
|
|
18
17
|
import ImageDetailsModal from './ImageDetailsModal'
|
|
19
18
|
import ImageIndicators from './ImageIndicators'
|
|
19
|
+
import { ScreenSafeAreaView } from '@supportworks/core-controls'
|
|
20
20
|
|
|
21
21
|
const SingleImage = (
|
|
22
22
|
{
|
|
@@ -36,7 +36,6 @@ const SingleImage = (
|
|
|
36
36
|
initialDesc = '',
|
|
37
37
|
cacheVersion = 0
|
|
38
38
|
}) => {
|
|
39
|
-
const insets = useSafeAreaInsets()
|
|
40
39
|
const {
|
|
41
40
|
path: imagePath = '',
|
|
42
41
|
defaultName,
|
|
@@ -195,9 +194,9 @@ const SingleImage = (
|
|
|
195
194
|
if (showCanvas) {
|
|
196
195
|
return (
|
|
197
196
|
<Modal presentationStyle='fullScreen' animationType='slide'>
|
|
198
|
-
<
|
|
197
|
+
<ScreenSafeAreaView style={styles.Page} includeProvider>
|
|
199
198
|
<Canvas settings={annotationJson.settings} history={annotationJson.history} base64image={'data:image/jpeg;base64,' + canvasData} onSave={onSaveCanvas} onClose={onCloseCanvas} />
|
|
200
|
-
</
|
|
199
|
+
</ScreenSafeAreaView>
|
|
201
200
|
</Modal>
|
|
202
201
|
)
|
|
203
202
|
}
|