mg-library 1.0.319 → 1.0.320

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 CHANGED
@@ -1,6 +1,6 @@
1
- import { useCallback } from 'react';
1
+ import { useCallback, useState } from 'react';
2
2
  import { View, ActivityIndicator, Pressable } from 'react-native';
3
- import { Text, Divider, Button } from '@ui-kitten/components';
3
+ import { Text, Divider, Button, Popover, Card } from '@ui-kitten/components';
4
4
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
5
5
 
6
6
  import * as mgFunctionsLib from './functions.js';
@@ -26,6 +26,50 @@ export function MGButton(props) {
26
26
  )
27
27
  }
28
28
 
29
+ export function MGPopover(props) {
30
+ const [visible, setVisible] = useState(false);
31
+ const icon = () => (
32
+ <MaterialCommunityIcons
33
+ name={props.icon}
34
+ size={30}
35
+ style={{ color: 'white' }} />
36
+ );
37
+ const button = () => (
38
+ <Button
39
+ onPress={() => setVisible(true)}
40
+ status='primary'
41
+ accessoryLeft={icon}>
42
+ {props.title}
43
+ </Button>
44
+ );
45
+ let cardFooter = (
46
+ <>
47
+ <View style={{ flexGrow: 1, flexDirection: 'row', justifyContent: 'space-around', marginTop: 20, marginBottom: 20 }}>
48
+ <Button style={{ flexGrow: 0.3 }} onPress={() => { setVisible(false); props.callback() }}>
49
+ <Text>{mgFunctionsLib.i18nString('yes', props.language)}</Text>
50
+ </Button>
51
+ <Button style={{ flexGrow: 0.3 }} onPress={() => { setVisible(false) }}>
52
+ <Text>{mgFunctionsLib.i18nString('no', props.language)}</Text>
53
+ </Button>
54
+ </View>
55
+ </>
56
+ );
57
+ return (
58
+ <Popover
59
+ style={{ width: 300 }}
60
+ backdropStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.5)' }}
61
+ visible={visible}
62
+ anchor={button}>
63
+ <Card footer={cardFooter}>
64
+ <View style={{ flexDirection: 'column', justifyContent: 'center', alignItems: 'center' }}>
65
+ <MaterialCommunityIcons name='alert-outline' color={props.theme['color-primary-500']} size={70} style={{ marginBottom: 10 }} />
66
+ <Text>{mgFunctionsLib.i18nString('confirm', props.language)} ?</Text>
67
+ </View>
68
+ </Card>
69
+ </Popover>
70
+ )
71
+ }
72
+
29
73
  export function MGGoBack(props) {
30
74
  const goBackIcon = () => (
31
75
  <MaterialCommunityIcons
package/functions.js CHANGED
@@ -100,13 +100,15 @@ export function i18nString(key, language, stringsSpanish, stringsEnglish) {
100
100
  case mgConstants.LANGUAGE_SPANISH.code: {
101
101
  value = mgStringsSpanish[key];
102
102
  if (value === undefined)
103
- value = stringsSpanish[key];
103
+ if (stringsSpanish != undefined)
104
+ value = stringsSpanish[key];
104
105
  break;
105
106
  }
106
107
  case mgConstants.LANGUAGE_ENGLISH.code: {
107
108
  value = mgStringsEnglish[key];
108
109
  if (value === undefined)
109
- value = stringsEnglish[key];
110
+ if (stringsEnglish != undefined)
111
+ value = stringsEnglish[key];
110
112
  break;
111
113
  }
112
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.319",
3
+ "version": "1.0.320",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {