mg-library 1.0.288 → 1.0.290
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/functions.js +43 -32
- package/package.json +1 -1
- package/mg-library.rar +0 -0
package/functions.js
CHANGED
|
@@ -34,21 +34,21 @@ const mgStringsEnglish = require('./i18n/english').strings;
|
|
|
34
34
|
|
|
35
35
|
export function i18nString(key, language, stringsSpanish, stringsEnglish) {
|
|
36
36
|
let value = undefined;
|
|
37
|
-
switch(language.code) {
|
|
37
|
+
switch (language.code) {
|
|
38
38
|
case mgConstants.LANGUAGE_SPANISH.code: {
|
|
39
39
|
value = mgStringsSpanish[key];
|
|
40
|
-
if(value===undefined)
|
|
41
|
-
|
|
40
|
+
if (value === undefined)
|
|
41
|
+
value = stringsSpanish[key];
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
case mgConstants.LANGUAGE_ENGLISH.code: {
|
|
45
45
|
value = mgStringsEnglish[key];
|
|
46
|
-
if(value===undefined)
|
|
47
|
-
|
|
46
|
+
if (value === undefined)
|
|
47
|
+
value = stringsEnglish[key];
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
if(value===undefined)
|
|
51
|
+
if (value === undefined)
|
|
52
52
|
value = '???' + key + '???';
|
|
53
53
|
return value;
|
|
54
54
|
}
|
|
@@ -58,21 +58,21 @@ const mgMessagesEnglish = require('./i18n/english').messages;
|
|
|
58
58
|
|
|
59
59
|
export function i18nMessage(key, language, messagesSpanish, messagesEnglish) {
|
|
60
60
|
let value = undefined;
|
|
61
|
-
switch(language.code) {
|
|
61
|
+
switch (language.code) {
|
|
62
62
|
case mgConstants.LANGUAGE_SPANISH.code: {
|
|
63
63
|
value = mgMessagesSpanish[key];
|
|
64
|
-
if(value===undefined)
|
|
65
|
-
|
|
64
|
+
if (value === undefined)
|
|
65
|
+
value = messagesSpanish[key];
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
case mgConstants.LANGUAGE_ENGLISH.code: {
|
|
69
69
|
value = mgMessagesEnglish[key];
|
|
70
|
-
if(value===undefined)
|
|
71
|
-
|
|
70
|
+
if (value === undefined)
|
|
71
|
+
value = messagesEnglish[key];
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
if(value===undefined)
|
|
75
|
+
if (value === undefined)
|
|
76
76
|
value = '???' + key + '???';
|
|
77
77
|
return value;
|
|
78
78
|
}
|
|
@@ -81,12 +81,23 @@ export function i18nMessage(key, language, messagesSpanish, messagesEnglish) {
|
|
|
81
81
|
|
|
82
82
|
export function safeAreaViewStyleSheet(insets) {
|
|
83
83
|
return StyleSheet.create({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
safeAreaView: {
|
|
85
|
+
paddingTop: insets.top,
|
|
86
|
+
paddingBottom: insets.bottom,
|
|
87
|
+
paddingLeft: insets.left,
|
|
88
|
+
paddingRight: insets.right
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function getBasicStyleSheet() {
|
|
94
|
+
return StyleSheet.create({
|
|
95
|
+
availableArea: {
|
|
96
|
+
marginTop: 5,
|
|
97
|
+
marginBottom: 5,
|
|
98
|
+
marginLeft: 5,
|
|
99
|
+
marginRight: 5
|
|
100
|
+
}
|
|
90
101
|
});
|
|
91
102
|
}
|
|
92
103
|
|
|
@@ -94,17 +105,17 @@ export function safeAreaViewStyleSheet(insets) {
|
|
|
94
105
|
|
|
95
106
|
function showToast(config) {
|
|
96
107
|
Toast.show(config.message, {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
duration: Toast.durations.LONG,
|
|
109
|
+
position: Toast.positions.CENTER,
|
|
110
|
+
shadow: true,
|
|
111
|
+
animation: true,
|
|
112
|
+
hideOnPress: true,
|
|
113
|
+
backgroundColor: config.backgroundColor,
|
|
114
|
+
textColor: 'white',
|
|
115
|
+
delay: 0
|
|
105
116
|
});
|
|
106
117
|
}
|
|
107
|
-
|
|
118
|
+
|
|
108
119
|
export function showToastError(message) {
|
|
109
120
|
let config = {
|
|
110
121
|
message: message,
|
|
@@ -112,7 +123,7 @@ export function showToastError(message) {
|
|
|
112
123
|
}
|
|
113
124
|
showToast(config);
|
|
114
125
|
}
|
|
115
|
-
|
|
126
|
+
|
|
116
127
|
export function showToastSuccess(message) {
|
|
117
128
|
let config = {
|
|
118
129
|
message: message,
|
|
@@ -152,9 +163,9 @@ export function getDateForBackEnd(date) {
|
|
|
152
163
|
}
|
|
153
164
|
|
|
154
165
|
export function capitalize(str) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
166
|
+
if (typeof str !== 'string')
|
|
167
|
+
return '';
|
|
168
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
158
169
|
}
|
|
159
170
|
|
|
160
171
|
export function getDateForExposition(date, language) {
|
|
@@ -163,7 +174,7 @@ export function getDateForExposition(date, language) {
|
|
|
163
174
|
let dayName = capitalize(m.format('dddd'));
|
|
164
175
|
let monthName = capitalize(m.format('MMMM'));
|
|
165
176
|
let year = m.format('YYYY');
|
|
166
|
-
return dayName + ', ' + day + ' '+ monthName + ' ' + year;
|
|
177
|
+
return dayName + ', ' + day + ' ' + monthName + ' ' + year;
|
|
167
178
|
}
|
|
168
179
|
|
|
169
180
|
export function getTimeForExposition(date) {
|
package/package.json
CHANGED
package/mg-library.rar
DELETED
|
Binary file
|