mg-library 1.0.297 → 1.0.298
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 +21 -0
- package/mg-library.rar +0 -0
- package/package.json +1 -1
package/functions.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Toast from 'react-native-root-toast';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
4
|
|
|
4
5
|
import moment from 'moment';
|
|
5
6
|
import 'moment/locale/es';
|
|
@@ -7,6 +8,26 @@ import 'moment/locale/en-gb';
|
|
|
7
8
|
|
|
8
9
|
import * as mgConstants from './constants.js';
|
|
9
10
|
|
|
11
|
+
// Local Storage
|
|
12
|
+
|
|
13
|
+
export const writeToLocalStorage = async (key, value) => {
|
|
14
|
+
try {
|
|
15
|
+
await AsyncStorage.setItem(key, value);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error(error);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function readFromLocalStorage(key) {
|
|
22
|
+
try {
|
|
23
|
+
const value = await AsyncStorage.getItem(key);
|
|
24
|
+
if (value !== null)
|
|
25
|
+
return value;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
10
31
|
// Strings
|
|
11
32
|
|
|
12
33
|
export function isEmpty(value) {
|
package/mg-library.rar
CHANGED
|
Binary file
|