@jescon-technologies/react-native-ui-kit 0.0.1 → 0.0.2
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/index.js +70 -0
- package/package.json +26 -3
- package/src/Alerts/AAlert.js +1 -1
- package/src/HOC/ConfirmOverlay.js +192 -0
- package/src/HOC/HAbsolute.js +56 -0
- package/src/HOC/HDiscontinue.js +105 -0
- package/src/HOC/HHeading.js +70 -0
- package/src/HOC/HMoreButton.js +88 -0
- package/src/HOC/HNatureHeading.js +402 -0
- package/src/HOC/HOCIcons.js +80 -0
- package/src/HOC/HOverlay.js +99 -0
- package/src/HOC/HOverlayCentered.js +140 -0
- package/src/HOC/HShadowButton.js +45 -0
- package/src/HOC/HShadowCountButton.js +82 -0
- package/src/HOC/OptionOverlay.js +48 -0
- package/src/Media/AudioScreen.js +347 -0
- package/src/Media/BarcodeScan.js +145 -0
- package/src/Media/CAudioPlay.js +228 -0
- package/src/Media/CCaptureImageWithoutEdit.js +330 -0
- package/src/Media/CImageGallery.js +289 -0
- package/src/Media/CImageZoom.js +82 -0
- package/src/Media/CSingleImage.js +391 -0
- package/src/Media/CSketchCanvas.js +76 -0
- package/src/Media/CVideoPlay.js +31 -0
- package/src/Media/DocumentScreen.js +367 -0
- package/src/Media/DrawingScreen.js +582 -0
- package/src/Media/ImageScreen.js +313 -0
- package/src/Media/RecordAudio.js +250 -0
- package/src/Media/RecordVideo.js +223 -0
- package/src/Media/VideoScreen.js +383 -0
- package/src/StaticComponents/SAlphabet.js +47 -0
- package/src/StaticComponents/SCheckBox.js +42 -0
- package/src/StaticComponents/SDatePicker.js +208 -0
- package/src/StaticComponents/SDatePickerLabel.js +253 -0
- package/src/StaticComponents/SDatePickerNew.js +258 -0
- package/src/StaticComponents/SDateTimePickerNew.js +381 -0
- package/src/StaticComponents/SDropDownGenerate.js +450 -0
- package/src/StaticComponents/SDropDownHoc.js +636 -0
- package/src/StaticComponents/SDropDownIcon.js +500 -0
- package/src/StaticComponents/SMenuBox.js +131 -0
- package/src/StaticComponents/SOverlay.js +177 -0
- package/src/StaticComponents/SOverlayTextInput.js +109 -0
- package/src/StaticComponents/SSearch.js +438 -0
- package/src/StaticComponents/SSearchBar.js +53 -0
- package/src/StaticComponents/SSpeedDial.js +303 -0
- package/src/StaticComponents/STextInput.js +289 -0
- package/src/StaticComponents/STextInputProps.js +36 -0
- package/src/StaticComponents/STimePicker.js +171 -0
- package/src/StaticComponents/STimingDropDownNew.js +1589 -0
- package/src/StaticComponents/STimingSwitch.js +34 -0
- package/src/layout/CContainerView.js +21 -0
- package/src/layout/CDetailView.js +81 -0
- package/src/layout/FooterBlock.js +0 -3
- package/src/layout/HeaderBlock.js +353 -0
- package/src/index.js +0 -15
- package/src/screens/ForgotPassword.js +0 -346
- package/src/screens/Login.js +0 -328
- package/src/screens/Splash.js +0 -788
- /package/src/{components → layout}/Loader.js +0 -0
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
import React, {useState, useEffect, memo, useContext} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
FlatList,
|
|
6
|
+
Dimensions,
|
|
7
|
+
Text,
|
|
8
|
+
View,
|
|
9
|
+
TouchableOpacity,
|
|
10
|
+
ImageBackground,
|
|
11
|
+
ActivityIndicator,
|
|
12
|
+
PermissionsAndroid,
|
|
13
|
+
Platform,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import Fontisto from 'react-native-vector-icons/Fontisto';
|
|
16
|
+
import CImageZoom from '../Media/CImageZoom';
|
|
17
|
+
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
18
|
+
import {APIURL, imageURL, drawingURL} from '../Common/apiConstants';
|
|
19
|
+
// import DocumentPicker from 'react-native-document-picker';
|
|
20
|
+
import ComponentStyles, {normalize} from '../CommonStyle/componentStyle';
|
|
21
|
+
import { useNavigation } from '../Navigation/useNavigation';
|
|
22
|
+
|
|
23
|
+
import {notifyMessage} from '../CommonStyle/ComponentFunctions';
|
|
24
|
+
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
25
|
+
import RNSketchCanvas from '@terrylinla/react-native-sketch-canvas';
|
|
26
|
+
import EmrResponseComponentContext from '../Handlers/emrResponseComponentContext';
|
|
27
|
+
import {Global} from '../Common/Global';
|
|
28
|
+
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
29
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
30
|
+
|
|
31
|
+
/*---------------------------------------------------------------------------------------*/
|
|
32
|
+
function DrawingScreen(props) {
|
|
33
|
+
const {responseJSON, setResponseJSON} = useContext(
|
|
34
|
+
EmrResponseComponentContext,
|
|
35
|
+
);
|
|
36
|
+
const navigation = useNavigation();
|
|
37
|
+
const windowWidth = Dimensions.get('window').width;
|
|
38
|
+
const windowHeight = Dimensions.get('window').height;
|
|
39
|
+
const [data, setData] = useState(
|
|
40
|
+
props.data.saveddoc ? props.data.saveddoc : null,
|
|
41
|
+
);
|
|
42
|
+
console.log('props.data.saveddoc', JSON.stringify(data));
|
|
43
|
+
const [isImageShow, setImageShow] = useState(false);
|
|
44
|
+
const [mediaUrlLink, setMediaUrlLink] = useState(false);
|
|
45
|
+
const [refreshCount, setrefreshCount] = useState(1);
|
|
46
|
+
const [deleteImage, setDeleteImage] = useState(false);
|
|
47
|
+
const [loading, setLoading] = useState(false);
|
|
48
|
+
const [drawview, setDrawView] = useState(false);
|
|
49
|
+
const [process, setProcess] = useState('');
|
|
50
|
+
const [disablesave, setDisablesave] = useState(true);
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
props.setData(data);
|
|
54
|
+
}, [data]);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
setrefreshCount(refreshCount + 1);
|
|
59
|
+
}, 2000);
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
const SaveDrawing = async (success, pathk) => {
|
|
63
|
+
setDrawView(false);
|
|
64
|
+
console.log('Save drawing function called');
|
|
65
|
+
|
|
66
|
+
if (await isPermitted()) {
|
|
67
|
+
try {
|
|
68
|
+
var pathname = pathk;
|
|
69
|
+
var NewPathName = pathname.slice(-12);
|
|
70
|
+
console.log('newpathname', NewPathName);
|
|
71
|
+
|
|
72
|
+
const {relativePath, fileName, path} = await getResolvedPath(
|
|
73
|
+
pathk,
|
|
74
|
+
NewPathName,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
console.log('path', path);
|
|
78
|
+
let fileid_autogenerate =
|
|
79
|
+
data != null && data.length > 0 ? data.length : 0;
|
|
80
|
+
let dataset = {
|
|
81
|
+
fileid: fileid_autogenerate + 1,
|
|
82
|
+
uri: 'file://' + path,
|
|
83
|
+
filename: NewPathName + Date(),
|
|
84
|
+
uritype: false,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
setLoading(false);
|
|
88
|
+
Media_Upload(dataset);
|
|
89
|
+
|
|
90
|
+
} catch (error) {
|
|
91
|
+
notifyMessage(
|
|
92
|
+
DocumentPicker.isCancel(error)
|
|
93
|
+
? 'Canceled'
|
|
94
|
+
: 'Unknown Error: ' + JSON.stringify(error),
|
|
95
|
+
2,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/*---------------------------------------------------------------------------------------*/
|
|
102
|
+
const isPermitted = async () => {
|
|
103
|
+
if (Platform.OS === 'android') {
|
|
104
|
+
try {
|
|
105
|
+
const granted = await PermissionsAndroid.request(
|
|
106
|
+
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
|
107
|
+
);
|
|
108
|
+
return granted === PermissionsAndroid.RESULTS.GRANTED;
|
|
109
|
+
} catch (err) {
|
|
110
|
+
alert('Write permission error', err);
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
/*---------------------------------------------------------------------------------------*/
|
|
118
|
+
function deleteSelectedImage() {
|
|
119
|
+
data
|
|
120
|
+
.filter(item => item.deletestatus === true)
|
|
121
|
+
.forEach(item => data.splice(data.indexOf(item), 1));
|
|
122
|
+
setDeleteImage(!deleteImage);
|
|
123
|
+
setrefreshCount(refreshCount + 1);
|
|
124
|
+
}
|
|
125
|
+
/*---------------------------------------------------------------------------------------*/
|
|
126
|
+
function ImageZoom(data) {
|
|
127
|
+
data.item.uritype
|
|
128
|
+
? setMediaUrlLink(data.item.uri)
|
|
129
|
+
: setMediaUrlLink(data.item.uri);
|
|
130
|
+
setImageShow(true);
|
|
131
|
+
}
|
|
132
|
+
/*---------------------------------------------------------------------------------------*/
|
|
133
|
+
function changeStatus(data) {
|
|
134
|
+
data.item.deletestatus = !data.item.deletestatus;
|
|
135
|
+
setrefreshCount(refreshCount + 1);
|
|
136
|
+
}
|
|
137
|
+
/*---------------------------------------------------------------------------------------*/
|
|
138
|
+
function renderImage(renderdata) {
|
|
139
|
+
return (
|
|
140
|
+
<View>
|
|
141
|
+
{renderdata.item.filename ? (
|
|
142
|
+
<TouchableOpacity
|
|
143
|
+
style={{
|
|
144
|
+
height: windowHeight * 0.15,
|
|
145
|
+
width: windowWidth * 0.3,
|
|
146
|
+
margin: 5,
|
|
147
|
+
backgroundColor: '#e1e4e8',
|
|
148
|
+
borderRadius: 5,
|
|
149
|
+
}}
|
|
150
|
+
onPress={() =>
|
|
151
|
+
navigation.navigate('CImageGallery', {
|
|
152
|
+
savedimages: data,
|
|
153
|
+
index: renderdata.index,
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
onLongPress={() => setDeleteImage(true)}>
|
|
157
|
+
<Image
|
|
158
|
+
style={{
|
|
159
|
+
width: '100%',
|
|
160
|
+
height: '100%',
|
|
161
|
+
borderRadius: normalize(10),
|
|
162
|
+
}}
|
|
163
|
+
source={{
|
|
164
|
+
uri: imageURL + renderdata.item.filename,
|
|
165
|
+
}}
|
|
166
|
+
/>
|
|
167
|
+
</TouchableOpacity>
|
|
168
|
+
) : null}
|
|
169
|
+
{isImageShow ? (
|
|
170
|
+
<CImageZoom
|
|
171
|
+
image={mediaUrlLink}
|
|
172
|
+
navigation={navigation}
|
|
173
|
+
visibility={val => (val == undefined ? null : setImageShow(val))}
|
|
174
|
+
mediaupload={Media_Upload}
|
|
175
|
+
/>
|
|
176
|
+
) : null}
|
|
177
|
+
{deleteImage ? (
|
|
178
|
+
<TouchableOpacity onPress={() => changeStatus(renderdata)}>
|
|
179
|
+
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
|
180
|
+
<Fontisto
|
|
181
|
+
name={
|
|
182
|
+
!renderdata.item.deletestatus
|
|
183
|
+
? 'checkbox-passive'
|
|
184
|
+
: 'checkbox-active'
|
|
185
|
+
}
|
|
186
|
+
size={25}
|
|
187
|
+
color={!renderdata.item.deletestatus ? 'lightgrey' : 'blue'}
|
|
188
|
+
/>
|
|
189
|
+
</View>
|
|
190
|
+
</TouchableOpacity>
|
|
191
|
+
) : null}
|
|
192
|
+
</View>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
/*---------------------------------------------------------------------------------------*/
|
|
196
|
+
const getResolvedPath = async (uri, filen) => {
|
|
197
|
+
console.log('getResolvedPath', uri, filen);
|
|
198
|
+
const fileBase64 = await ReactNativeBlobUtil.fs.readFile(uri, 'base64');
|
|
199
|
+
const relativePath = ReactNativeBlobUtil.fs.dirs.CacheDir;
|
|
200
|
+
const fileName = `${filen}`;
|
|
201
|
+
const path = `${relativePath}/${fileName}`;
|
|
202
|
+
|
|
203
|
+
await ReactNativeBlobUtil.fs.writeFile(path, fileBase64, 'base64');
|
|
204
|
+
return {relativePath, fileName, path};
|
|
205
|
+
};
|
|
206
|
+
/*---------------------------------------------------------------------------------------*/
|
|
207
|
+
|
|
208
|
+
const startDrawing = () => {
|
|
209
|
+
setDrawView(true);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const browseFromDevice = async () => {
|
|
213
|
+
if (await isPermitted()) {
|
|
214
|
+
try {
|
|
215
|
+
setLoading(true);
|
|
216
|
+
const fileDetails = await DocumentPicker.pick({
|
|
217
|
+
type: [DocumentPicker.types.images],
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const {relativePath, fileName, path} = await getResolvedPath(
|
|
221
|
+
fileDetails[0].uri,
|
|
222
|
+
fileDetails[0].name,
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
let fileid_autogenerate =
|
|
226
|
+
data != null && data.length > 0 ? data.length : 0;
|
|
227
|
+
let dataset = {
|
|
228
|
+
fileid: fileid_autogenerate + 1,
|
|
229
|
+
uri: 'file://' + path,
|
|
230
|
+
filename: fileDetails[0].name + Date(),
|
|
231
|
+
uritype: false,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
setLoading(false);
|
|
235
|
+
Media_Upload(dataset);
|
|
236
|
+
|
|
237
|
+
} catch (error) {
|
|
238
|
+
notifyMessage(
|
|
239
|
+
DocumentPicker.isCancel(error)
|
|
240
|
+
? 'Canceled'
|
|
241
|
+
: 'Unknown Error: ' + JSON.stringify(error),
|
|
242
|
+
2,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
async function Media_Upload(image) {
|
|
249
|
+
console.log('imageeeeeeeeeee upload', JSON.stringify(image));
|
|
250
|
+
let date = new Date().getDate();
|
|
251
|
+
let month = new Date().getMonth() + 1;
|
|
252
|
+
let year = new Date().getFullYear();
|
|
253
|
+
let hours = new Date().getHours();
|
|
254
|
+
let min = new Date().getMinutes();
|
|
255
|
+
let sec = new Date().getSeconds();
|
|
256
|
+
let millisec = new Date().getMilliseconds();
|
|
257
|
+
let uniquename = `${millisec}` + '.png';
|
|
258
|
+
|
|
259
|
+
let fileid_autogenerate = data != null && data.length > 0 ? data.length : 0;
|
|
260
|
+
let dataset2 = {
|
|
261
|
+
fileid: fileid_autogenerate + 1,
|
|
262
|
+
filename: uniquename,
|
|
263
|
+
filetype: image.filetype,
|
|
264
|
+
uri: image.uri,
|
|
265
|
+
uritype: false,
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
if (!dataset2.uritype) {
|
|
269
|
+
if (dataset2.uri) {
|
|
270
|
+
var formData = new FormData();
|
|
271
|
+
formData.append('file', {
|
|
272
|
+
uri: dataset2.uri,
|
|
273
|
+
type: 'image/png',
|
|
274
|
+
name: dataset2.filename,
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
console.log('formData>>>>>>>>>>>>>', JSON.stringify(formData));
|
|
278
|
+
|
|
279
|
+
// Replace NetworkServiceCall with your actual API call
|
|
280
|
+
// NetworkServiceCall(
|
|
281
|
+
// 'multiform',
|
|
282
|
+
// APIURL + 'file/fileupload/emr/image',
|
|
283
|
+
// formData,
|
|
284
|
+
// )
|
|
285
|
+
// .then(function (responsedata) {
|
|
286
|
+
// console.log('responsedata>>>>>>>>>>>>>>>', JSON.stringify(responsedata));
|
|
287
|
+
// if (responsedata.httpstatus == 200) {
|
|
288
|
+
// dataset2.filename = responsedata.data.fileuri;
|
|
289
|
+
// setData(
|
|
290
|
+
// data != null
|
|
291
|
+
// ? prevData => [...prevData, dataset2.filename]
|
|
292
|
+
// : [dataset2.filename],
|
|
293
|
+
// );
|
|
294
|
+
// responseJSON.consultationEdit.editStatus = true;
|
|
295
|
+
// setrefreshCount(refreshCount + 1);
|
|
296
|
+
// props.editStatus(1);
|
|
297
|
+
// props.data.usertype =
|
|
298
|
+
// Global.PatientDetails != undefined &&
|
|
299
|
+
// Global.PatientDetails.usertype != undefined &&
|
|
300
|
+
// Global.PatientDetails.usertype != null
|
|
301
|
+
// ? Global.PatientDetails.usertype
|
|
302
|
+
// : 'Z';
|
|
303
|
+
// props.data.suuser =
|
|
304
|
+
// Global.userData != undefined &&
|
|
305
|
+
// Global.userData.suuser != undefined &&
|
|
306
|
+
// Global.userData.suuser != null
|
|
307
|
+
// ? Global.userData.suuser
|
|
308
|
+
// : 0;
|
|
309
|
+
// setLoading(false);
|
|
310
|
+
// } else {
|
|
311
|
+
// setLoading(false);
|
|
312
|
+
// }
|
|
313
|
+
// })
|
|
314
|
+
// .catch(error => {
|
|
315
|
+
// console.log('errorrrrrrrrrr', JSON.stringify(error));
|
|
316
|
+
// setLoading(false);
|
|
317
|
+
// });
|
|
318
|
+
|
|
319
|
+
// For now, just add to local state
|
|
320
|
+
setData(
|
|
321
|
+
data != null
|
|
322
|
+
? [...data, dataset2]
|
|
323
|
+
: [dataset2],
|
|
324
|
+
);
|
|
325
|
+
setrefreshCount(refreshCount + 1);
|
|
326
|
+
setLoading(false);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return (
|
|
332
|
+
<View style={{flex: 1}}>
|
|
333
|
+
<View style={styles.itemContainer}>
|
|
334
|
+
{/* Delete Button */}
|
|
335
|
+
{deleteImage && (
|
|
336
|
+
<TouchableOpacity
|
|
337
|
+
style={styles.deleteButton}
|
|
338
|
+
onPress={deleteSelectedImage}>
|
|
339
|
+
<AntDesign name="delete" size={30} color={'red'} />
|
|
340
|
+
<Text style={styles.deleteText}>Delete Selected</Text>
|
|
341
|
+
</TouchableOpacity>
|
|
342
|
+
)}
|
|
343
|
+
|
|
344
|
+
{/* Images Grid */}
|
|
345
|
+
{!drawview && (
|
|
346
|
+
<FlatList
|
|
347
|
+
data={data}
|
|
348
|
+
contentContainerStyle={{alignItems: 'center', marginTop: 10}}
|
|
349
|
+
renderItem={renderImage}
|
|
350
|
+
keyExtractor={item => item.fileid}
|
|
351
|
+
numColumns={3}
|
|
352
|
+
/>
|
|
353
|
+
)}
|
|
354
|
+
|
|
355
|
+
{/* Drawing Canvas */}
|
|
356
|
+
{drawview && (
|
|
357
|
+
<View style={styles.container}>
|
|
358
|
+
<View style={{flex: 1, flexDirection: 'row'}}>
|
|
359
|
+
<RNSketchCanvas
|
|
360
|
+
containerStyle={{backgroundColor: 'transparent', flex: 1}}
|
|
361
|
+
canvasStyle={{backgroundColor: 'transparent', flex: 1}}
|
|
362
|
+
defaultStrokeIndex={0}
|
|
363
|
+
defaultStrokeWidth={5}
|
|
364
|
+
closeComponent={
|
|
365
|
+
<View style={styles.functionButton}>
|
|
366
|
+
<Text style={{color: 'white'}}>Close</Text>
|
|
367
|
+
</View>
|
|
368
|
+
}
|
|
369
|
+
onClosePressed={() => {
|
|
370
|
+
setDrawView(false);
|
|
371
|
+
}}
|
|
372
|
+
undoComponent={
|
|
373
|
+
<View style={styles.functionButton}>
|
|
374
|
+
<Text style={{color: 'white'}}>Undo</Text>
|
|
375
|
+
</View>
|
|
376
|
+
}
|
|
377
|
+
clearComponent={
|
|
378
|
+
<View style={styles.functionButton}>
|
|
379
|
+
<Text style={{color: 'white'}}>Clear</Text>
|
|
380
|
+
</View>
|
|
381
|
+
}
|
|
382
|
+
eraseComponent={
|
|
383
|
+
<View style={styles.functionButton}>
|
|
384
|
+
<Text style={{color: 'white'}}>Eraser</Text>
|
|
385
|
+
</View>
|
|
386
|
+
}
|
|
387
|
+
strokeComponent={color => (
|
|
388
|
+
<View
|
|
389
|
+
style={[{backgroundColor: color}, styles.strokeColorButton]}
|
|
390
|
+
/>
|
|
391
|
+
)}
|
|
392
|
+
strokeSelectedComponent={(color, index, changed) => {
|
|
393
|
+
return (
|
|
394
|
+
<View
|
|
395
|
+
style={[
|
|
396
|
+
{backgroundColor: color, borderWidth: 2},
|
|
397
|
+
styles.strokeColorButton,
|
|
398
|
+
]}
|
|
399
|
+
/>
|
|
400
|
+
);
|
|
401
|
+
}}
|
|
402
|
+
strokeWidthComponent={w => {
|
|
403
|
+
return (
|
|
404
|
+
<View style={styles.strokeWidthButton}>
|
|
405
|
+
<View
|
|
406
|
+
style={{
|
|
407
|
+
backgroundColor: 'white',
|
|
408
|
+
marginHorizontal: 2.5,
|
|
409
|
+
width: Math.sqrt(w / 3) * 10,
|
|
410
|
+
height: Math.sqrt(w / 3) * 10,
|
|
411
|
+
borderRadius: (Math.sqrt(w / 3) * 10) / 2,
|
|
412
|
+
}}
|
|
413
|
+
/>
|
|
414
|
+
</View>
|
|
415
|
+
);
|
|
416
|
+
}}
|
|
417
|
+
saveComponent={
|
|
418
|
+
<View style={styles.functionButton}>
|
|
419
|
+
<Text style={{color: 'white'}}>Save</Text>
|
|
420
|
+
</View>
|
|
421
|
+
}
|
|
422
|
+
savePreference={() => {
|
|
423
|
+
return {
|
|
424
|
+
folder: ReactNativeBlobUtil.fs.dirs.CacheDir,
|
|
425
|
+
filename: String(Math.ceil(Math.random() * 100000000)),
|
|
426
|
+
transparent: false,
|
|
427
|
+
imageType: 'png',
|
|
428
|
+
};
|
|
429
|
+
}}
|
|
430
|
+
onSketchSaved={(success, pathk) => {
|
|
431
|
+
SaveDrawing(success, pathk);
|
|
432
|
+
console.log('success,path', success, pathk);
|
|
433
|
+
}}
|
|
434
|
+
onPathsChange={pathsCount => {
|
|
435
|
+
console.log('pathsCount', pathsCount);
|
|
436
|
+
}}
|
|
437
|
+
permissionDialogTitle={'PERMISSION'}
|
|
438
|
+
permissionDialogMessage={'App needs access to Storage data'}
|
|
439
|
+
/>
|
|
440
|
+
</View>
|
|
441
|
+
</View>
|
|
442
|
+
)}
|
|
443
|
+
|
|
444
|
+
{/* Loading Indicator */}
|
|
445
|
+
{loading && (
|
|
446
|
+
<View style={styles.loadingContainer}>
|
|
447
|
+
<ActivityIndicator size="large" color="#0000ff" />
|
|
448
|
+
</View>
|
|
449
|
+
)}
|
|
450
|
+
</View>
|
|
451
|
+
|
|
452
|
+
{/* Bottom Action Bar */}
|
|
453
|
+
{!drawview && (
|
|
454
|
+
<View style={styles.bottomActionBar}>
|
|
455
|
+
<TouchableOpacity
|
|
456
|
+
style={styles.actionButton}
|
|
457
|
+
onPress={startDrawing}>
|
|
458
|
+
<MaterialIcons name="edit" color={'white'} size={normalize(24)} />
|
|
459
|
+
<Text style={styles.actionButtonText}>Draw</Text>
|
|
460
|
+
</TouchableOpacity>
|
|
461
|
+
|
|
462
|
+
<TouchableOpacity
|
|
463
|
+
style={styles.actionButton}
|
|
464
|
+
onPress={browseFromDevice}>
|
|
465
|
+
<MaterialIcons name="insert-photo" color={'white'} size={normalize(24)} />
|
|
466
|
+
<Text style={styles.actionButtonText}>Browse</Text>
|
|
467
|
+
</TouchableOpacity>
|
|
468
|
+
|
|
469
|
+
<TouchableOpacity
|
|
470
|
+
style={styles.actionButton}
|
|
471
|
+
onPress={() => {
|
|
472
|
+
// Add camera functionality here
|
|
473
|
+
// CaptureImage();
|
|
474
|
+
}}>
|
|
475
|
+
<FontAwesome name="camera" color={'white'} size={normalize(24)} />
|
|
476
|
+
<Text style={styles.actionButtonText}>Camera</Text>
|
|
477
|
+
</TouchableOpacity>
|
|
478
|
+
|
|
479
|
+
<TouchableOpacity
|
|
480
|
+
style={[styles.actionButton, disablesave && styles.disabledButton]}
|
|
481
|
+
disabled={disablesave}
|
|
482
|
+
onPress={() => {
|
|
483
|
+
// Save functionality
|
|
484
|
+
// firebaseimagesave();
|
|
485
|
+
}}>
|
|
486
|
+
<FontAwesome name="save" color={'white'} size={normalize(24)} />
|
|
487
|
+
<Text style={styles.actionButtonText}>Save</Text>
|
|
488
|
+
</TouchableOpacity>
|
|
489
|
+
</View>
|
|
490
|
+
)}
|
|
491
|
+
</View>
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
/*---------------------------------------------------------------------------------------*/
|
|
495
|
+
const styles = StyleSheet.create({
|
|
496
|
+
itemContainer: {
|
|
497
|
+
flex: 1,
|
|
498
|
+
backgroundColor: 'transparent',
|
|
499
|
+
},
|
|
500
|
+
container: {
|
|
501
|
+
flex: 1,
|
|
502
|
+
justifyContent: 'center',
|
|
503
|
+
alignItems: 'center',
|
|
504
|
+
backgroundColor: '#F5FCFF',
|
|
505
|
+
},
|
|
506
|
+
strokeColorButton: {
|
|
507
|
+
marginHorizontal: 2.5,
|
|
508
|
+
marginVertical: 8,
|
|
509
|
+
width: 30,
|
|
510
|
+
height: 30,
|
|
511
|
+
borderRadius: 15,
|
|
512
|
+
},
|
|
513
|
+
strokeWidthButton: {
|
|
514
|
+
marginHorizontal: 2.5,
|
|
515
|
+
marginVertical: 8,
|
|
516
|
+
width: 30,
|
|
517
|
+
height: 30,
|
|
518
|
+
borderRadius: 15,
|
|
519
|
+
justifyContent: 'center',
|
|
520
|
+
alignItems: 'center',
|
|
521
|
+
backgroundColor: '#39579A',
|
|
522
|
+
},
|
|
523
|
+
functionButton: {
|
|
524
|
+
marginHorizontal: 2.5,
|
|
525
|
+
marginVertical: 8,
|
|
526
|
+
height: 30,
|
|
527
|
+
width: 60,
|
|
528
|
+
backgroundColor: '#39579A',
|
|
529
|
+
justifyContent: 'center',
|
|
530
|
+
alignItems: 'center',
|
|
531
|
+
borderRadius: 5,
|
|
532
|
+
},
|
|
533
|
+
deleteButton: {
|
|
534
|
+
flexDirection: 'row',
|
|
535
|
+
alignItems: 'center',
|
|
536
|
+
justifyContent: 'center',
|
|
537
|
+
padding: 10,
|
|
538
|
+
backgroundColor: '#ffebee',
|
|
539
|
+
marginHorizontal: 10,
|
|
540
|
+
borderRadius: 5,
|
|
541
|
+
marginTop: 10,
|
|
542
|
+
},
|
|
543
|
+
deleteText: {
|
|
544
|
+
marginLeft: 10,
|
|
545
|
+
color: 'red',
|
|
546
|
+
fontSize: 16,
|
|
547
|
+
fontWeight: 'bold',
|
|
548
|
+
},
|
|
549
|
+
loadingContainer: {
|
|
550
|
+
position: 'absolute',
|
|
551
|
+
top: 0,
|
|
552
|
+
left: 0,
|
|
553
|
+
right: 0,
|
|
554
|
+
bottom: 0,
|
|
555
|
+
justifyContent: 'center',
|
|
556
|
+
alignItems: 'center',
|
|
557
|
+
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
|
558
|
+
},
|
|
559
|
+
bottomActionBar: {
|
|
560
|
+
flexDirection: 'row',
|
|
561
|
+
backgroundColor: 'darkblue',
|
|
562
|
+
height: normalize(60),
|
|
563
|
+
justifyContent: 'space-around',
|
|
564
|
+
alignItems: 'center',
|
|
565
|
+
paddingHorizontal: 10,
|
|
566
|
+
},
|
|
567
|
+
actionButton: {
|
|
568
|
+
alignItems: 'center',
|
|
569
|
+
justifyContent: 'center',
|
|
570
|
+
padding: 5,
|
|
571
|
+
},
|
|
572
|
+
actionButtonText: {
|
|
573
|
+
color: 'white',
|
|
574
|
+
fontSize: normalize(10),
|
|
575
|
+
marginTop: 3,
|
|
576
|
+
},
|
|
577
|
+
disabledButton: {
|
|
578
|
+
opacity: 0.5,
|
|
579
|
+
},
|
|
580
|
+
});
|
|
581
|
+
/*---------------------------------------------------------------------------------------*/
|
|
582
|
+
export default memo(DrawingScreen);
|