mg-library 1.0.672 → 1.0.675
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/blocks.js +2 -137
- package/components.js +75 -2
- package/functions.js +2 -4
- package/package.json +1 -1
package/blocks.js
CHANGED
|
@@ -5,13 +5,12 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
|
|
|
5
5
|
import * as ImageManipulator from 'expo-image-manipulator';
|
|
6
6
|
import { Camera, CameraType, CameraView } from 'expo-camera';
|
|
7
7
|
import axios from 'axios';
|
|
8
|
-
import {
|
|
9
|
-
import { Box, Divider } from '@gluestack-ui/themed';
|
|
8
|
+
import { Box } from '@gluestack-ui/themed';
|
|
10
9
|
import { uploadFile } from '@uploadcare/upload-client';
|
|
11
10
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
12
11
|
|
|
13
12
|
import './prototypes.js';
|
|
14
|
-
import { MGText, MGCard, MGButton } from './components.js';
|
|
13
|
+
import { MGText, MGCard, MGButton, MGDivider } from './components.js';
|
|
15
14
|
import * as mgFunctionsLib from './functions.js';
|
|
16
15
|
import * as mgConstantsLib from './constants.js';
|
|
17
16
|
import * as mgLoginLib from './login.js';
|
|
@@ -436,23 +435,6 @@ export function MGCamera(props) {
|
|
|
436
435
|
<View>
|
|
437
436
|
<View style={{ flexDirection: 'row' }}>
|
|
438
437
|
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
439
|
-
{/* <NBButton
|
|
440
|
-
style={{ width: 150 }} py={4} colorScheme="primary"
|
|
441
|
-
leftIcon={
|
|
442
|
-
<NBIcon as={MaterialCommunityIcons} name="camera-flip-outline" size="lg" color="white" />
|
|
443
|
-
}
|
|
444
|
-
onPress={() => {
|
|
445
|
-
setFacing(
|
|
446
|
-
facing === mgConstantsLib.CAMERA_FACING_BACK
|
|
447
|
-
? mgConstantsLib.CAMERA_FACING_FRONT
|
|
448
|
-
: mgConstantsLib.CAMERA_FACING_BACK
|
|
449
|
-
);
|
|
450
|
-
}}
|
|
451
|
-
>
|
|
452
|
-
<MGText category="p1" color="white">
|
|
453
|
-
{mgFunctionsLib.i18nString('doInvertCamera', props.language)}
|
|
454
|
-
</MGText>
|
|
455
|
-
</NBButton> */}
|
|
456
438
|
<MGButton
|
|
457
439
|
icon="camera-flip-outline"
|
|
458
440
|
title={mgFunctionsLib.i18nString('doInvertCamera', props.language)}
|
|
@@ -469,19 +451,6 @@ export function MGCamera(props) {
|
|
|
469
451
|
}}
|
|
470
452
|
/>
|
|
471
453
|
</View>
|
|
472
|
-
{/*
|
|
473
|
-
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
474
|
-
<NBButton
|
|
475
|
-
style={{ width: 150 }} py={4} colorScheme="primary"
|
|
476
|
-
leftIcon={
|
|
477
|
-
<NBIcon as={MaterialCommunityIcons} name="camera-outline" size="lg" color="white" />
|
|
478
|
-
}
|
|
479
|
-
onPress={__takePicture}>
|
|
480
|
-
<MGText category="p1" color="white">
|
|
481
|
-
{mgFunctionsLib.i18nString('doTakePhoto', props.language)}
|
|
482
|
-
</MGText>
|
|
483
|
-
</NBButton>
|
|
484
|
-
</View> */}
|
|
485
454
|
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
486
455
|
<MGButton
|
|
487
456
|
icon="camera-outline"
|
|
@@ -556,24 +525,6 @@ export function MGCameraPreview(props) {
|
|
|
556
525
|
<MGText>{mgFunctionsLib.i18nString('previewPhoto', props.language)}</MGText>
|
|
557
526
|
</View>
|
|
558
527
|
);
|
|
559
|
-
/* const cardFooter = (
|
|
560
|
-
<View>
|
|
561
|
-
<View style={{ flexDirection: 'row' }}>
|
|
562
|
-
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
563
|
-
<NBButton
|
|
564
|
-
style={{ width: 150 }} py={4} colorScheme="primary"
|
|
565
|
-
leftIcon={
|
|
566
|
-
<NBIcon as={MaterialCommunityIcons} name="cloud-upload-outline" size="lg" color="white" />
|
|
567
|
-
}
|
|
568
|
-
onPress={__savePicture}>
|
|
569
|
-
<MGText category="p1" color="white">
|
|
570
|
-
{mgFunctionsLib.i18nString('doSavePhoto', props.language)}
|
|
571
|
-
</MGText>
|
|
572
|
-
</NBButton>
|
|
573
|
-
</View>
|
|
574
|
-
</View>
|
|
575
|
-
</View>
|
|
576
|
-
); */
|
|
577
528
|
const cardFooter = (
|
|
578
529
|
<View>
|
|
579
530
|
<View style={{ flexDirection: 'row' }}>
|
|
@@ -602,79 +553,6 @@ export function MGCameraPreview(props) {
|
|
|
602
553
|
)
|
|
603
554
|
}
|
|
604
555
|
|
|
605
|
-
export function MGPopover(props) {
|
|
606
|
-
const [visible, setVisible] = useState(false);
|
|
607
|
-
const footer = (
|
|
608
|
-
<View style={{ flexGrow: 1, flexDirection: 'row', justifyContent: 'space-around', marginTop: 20, marginBottom: 20 }}>
|
|
609
|
-
<NBButton
|
|
610
|
-
py={4}
|
|
611
|
-
colorScheme='primary'
|
|
612
|
-
style={{ flexGrow: 0.3 }}
|
|
613
|
-
onPress={() => {
|
|
614
|
-
setVisible(false);
|
|
615
|
-
props.callback();
|
|
616
|
-
}}
|
|
617
|
-
>
|
|
618
|
-
<MGText color="white">
|
|
619
|
-
{mgFunctionsLib.i18nString('yes', props.language)}
|
|
620
|
-
</MGText>
|
|
621
|
-
</NBButton>
|
|
622
|
-
<NBButton
|
|
623
|
-
py={4}
|
|
624
|
-
colorScheme='primary'
|
|
625
|
-
style={{ flexGrow: 0.3 }}
|
|
626
|
-
onPress={() => setVisible(false)}
|
|
627
|
-
>
|
|
628
|
-
<MGText color="white">
|
|
629
|
-
{mgFunctionsLib.i18nString('no', props.language)}
|
|
630
|
-
</MGText>
|
|
631
|
-
</NBButton>
|
|
632
|
-
</View>
|
|
633
|
-
);
|
|
634
|
-
return (
|
|
635
|
-
<NBPopover
|
|
636
|
-
isOpen={visible}
|
|
637
|
-
onClose={() => setVisible(false)}
|
|
638
|
-
trigger={triggerProps => (
|
|
639
|
-
<NBButton
|
|
640
|
-
{...triggerProps}
|
|
641
|
-
py={4}
|
|
642
|
-
colorScheme='primary'
|
|
643
|
-
leftIcon={
|
|
644
|
-
<NBIcon
|
|
645
|
-
as={MaterialCommunityIcons}
|
|
646
|
-
name={props.icon}
|
|
647
|
-
size='lg'
|
|
648
|
-
color='white'
|
|
649
|
-
/>
|
|
650
|
-
}
|
|
651
|
-
onPress={() => setVisible(true)}
|
|
652
|
-
>
|
|
653
|
-
<MGText category="p1" color="white">
|
|
654
|
-
{props.title}
|
|
655
|
-
</MGText>
|
|
656
|
-
</NBButton>
|
|
657
|
-
)}
|
|
658
|
-
>
|
|
659
|
-
<NBPopover.Content w="300px" bg="white">
|
|
660
|
-
<NBPopover.Arrow />
|
|
661
|
-
<NBPopover.CloseButton />
|
|
662
|
-
<NBPopover.Body>
|
|
663
|
-
<Box alignItems="center" justifyContent="center">
|
|
664
|
-
<NBIcon as={MaterialCommunityIcons} name="alert-outline" size={16} color={props.colors.primary['500']} mb={3} />
|
|
665
|
-
<MGText textAlign="center">
|
|
666
|
-
{mgFunctionsLib.i18nString('confirm', props.language)}?
|
|
667
|
-
</MGText>
|
|
668
|
-
</Box>
|
|
669
|
-
</NBPopover.Body>
|
|
670
|
-
<NBPopover.Footer>
|
|
671
|
-
{footer}
|
|
672
|
-
</NBPopover.Footer>
|
|
673
|
-
</NBPopover.Content>
|
|
674
|
-
</NBPopover>
|
|
675
|
-
);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
556
|
export function MGGoBack(props) {
|
|
679
557
|
return (
|
|
680
558
|
<View style={{ alignItems: 'flex-start', marginTop: 10 }}>
|
|
@@ -763,19 +641,6 @@ export function MGSessionHeader(props) {
|
|
|
763
641
|
);
|
|
764
642
|
}
|
|
765
643
|
|
|
766
|
-
export function MGDivider({ style, ...props }) {
|
|
767
|
-
return (
|
|
768
|
-
<Divider
|
|
769
|
-
h="$0.25"
|
|
770
|
-
flexGrow={1}
|
|
771
|
-
alignSelf="stretch"
|
|
772
|
-
bg="$trueGray400"
|
|
773
|
-
style={style}
|
|
774
|
-
{...props}
|
|
775
|
-
/>
|
|
776
|
-
);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
644
|
export function MGActivityIndicator(props) {
|
|
780
645
|
return (
|
|
781
646
|
<View style={{ flex: 1, flexDirection: 'column', justifyContent: 'center', alignContent: 'center' }}>
|
package/components.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Box, Text, Button, ButtonText, ButtonIcon, Icon } from '@gluestack-ui/themed';
|
|
1
|
+
import { Box, Text, Divider, Button, ButtonText, ButtonIcon, Icon, Popover, PopoverTrigger, PopoverContent, PopoverArrow, PopoverCloseButton, PopoverBody, PopoverFooter } from '@gluestack-ui/themed';
|
|
2
2
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import * as mgFunctionsLib from './functions.js';
|
|
5
5
|
|
|
6
6
|
const categoryMap = {
|
|
7
7
|
h1: { size: '4xl', fontWeight: '$bold' },
|
|
@@ -131,4 +131,77 @@ export function MGButton({
|
|
|
131
131
|
) : null}
|
|
132
132
|
</Button>
|
|
133
133
|
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function MGPopover(props) {
|
|
137
|
+
const [visible, setVisible] = useState(false);
|
|
138
|
+
const footer = (
|
|
139
|
+
<View style={{ flexGrow: 1, flexDirection: 'row', justifyContent: 'space-around', marginTop: 20, marginBottom: 20 }}>
|
|
140
|
+
<MGButton
|
|
141
|
+
title={mgFunctionsLib.i18nString('yes', props.language)}
|
|
142
|
+
action="primary"
|
|
143
|
+
variant="solid"
|
|
144
|
+
py="$4"
|
|
145
|
+
style={{ flexGrow: 0.3 }}
|
|
146
|
+
onPress={() => {
|
|
147
|
+
setVisible(false);
|
|
148
|
+
props.callback();
|
|
149
|
+
}}
|
|
150
|
+
/>
|
|
151
|
+
<MGButton
|
|
152
|
+
title={mgFunctionsLib.i18nString('no', props.language)}
|
|
153
|
+
action="primary"
|
|
154
|
+
variant="solid"
|
|
155
|
+
py="$4"
|
|
156
|
+
style={{ flexGrow: 0.3 }}
|
|
157
|
+
onPress={() => setVisible(false)}
|
|
158
|
+
/>
|
|
159
|
+
</View>
|
|
160
|
+
);
|
|
161
|
+
<Popover isOpen={visible} onClose={() => setVisible(false)}>
|
|
162
|
+
<PopoverTrigger>
|
|
163
|
+
<MGButton
|
|
164
|
+
icon={props.icon}
|
|
165
|
+
title={props.title}
|
|
166
|
+
action="primary"
|
|
167
|
+
variant="solid"
|
|
168
|
+
py="$4"
|
|
169
|
+
onPress={() => setVisible(true)}
|
|
170
|
+
/>
|
|
171
|
+
</PopoverTrigger>
|
|
172
|
+
<PopoverContent w={300} bg="$white">
|
|
173
|
+
<PopoverArrow />
|
|
174
|
+
<PopoverCloseButton />
|
|
175
|
+
<PopoverBody>
|
|
176
|
+
<Box alignItems="center" justifyContent="center">
|
|
177
|
+
<Icon
|
|
178
|
+
as={MaterialCommunityIcons}
|
|
179
|
+
name="alert-outline"
|
|
180
|
+
size={16}
|
|
181
|
+
color="$primary500"
|
|
182
|
+
mb="$3"
|
|
183
|
+
/>
|
|
184
|
+
<MGText textAlign="center">
|
|
185
|
+
{mgFunctionsLib.i18nString('confirm', props.language)}?
|
|
186
|
+
</MGText>
|
|
187
|
+
</Box>
|
|
188
|
+
</PopoverBody>
|
|
189
|
+
<PopoverFooter>
|
|
190
|
+
{footer}
|
|
191
|
+
</PopoverFooter>
|
|
192
|
+
</PopoverContent>
|
|
193
|
+
</Popover>
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function MGDivider({ style, ...props }) {
|
|
197
|
+
return (
|
|
198
|
+
<Divider
|
|
199
|
+
h="$0.25"
|
|
200
|
+
flexGrow={1}
|
|
201
|
+
alignSelf="stretch"
|
|
202
|
+
bg="$trueGray400"
|
|
203
|
+
style={style}
|
|
204
|
+
{...props}
|
|
205
|
+
/>
|
|
206
|
+
);
|
|
134
207
|
}
|
package/functions.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import Toast from 'react-native-root-toast';
|
|
2
2
|
import { StyleSheet, View, Dimensions } from 'react-native';
|
|
3
3
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
|
-
import { Button as NBButton, Icon as NBIcon } from 'native-base';
|
|
5
4
|
import { Box } from '@gluestack-ui/themed';
|
|
6
|
-
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
7
5
|
import moment from 'moment';
|
|
8
6
|
import 'moment/locale/es';
|
|
9
7
|
import 'moment/locale/en-gb';
|
|
@@ -14,12 +12,12 @@ import * as mgConstants from './constants.js';
|
|
|
14
12
|
|
|
15
13
|
// Navigator
|
|
16
14
|
|
|
17
|
-
export function navigatorHeader(insets,
|
|
15
|
+
export function navigatorHeader(insets, onPressLogout, company) {
|
|
18
16
|
let companyDescription = company.description;
|
|
19
17
|
if (companyDescription.length > 25)
|
|
20
18
|
companyDescription = companyDescription.substring(0, 25) + '...';
|
|
21
19
|
return (
|
|
22
|
-
<Box style={[safeAreaViewForNavigatorHeaderStyleSheet(insets).safeAreaView, { backgroundColor:
|
|
20
|
+
<Box style={[safeAreaViewForNavigatorHeaderStyleSheet(insets).safeAreaView, { backgroundColor: '$primary500', flexDirection: 'column', justifyContent: 'flex-end' }]}>
|
|
23
21
|
<View style={{ flexDirection: 'row', flexGrow: 1 }}>
|
|
24
22
|
<View style={{ flexGrow: 0.9, marginLeft: 10, alignSelf: 'center' }}>
|
|
25
23
|
<MGText category='h5' style={{ color: 'white' }}>{companyDescription}</MGText>
|