mg-library 1.0.671 → 1.0.674
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 +28 -133
- package/components.js +75 -2
- package/functions.js +0 -2
- 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,11 +435,13 @@ export function MGCamera(props) {
|
|
|
436
435
|
<View>
|
|
437
436
|
<View style={{ flexDirection: 'row' }}>
|
|
438
437
|
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
439
|
-
<
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
438
|
+
<MGButton
|
|
439
|
+
icon="camera-flip-outline"
|
|
440
|
+
title={mgFunctionsLib.i18nString('doInvertCamera', props.language)}
|
|
441
|
+
action="primary"
|
|
442
|
+
variant="solid"
|
|
443
|
+
py="$4"
|
|
444
|
+
style={{ width: 150 }}
|
|
444
445
|
onPress={() => {
|
|
445
446
|
setFacing(
|
|
446
447
|
facing === mgConstantsLib.CAMERA_FACING_BACK
|
|
@@ -448,23 +449,18 @@ export function MGCamera(props) {
|
|
|
448
449
|
: mgConstantsLib.CAMERA_FACING_BACK
|
|
449
450
|
);
|
|
450
451
|
}}
|
|
451
|
-
|
|
452
|
-
<MGText category="p1" color="white">
|
|
453
|
-
{mgFunctionsLib.i18nString('doInvertCamera', props.language)}
|
|
454
|
-
</MGText>
|
|
455
|
-
</NBButton>
|
|
452
|
+
/>
|
|
456
453
|
</View>
|
|
457
454
|
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
458
|
-
<
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
</NBButton>
|
|
455
|
+
<MGButton
|
|
456
|
+
icon="camera-outline"
|
|
457
|
+
title={mgFunctionsLib.i18nString('doTakePhoto', props.language)}
|
|
458
|
+
action="primary"
|
|
459
|
+
variant="solid"
|
|
460
|
+
py="$4"
|
|
461
|
+
onPress={__takePicture}
|
|
462
|
+
style={{ width: 150 }}
|
|
463
|
+
/>
|
|
468
464
|
</View>
|
|
469
465
|
</View>
|
|
470
466
|
</View>
|
|
@@ -533,16 +529,15 @@ export function MGCameraPreview(props) {
|
|
|
533
529
|
<View>
|
|
534
530
|
<View style={{ flexDirection: 'row' }}>
|
|
535
531
|
<View style={{ flex: 1, alignItems: 'center' }}>
|
|
536
|
-
<
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
</NBButton>
|
|
532
|
+
<MGButton
|
|
533
|
+
icon="cloud-upload-outline"
|
|
534
|
+
title={mgFunctionsLib.i18nString('doSavePhoto', props.language)}
|
|
535
|
+
action="primary"
|
|
536
|
+
variant="solid"
|
|
537
|
+
py="$4"
|
|
538
|
+
onPress={__savePicture}
|
|
539
|
+
style={{ width: 150 }}
|
|
540
|
+
/>
|
|
546
541
|
</View>
|
|
547
542
|
</View>
|
|
548
543
|
</View>
|
|
@@ -558,93 +553,6 @@ export function MGCameraPreview(props) {
|
|
|
558
553
|
)
|
|
559
554
|
}
|
|
560
555
|
|
|
561
|
-
export function MGPopover(props) {
|
|
562
|
-
const [visible, setVisible] = useState(false);
|
|
563
|
-
const footer = (
|
|
564
|
-
<View style={{ flexGrow: 1, flexDirection: 'row', justifyContent: 'space-around', marginTop: 20, marginBottom: 20 }}>
|
|
565
|
-
<NBButton
|
|
566
|
-
py={4}
|
|
567
|
-
colorScheme='primary'
|
|
568
|
-
style={{ flexGrow: 0.3 }}
|
|
569
|
-
onPress={() => {
|
|
570
|
-
setVisible(false);
|
|
571
|
-
props.callback();
|
|
572
|
-
}}
|
|
573
|
-
>
|
|
574
|
-
<MGText color="white">
|
|
575
|
-
{mgFunctionsLib.i18nString('yes', props.language)}
|
|
576
|
-
</MGText>
|
|
577
|
-
</NBButton>
|
|
578
|
-
<NBButton
|
|
579
|
-
py={4}
|
|
580
|
-
colorScheme='primary'
|
|
581
|
-
style={{ flexGrow: 0.3 }}
|
|
582
|
-
onPress={() => setVisible(false)}
|
|
583
|
-
>
|
|
584
|
-
<MGText color="white">
|
|
585
|
-
{mgFunctionsLib.i18nString('no', props.language)}
|
|
586
|
-
</MGText>
|
|
587
|
-
</NBButton>
|
|
588
|
-
</View>
|
|
589
|
-
);
|
|
590
|
-
return (
|
|
591
|
-
<NBPopover
|
|
592
|
-
isOpen={visible}
|
|
593
|
-
onClose={() => setVisible(false)}
|
|
594
|
-
trigger={triggerProps => (
|
|
595
|
-
<NBButton
|
|
596
|
-
{...triggerProps}
|
|
597
|
-
py={4}
|
|
598
|
-
colorScheme='primary'
|
|
599
|
-
leftIcon={
|
|
600
|
-
<NBIcon
|
|
601
|
-
as={MaterialCommunityIcons}
|
|
602
|
-
name={props.icon}
|
|
603
|
-
size='lg'
|
|
604
|
-
color='white'
|
|
605
|
-
/>
|
|
606
|
-
}
|
|
607
|
-
onPress={() => setVisible(true)}
|
|
608
|
-
>
|
|
609
|
-
<MGText category="p1" color="white">
|
|
610
|
-
{props.title}
|
|
611
|
-
</MGText>
|
|
612
|
-
</NBButton>
|
|
613
|
-
)}
|
|
614
|
-
>
|
|
615
|
-
<NBPopover.Content w="300px" bg="white">
|
|
616
|
-
<NBPopover.Arrow />
|
|
617
|
-
<NBPopover.CloseButton />
|
|
618
|
-
<NBPopover.Body>
|
|
619
|
-
<Box alignItems="center" justifyContent="center">
|
|
620
|
-
<NBIcon as={MaterialCommunityIcons} name="alert-outline" size={16} color={props.colors.primary['500']} mb={3} />
|
|
621
|
-
<MGText textAlign="center">
|
|
622
|
-
{mgFunctionsLib.i18nString('confirm', props.language)}?
|
|
623
|
-
</MGText>
|
|
624
|
-
</Box>
|
|
625
|
-
</NBPopover.Body>
|
|
626
|
-
<NBPopover.Footer>
|
|
627
|
-
{footer}
|
|
628
|
-
</NBPopover.Footer>
|
|
629
|
-
</NBPopover.Content>
|
|
630
|
-
</NBPopover>
|
|
631
|
-
);
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
/* export function MGGoBack(props) {
|
|
635
|
-
return (
|
|
636
|
-
<View style={{ alignItems: 'flex-start', marginTop: 10 }}>
|
|
637
|
-
<NBButton
|
|
638
|
-
appearance='ghost'
|
|
639
|
-
bg='transparent'
|
|
640
|
-
onPress={() => props.process.goBack()}>
|
|
641
|
-
<NBIcon as={MaterialCommunityIcons} name='keyboard-backspace' size='2xl' color={props.colors.primary['500']}
|
|
642
|
-
/>
|
|
643
|
-
</NBButton>
|
|
644
|
-
</View>
|
|
645
|
-
)
|
|
646
|
-
} */
|
|
647
|
-
|
|
648
556
|
export function MGGoBack(props) {
|
|
649
557
|
return (
|
|
650
558
|
<View style={{ alignItems: 'flex-start', marginTop: 10 }}>
|
|
@@ -733,19 +641,6 @@ export function MGSessionHeader(props) {
|
|
|
733
641
|
);
|
|
734
642
|
}
|
|
735
643
|
|
|
736
|
-
export function MGDivider({ style, ...props }) {
|
|
737
|
-
return (
|
|
738
|
-
<Divider
|
|
739
|
-
h="$0.25"
|
|
740
|
-
flexGrow={1}
|
|
741
|
-
alignSelf="stretch"
|
|
742
|
-
bg="$trueGray400"
|
|
743
|
-
style={style}
|
|
744
|
-
{...props}
|
|
745
|
-
/>
|
|
746
|
-
);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
644
|
export function MGActivityIndicator(props) {
|
|
750
645
|
return (
|
|
751
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';
|