@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.
@@ -1,196 +1,334 @@
1
- import * as React from 'react';
1
+ import React, { useCallback, useMemo, useEffect, useState, useRef } from 'react'
2
2
  import {
3
- Text,
4
- View,
5
- Modal,
6
- SafeAreaView,
7
- TouchableOpacity,
8
- StyleSheet, ScrollView, KeyboardAvoidingView, Platform, PermissionsAndroid,
9
- Image, Dimensions
10
- } from 'react-native';
11
- import Moment from 'moment';
12
- import {TextInputSWMD} from '@supportworks/swmaterialdesign';
13
- import { Block, Grid, Section } from 'react-native-responsive-layout';
14
- import {Api} from '@supportworks/api-core';
15
- import AppStyler, {colors, stdStyles} from "@supportworks/app-styler";
16
- import { Canvas } from '@supportworks/react-native-annotate';
17
- import ImageResizer from '@bam.tech/react-native-image-resizer';
18
- import {Analytics} from '@supportworks/analytics';
19
-
20
- class SingleImage extends React.Component {
21
-
22
- static defaultProps = {
23
- imgObject: {}, //object. {
24
- imgIndex: 0, //integer
25
- callback: null, //callback function
26
- annotationAllowed: false
27
- };
28
-
29
- constructor (props)
30
- {
31
- super(props);
32
- this.onChangeTitle = this.onChangeTitle.bind(this);
33
- this.onChangeDesc = this.onChangeDesc.bind(this);
34
- this.onReadyCanvas = this.onReadyCanvas.bind(this);
35
- this.onCloseCanvas = this.onCloseCanvas.bind(this);
36
- this.onSaveCanvas = this.onSaveCanvas.bind(this);
37
- this.initialLoad = true;
38
- this.txtTitle = !!props.imgObject.defaultName ? props.imgObject.defaultName : Moment(new Date()).format('YYYY-MM-DD_hmmssa');
39
- this.txtTitleEditable = !!props.imgObject.defaultName ? (props.imgObject.defaultOnly===false) : true;
40
- this.txtDesc = '';
41
- this.initTitle = this.txtTitle
42
- this.initDesc = this.txtDesc
43
- this.state = {
44
- showCanvas: false,
45
- version: 1
46
- }
3
+ Text,
4
+ View,
5
+ Modal,
6
+ SafeAreaView,
7
+ TouchableOpacity,
8
+ StyleSheet,
9
+ Image, Dimensions
10
+ } from 'react-native'
11
+ import { Block, Grid, Section } from 'react-native-responsive-layout'
12
+ import { Api } from '@supportworks/api-core'
13
+ import { colors, stdStyles } from '@supportworks/app-styler'
14
+ import { Canvas } from '@supportworks/react-native-annotate'
15
+ import ImageResizer from '@bam.tech/react-native-image-resizer'
16
+ import { Analytics } from '@supportworks/analytics'
17
+ import ActionBar from './ActionBar'
18
+ import ImageDetailsModal from './ImageDetailsModal'
19
+ import ImageIndicators from './ImageIndicators'
20
+
21
+ const SingleImage = (
22
+ {
23
+ imgObject = {}, // object
24
+ imgIndex = 0, // integer
25
+ callback = null, // callback function
26
+ annotationAllowed = false,
27
+ onOpenMedia = null,
28
+ saveToDevice = false,
29
+ allowSaveToDevice = null,
30
+ onToggleSaveToDevice = null,
31
+ allowShowToCustomer = null,
32
+ showToCust = false,
33
+ onToggleShowToCust = null,
34
+ onDelete = null,
35
+ disableDelete = false,
36
+ initialDesc = '',
37
+ cacheVersion = 0
38
+ }) => {
39
+ const {
40
+ path: imagePath = '',
41
+ defaultName,
42
+ defaultOnly,
43
+ filename
44
+ } = imgObject || {}
45
+
46
+ const defaultTitle = useMemo(() => {
47
+ if (typeof filename === 'string' && filename.length > 0) {
48
+ const lastDotInFilename = filename.lastIndexOf('.')
49
+ return lastDotInFilename !== -1 ? filename.substring(0, lastDotInFilename) : filename
47
50
  }
51
+ return defaultName || ''
52
+ }, [defaultName, filename])
48
53
 
49
- onChangeTitle(payload) {
50
- //concatenate the title and file extension to make the filename
51
- //payload expected (json): {inputValue: 'new field value', isValueValid: boolean}
52
- //console.log("-----onChangeTitle: start");
53
- let cRef = this;
54
- let imgObj = cRef.props.imgObject;
55
- //console.log("SWSI imgObj: " + JSON.stringify(imgObj));
56
- let fname = imgObj.path; //using path rather than filename since a photo they just took has a null filename value
57
- let ext = "." + fname.split(".").pop(); //file extension, used in callback
58
- //cRef.txtTitle = payload.inputValue + ext;
59
- cRef.txtTitle = payload.inputValue;
60
- let isTitleValid = payload.isValueValid;
61
- if (cRef.props.callback) {
62
- cRef.props.callback({name: 'title', value: cRef.txtTitle + ext, isValid: isTitleValid, imgIndex: cRef.props.imgIndex});
63
- }
64
- //console.log("-----onChangeTitle end: title=" + cRef.txtTitle + "; isTitleValid=" + isTitleValid);
54
+ const titleEditable = useMemo(() => {
55
+ if (defaultName) {
56
+ return defaultOnly === false
65
57
  }
66
- onChangeDesc(payload) {
67
- let cRef = this;
68
- cRef.txtDesc = payload.inputValue;
69
- if (cRef.props.callback) {
70
- cRef.props.callback({name: 'desc', value: cRef.txtDesc, isValid: true, imgIndex: cRef.props.imgIndex});
71
- }
72
- //console.log("-----onChangeDesc end: description=" + cRef.txtDesc);
58
+ return true
59
+ }, [defaultName, defaultOnly])
60
+
61
+ const [title, setTitle] = useState(defaultTitle)
62
+ const [desc, setDesc] = useState(initialDesc)
63
+ const [showCanvas, setShowCanvas] = useState(false)
64
+ const [canvasData, setCanvasData] = useState('')
65
+ const [annotationJson, setAnnotationJson] = useState({ history: [], settings: {} })
66
+ const [filePath, setFilePath] = useState('')
67
+ const [version, setVersion] = useState(1)
68
+ const [showDetailsModal, setShowDetailsModal] = useState(false)
69
+
70
+ const initTitleRef = useRef(defaultTitle)
71
+ const initDescRef = useRef(initialDesc)
72
+
73
+ const fileExtension = useMemo(() => {
74
+ if (!imagePath) {
75
+ return ''
73
76
  }
74
- async onReadyCanvas(path){
75
- Analytics.logEvent('mip_singleImage_annotate', { source_page: 'MultiImagePicker' })
76
- let data = await Api.getApi().getBase64FromLocal(path);
77
- let json = await Api.getApi().getUTF8FromLocal(path+".json");
78
- let origData = await Api.getApi().getBase64FromLocal(path+".orig");
79
- let defaultSettings = await Api.getApi().getCanvasSettings();
80
- if(json=="" || origData==""){
81
- this.setState({showCanvas: true, canvasData: data, annotationJson: {history: [], settings: defaultSettings}, filePath: path});
82
- }else{
83
- this.setState({showCanvas: true, canvasData: origData, annotationJson: JSON.parse(json), filePath: path});
84
- }
77
+ const lastDot = imagePath.lastIndexOf('.')
78
+ if (lastDot === -1) {
79
+ return ''
85
80
  }
86
- async onSaveCanvas(info){
87
- await Api.getApi().writeFile(this.state.filePath+".orig", this.state.canvasData, 'base64');
88
- let printFile = await ImageResizer.createResizedImage(info.fileName, 500, 500, "JPEG", 80, 0);
89
- let savePrintFile = this.state.filePath.replace(/(\.[\w\d_-]+)$/i, '_print$1');
90
- await Api.getApi().moveLocalFile(printFile.uri, savePrintFile, true);
91
- await Api.getApi().moveLocalFile(info.fileName, this.state.filePath, true);
92
- await Api.getApi().writeFile(this.state.filePath+".json", JSON.stringify({history: info.history, settings: info.settings}), 'utf8');
93
- await Api.getApi().setCanvasSettings(info.settings);
94
- this.setState({version: this.state.version+1, showCanvas: false, canvasData: "", filePath: ""});
81
+ return imagePath.substring(lastDot)
82
+ }, [imagePath])
83
+
84
+ const onChangeTitle = useCallback((payload) => {
85
+ // concatenate the title and file extension to make the filename
86
+ // payload expected (json): {inputValue: 'new field value', isValueValid: boolean}
87
+ setTitle(payload.inputValue)
88
+ if (callback) {
89
+ callback({ name: 'title', value: payload.inputValue + fileExtension, isValid: payload.isValueValid, imgIndex })
95
90
  }
96
- onCloseCanvas(){
97
- this.setState({showCanvas: false, canvasData: "", filePath: ""});
91
+ }, [callback, fileExtension, imgIndex])
92
+
93
+ const onChangeDesc = useCallback((payload) => {
94
+ setDesc(payload.inputValue)
95
+ if (callback) {
96
+ callback({ name: 'desc', value: payload.inputValue, isValid: true, imgIndex })
98
97
  }
99
- onDoneEditingInput(field, newValue) {
100
- //capture change in input value, for reporting to analytics
101
- try {
102
- let initValue
103
- let aType
104
- if (field === 'title') {
105
- initValue = this.initTitle
106
- aType = "titleChange"
107
- } else {
108
- initValue = this.initDesc
109
- aType = "descChange"
110
- }
111
-
112
- if (newValue !== initValue) {
113
- //console.log("-----onDoneEditingInput: initValue=" + initValue + "; newValue=" + newValue + "; aType:" + aType);
114
- Analytics.logEvent('mip_singleImage_' + aType, {
115
- source_page: 'MultiImagePicker',
116
- initValue: initValue,
117
- newValue: newValue
118
- })
119
- }
120
- } catch (err) {
121
- console.log("-----onDoneEditingInput: error=" + err)
122
- }
98
+ }, [callback, imgIndex])
99
+
100
+ const onDoneEditingInput = useCallback((field, newValue) => {
101
+ // capture change in input value, for reporting to analytics
102
+ try {
103
+ let initValue
104
+ let aType
105
+ if (field === 'title') {
106
+ initValue = initTitleRef.current
107
+ aType = 'titleChange'
108
+ } else {
109
+ initValue = initDescRef.current
110
+ aType = 'descChange'
111
+ }
112
+
113
+ if (newValue !== initValue) {
114
+ console.log("*** RC: SingleImage onDoneEditingInput: field='" + field + "' changed from '" + initValue + "' to '" + newValue + "'")
115
+ Analytics.logEvent('mip_singleImage_' + aType, {
116
+ source_page: 'MultiImagePicker',
117
+ initValue,
118
+ newValue
119
+ })
120
+ }
121
+ } catch (err) {
122
+ console.log('-----onDoneEditingInput: error=' + err)
123
123
  }
124
+ }, [])
124
125
 
125
- render () {
126
- let cRef = this;
127
- let imgObj = cRef.props.imgObject;
128
- let path = imgObj.path;
129
- let screenWidth = Dimensions.get('window').width;
130
- let imageWidth = (screenWidth < 411) ? (screenWidth * 0.50) : (screenWidth * .20); //less than 411 is xsmall, >= 411 is small and above
131
- let imageHeight = imageWidth;
132
- if (cRef.initialLoad) { //set title value first time loading modal in case they never change it before saving
133
- cRef.initialLoad = false;
134
- cRef.onChangeTitle({inputValue: cRef.txtTitle, isValueValid: true});
135
- }
136
- if(cRef.state.showCanvas){
137
- return (
138
- <Modal presentationStyle={"fullScreen"} animationType={"slide"}>
139
- <SafeAreaView style={styles.Page}>
140
- <Canvas settings={cRef.state.annotationJson.settings} history={cRef.state.annotationJson.history} base64image={'data:image/jpeg;base64,'+cRef.state.canvasData} onSave={cRef.onSaveCanvas} onClose={cRef.onCloseCanvas} />
141
- </SafeAreaView>
142
- </Modal>
143
- );
144
- }else{
145
- return (
146
- <Grid>
147
- <Section style={{paddingTop: 20, marginLeft: 20, marginRight: 20, borderBottomColor: 'lightgrey', borderBottomWidth: 1}}>
148
- <Block xsSize="100%" smSize="25%">
149
- {cRef.props.annotationAllowed ?
150
- <TouchableOpacity onPress={()=>{ cRef.onReadyCanvas(path) }}>
151
- <Image
152
- resizeMode={'cover'}
153
- style={{width: imageWidth, height: imageHeight, marginBottom: 20}}
154
- source={{uri:Api.getApi().fullImagePath(path)+"?x="+cRef.state.version}}
155
- />
156
- </TouchableOpacity>
157
- :
158
- <Image
159
- resizeMode={'cover'}
160
- style={{width: imageWidth, height: imageHeight, marginBottom: 20}}
161
- source={{uri:"file://"+path+"?x="+cRef.state.version}}
162
- />
163
- }
164
- </Block>
165
- <Block xsSize="100%" smSize="75%">
166
- <TextInputSWMD
167
- label={'Title*'} value={cRef.txtTitle} multiline={false} maxLength={255}
168
- validationType={'1'} clearButtonMode={'always'} required={true}
169
- validationFailMsg={'Title contains invalid characters'}
170
- callback={cRef.onChangeTitle}
171
- editable={cRef.txtTitleEditable}
172
- disabled={!cRef.txtTitleEditable}
173
- onEndEditing={(e) => cRef.onDoneEditingInput('title', e.nativeEvent.text)}
174
- />
175
- <TextInputSWMD
176
- label={'Description'} value={cRef.txtDesc} multiline={true} maxLength={500}
177
- validationType={'0'}
178
- callback={cRef.onChangeDesc}
179
- onEndEditing={(e) => cRef.onDoneEditingInput('description', e.nativeEvent.text)}
180
- />
181
- </Block>
182
- </Section>
183
- </Grid>
184
- );
185
- }
126
+ const onReadyCanvas = useCallback(async (path) => {
127
+ Analytics.logEvent('mip_singleImage_annotate', { source_page: 'MultiImagePicker' })
128
+ const data = await Api.getApi().getBase64FromLocal(path)
129
+ const json = await Api.getApi().getUTF8FromLocal(path + '.json')
130
+ const origData = await Api.getApi().getBase64FromLocal(path + '.orig')
131
+ const defaultSettings = await Api.getApi().getCanvasSettings()
132
+ if (json === '' || origData === '') {
133
+ setCanvasData(data)
134
+ setAnnotationJson({ history: [], settings: defaultSettings })
135
+ } else {
136
+ setCanvasData(origData)
137
+ setAnnotationJson(JSON.parse(json))
186
138
  }
187
- }
139
+ setFilePath(path)
140
+ setShowCanvas(true)
141
+ }, [])
188
142
 
189
- let styles = StyleSheet.create({
190
- Page: {
191
- backgroundColor: colors.black,
192
- flex: 1,
143
+ const onSaveCanvas = useCallback(async (info) => {
144
+ if (!filePath) {
145
+ setShowCanvas(false)
146
+ return
193
147
  }
194
- });
148
+ await Api.getApi().writeFile(filePath + '.orig', canvasData, 'base64')
149
+ const printFile = await ImageResizer.createResizedImage(info.fileName, 500, 500, 'JPEG', 80, 0)
150
+ const savePrintFile = filePath.replace(/(\.[\w\d_-]+)$/i, '_print$1')
151
+ await Api.getApi().moveLocalFile(printFile.uri, savePrintFile, true)
152
+ await Api.getApi().moveLocalFile(info.fileName, filePath, true)
153
+ await Api.getApi().writeFile(filePath + '.json', JSON.stringify({ history: info.history, settings: info.settings }), 'utf8')
154
+ await Api.getApi().setCanvasSettings(info.settings)
155
+ setVersion(prev => prev + 1)
156
+ setShowCanvas(false)
157
+ setCanvasData('')
158
+ setFilePath('')
159
+ setAnnotationJson({ history: [], settings: {} })
160
+ }, [canvasData, filePath])
161
+
162
+ const onCloseCanvas = useCallback(() => {
163
+ setShowCanvas(false)
164
+ setCanvasData('')
165
+ setFilePath('')
166
+ setAnnotationJson({ history: [], settings: {} })
167
+ }, [])
168
+
169
+ useEffect(() => {
170
+ // Sync title from filename/defaultName when the base title changes
171
+ // Do not notify parent here to avoid render loops; parent owns filename
172
+ initTitleRef.current = defaultTitle
173
+ setTitle(defaultTitle)
174
+ }, [defaultTitle])
175
+
176
+ useEffect(() => {
177
+ // Sync description from parent (imgDescArr[idx]) when it changes upstream
178
+ initDescRef.current = initialDesc
179
+ setDesc(initialDesc)
180
+ }, [initialDesc])
181
+
182
+ const screenWidth = Dimensions.get('window').width
183
+ // const imageWidth = (screenWidth < 411) ? (screenWidth * 0.50) : (screenWidth * 0.20)
184
+ const imageWidth = (screenWidth < 411) ? (screenWidth * 0.50) : 84 // fixed width for small and above
185
+ // const imageWidth = 84
186
+ // const imageHeight = 112
187
+ // Maintain a fixed aspect ratio where height scales with width
188
+ const imageHeight = Math.round(imageWidth * (112 / 84))
189
+ // define callbacks before any early returns to keep hooks order stable
190
+ const openAnnotate = useCallback(() => { onReadyCanvas(imagePath) }, [imagePath, onReadyCanvas])
191
+ const openDetails = useCallback(() => setShowDetailsModal(true), [])
192
+ const closeDetails = useCallback(() => setShowDetailsModal(false), [])
193
+
194
+ if (showCanvas) {
195
+ return (
196
+ <Modal presentationStyle='fullScreen' animationType='slide'>
197
+ <SafeAreaView style={styles.Page}>
198
+ <Canvas settings={annotationJson.settings} history={annotationJson.history} base64image={'data:image/jpeg;base64,' + canvasData} onSave={onSaveCanvas} onClose={onCloseCanvas} />
199
+ </SafeAreaView>
200
+ </Modal>
201
+ )
202
+ }
203
+
204
+ return (
205
+ <Grid>
206
+ <Section style={styles.Section}>
207
+ <Block xsSize='100%' smSize={92}>
208
+ <TouchableOpacity onPress={() => { if (onOpenMedia) { onOpenMedia(imgIndex) } }}>
209
+ <View style={[styles.ImageContainer, { width: imageWidth, height: imageHeight }]}>
210
+ <Image
211
+ resizeMode='cover'
212
+ style={[styles.Image, { width: '100%', height: '100%' }]}
213
+ source={{ uri: 'file://' + imagePath + '?x=' + version + '-' + (cacheVersion || 0) }}
214
+ />
215
+ <ImageIndicators
216
+ allowShowToCustomer={allowShowToCustomer}
217
+ showToCust={showToCust}
218
+ allowSaveToDevice={allowSaveToDevice}
219
+ saveToDevice={saveToDevice}
220
+ />
221
+ </View>
222
+ </TouchableOpacity>
223
+ </Block>
224
+ <Block xsSize='100%' smSize='stretch'>
225
+ <TouchableOpacity onPress={openDetails} style={styles.TextDetailsContainer}>
226
+ <View>
227
+ <Text style={styles.TitleText} numberOfLines={2}>{title}</Text>
228
+ </View>
229
+ <View>
230
+ {desc && desc.trim().length > 0
231
+ ? <Text style={styles.DescText} numberOfLines={4}>{desc}</Text>
232
+ : <Text style={styles.DescPlaceholder} numberOfLines={1}>Add a description...</Text>}
233
+ </View>
234
+ </TouchableOpacity>
235
+ </Block>
236
+ <Block xsSize='100%'>
237
+ <ActionBar
238
+ onPressTrash={onDelete}
239
+ trashDisabled={!!disableDelete}
240
+ onPressDetails={openDetails}
241
+ allowSaveToDevice={allowSaveToDevice}
242
+ saveToDevice={saveToDevice}
243
+ onToggleSaveToDevice={onToggleSaveToDevice}
244
+ annotationAllowed={annotationAllowed}
245
+ onAnnotate={openAnnotate}
246
+ allowShowToCustomer={allowShowToCustomer}
247
+ showToCust={showToCust}
248
+ onToggleShowToCust={onToggleShowToCust}
249
+ />
250
+ </Block>
251
+ </Section>
252
+
253
+ <ImageDetailsModal
254
+ visible={showDetailsModal}
255
+ onClose={closeDetails}
256
+ imageUri={'file://' + imagePath + '?x=' + version + '-' + (cacheVersion || 0)}
257
+ initialTitle={title}
258
+ initialDesc={desc}
259
+ titleEditable={titleEditable}
260
+ onSubmit={({ title: t, desc: d, isTitleValid }) => {
261
+ onChangeTitle({ inputValue: t, isValueValid: isTitleValid })
262
+ onDoneEditingInput('title', t)
263
+ onChangeDesc({ inputValue: d })
264
+ onDoneEditingInput('description', d)
265
+ closeDetails()
266
+ }}
267
+ />
268
+ </Grid>
269
+ )
270
+ }
271
+
272
+ const styles = StyleSheet.create({
273
+ Page: {
274
+ backgroundColor: colors.black,
275
+ flex: 1
276
+ },
277
+ Section: {
278
+ backgroundColor: colors.white,
279
+ borderRadius: 20,
280
+ marginTop: 8,
281
+ marginLeft: 16,
282
+ marginRight: 16,
283
+ padding: 8
284
+ },
285
+ Image: {
286
+ marginBottom: 20,
287
+ borderRadius: 12
288
+ },
289
+ ImageContainer: {
290
+ position: 'relative',
291
+ borderRadius: 12,
292
+ overflow: 'hidden'
293
+ },
294
+ ImageOverlayPill: {
295
+ position: 'absolute',
296
+ left: 4,
297
+ bottom: 4,
298
+ width: 50,
299
+ height: 24,
300
+ borderRadius: 12,
301
+ flexDirection: 'row',
302
+ alignItems: 'center',
303
+ justifyContent: 'space-between'
304
+ },
305
+ OverlayIconCircle: {
306
+ width: 24,
307
+ height: 24,
308
+ borderRadius: 12,
309
+ alignItems: 'center',
310
+ justifyContent: 'center'
311
+ },
312
+ OverlayIconCircleEye: {
313
+ backgroundColor: colors.emphasisMedium
314
+ },
315
+ TextDetailsContainer: {
316
+ marginLeft: 8,
317
+ marginRight: 8,
318
+ paddingTop: 4,
319
+ paddingBottom: 8
320
+ },
321
+ TitleText: {
322
+ ...stdStyles.S2,
323
+ marginBottom: 1
324
+ },
325
+ DescText: {
326
+ ...stdStyles.Body2
327
+ },
328
+ DescPlaceholder: {
329
+ fontSize: 14,
330
+ color: colors.black60
331
+ }
332
+ })
195
333
 
196
- export default SingleImage;
334
+ export default SingleImage
@@ -0,0 +1,105 @@
1
+ import React, { useCallback, useState } from 'react'
2
+ import { Modal, View, StyleSheet, Text } from 'react-native'
3
+ import { colors, stdStyles } from '@supportworks/app-styler'
4
+ import { CheckBox, CommonButton } from '@supportworks/core-controls'
5
+ import { Icons } from '@supportworks/icon-library'
6
+
7
+ const UploadWarningModal = (
8
+ {
9
+ visible = false,
10
+ onClose = null
11
+ }) => {
12
+ const [skipInfoDialog, setSkipInfoDialog] = useState(false)
13
+
14
+ const handleClose = useCallback(() => {
15
+ if (onClose) onClose(skipInfoDialog)
16
+ }, [onClose, skipInfoDialog])
17
+
18
+ return (
19
+ <Modal
20
+ animationType='fade'
21
+ transparent
22
+ visible={visible}
23
+ onRequestClose={handleClose}
24
+ >
25
+ <View style={styles.ModalView}>
26
+ <View style={styles.InfoDialogContent}>
27
+ <View style={styles.InfoDialogIconRow}>
28
+ <Icons.IconPencilLock fill={colors.brandPrimary} fillOpacity={1} />
29
+ </View>
30
+ <View style={styles.InfoDialogTitleRow}>
31
+ <Text style={styles.TitleText}>
32
+ Captions can't be updated in CRM after upload
33
+ </Text>
34
+ </View>
35
+ <Text style={stdStyles.Body2}>
36
+ Photo captions can be edited now, but not after submitting to the CRM. Please review before uploading.
37
+ </Text>
38
+ <View style={styles.InfoDialogCheckboxRow}>
39
+ <CheckBox
40
+ label="Don't show this message again"
41
+ checked={!!skipInfoDialog}
42
+ onChange={(newVal) => setSkipInfoDialog(newVal)}
43
+ />
44
+ </View>
45
+ <View style={styles.InfoDialogButtonRow}>
46
+ <CommonButton
47
+ variant='filled'
48
+ size='medium'
49
+ label='Got it'
50
+ fullWidth
51
+ onPress={handleClose}
52
+ />
53
+ </View>
54
+ </View>
55
+ </View>
56
+ </Modal>
57
+ )
58
+ }
59
+
60
+ const styles = StyleSheet.create({
61
+ ModalView: {
62
+ flex: 1,
63
+ justifyContent: 'center',
64
+ alignItems: 'center'
65
+ },
66
+ InfoDialogContent: {
67
+ backgroundColor: 'white',
68
+ borderRadius: 28,
69
+ paddingHorizontal: 24,
70
+ paddingBottom: 16,
71
+ shadowColor: 'rgba(0,0,0,0.14)',
72
+ shadowOpacity: 1,
73
+ shadowRadius: 38,
74
+ shadowOffset: {
75
+ width: 1,
76
+ height: 4
77
+ },
78
+ elevation: 8,
79
+ maxWidth: '80%',
80
+ width: 334
81
+ },
82
+ InfoDialogIconRow: {
83
+ alignItems: 'center',
84
+ justifyContent: 'center',
85
+ marginVertical: 24
86
+ },
87
+ InfoDialogTitleRow: {
88
+ marginBottom: 16
89
+ },
90
+ TitleText: {
91
+ ...stdStyles.H5,
92
+ textAlign: 'center'
93
+ },
94
+ InfoDialogCheckboxRow: {
95
+ height: 48,
96
+ marginTop: 24,
97
+ justifyContent: 'center'
98
+ },
99
+ InfoDialogButtonRow: {
100
+ marginVertical: 8,
101
+ alignItems: 'flex-end'
102
+ }
103
+ })
104
+
105
+ export default UploadWarningModal
@@ -1,12 +1,12 @@
1
- import { DeviceEventEmitter } from 'react-native';
1
+ import { DeviceEventEmitter } from 'react-native'
2
2
 
3
3
  const loaderHandler = {
4
4
  hideLoader () {
5
- DeviceEventEmitter.emit('changeLoadingEffect', {isVisible: false});
5
+ DeviceEventEmitter.emit('changeLoadingEffect', { isVisible: false })
6
6
  },
7
7
  showLoader (title) {
8
- DeviceEventEmitter.emit('changeLoadingEffect', {title, isVisible: true});
8
+ DeviceEventEmitter.emit('changeLoadingEffect', { title, isVisible: true })
9
9
  }
10
- };
10
+ }
11
11
 
12
- module.exports = loaderHandler;
12
+ module.exports = loaderHandler