@fto-consult/expo-ui 6.37.3 → 6.37.5

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.
Files changed (114) hide show
  1. package/App.js +0 -1
  2. package/node_modules/.package-lock.json +26218 -26188
  3. package/node_modules/@fto-consult/common/babel.config.alias.js +18 -1
  4. package/node_modules/@fto-consult/common/package.json +1 -1
  5. package/node_modules/@react-native-async-storage/async-storage/LICENSE +21 -0
  6. package/node_modules/@react-native-async-storage/async-storage/README.md +27 -0
  7. package/node_modules/@react-native-async-storage/async-storage/RNCAsyncStorage.podspec +19 -0
  8. package/node_modules/@react-native-async-storage/async-storage/android/build.gradle +142 -0
  9. package/node_modules/@react-native-async-storage/async-storage/android/src/main/AndroidManifest.xml +6 -0
  10. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.java +178 -0
  11. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.java +45 -0
  12. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.java +154 -0
  13. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java +424 -0
  14. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +58 -0
  15. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java +163 -0
  16. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/SerialExecutor.java +40 -0
  17. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ArgumentHelpers.kt +86 -0
  18. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ErrorHelpers.kt +39 -0
  19. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageModule.kt +90 -0
  20. package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageSupplier.kt +161 -0
  21. package/node_modules/@react-native-async-storage/async-storage/android/src/test/java/com/reactnativecommunity/asyncstorage/next/ArgumentHelpersTest.kt +93 -0
  22. package/node_modules/@react-native-async-storage/async-storage/android/src/test/java/com/reactnativecommunity/asyncstorage/next/StorageTest.kt +141 -0
  23. package/node_modules/@react-native-async-storage/async-storage/android/testresults.gradle +38 -0
  24. package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorage.h +51 -0
  25. package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorage.m +898 -0
  26. package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorage.xcodeproj/project.pbxproj +283 -0
  27. package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorageDelegate.h +73 -0
  28. package/node_modules/@react-native-async-storage/async-storage/jest/async-storage-mock.d.ts +9 -0
  29. package/node_modules/@react-native-async-storage/async-storage/jest/async-storage-mock.js +109 -0
  30. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.js +164 -0
  31. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.js.map +1 -0
  32. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.native.js +366 -0
  33. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.native.js.map +1 -0
  34. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/RCTAsyncStorage.js +30 -0
  35. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/RCTAsyncStorage.js.map +1 -0
  36. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/helpers.js +69 -0
  37. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/helpers.js.map +1 -0
  38. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/hooks.js +44 -0
  39. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/hooks.js.map +1 -0
  40. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/index.js +22 -0
  41. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/index.js.map +1 -0
  42. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/shouldFallbackToLegacyNativeModule.js +39 -0
  43. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/shouldFallbackToLegacyNativeModule.js.map +1 -0
  44. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/types.js +2 -0
  45. package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/types.js.map +1 -0
  46. package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.js +153 -0
  47. package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.js.map +1 -0
  48. package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.native.js +348 -0
  49. package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.native.js.map +1 -0
  50. package/node_modules/@react-native-async-storage/async-storage/lib/module/RCTAsyncStorage.js +20 -0
  51. package/node_modules/@react-native-async-storage/async-storage/lib/module/RCTAsyncStorage.js.map +1 -0
  52. package/node_modules/@react-native-async-storage/async-storage/lib/module/helpers.js +56 -0
  53. package/node_modules/@react-native-async-storage/async-storage/lib/module/helpers.js.map +1 -0
  54. package/node_modules/@react-native-async-storage/async-storage/lib/module/hooks.js +34 -0
  55. package/node_modules/@react-native-async-storage/async-storage/lib/module/hooks.js.map +1 -0
  56. package/node_modules/@react-native-async-storage/async-storage/lib/module/index.js +4 -0
  57. package/node_modules/@react-native-async-storage/async-storage/lib/module/index.js.map +1 -0
  58. package/node_modules/@react-native-async-storage/async-storage/lib/module/shouldFallbackToLegacyNativeModule.js +31 -0
  59. package/node_modules/@react-native-async-storage/async-storage/lib/module/shouldFallbackToLegacyNativeModule.js.map +1 -0
  60. package/node_modules/@react-native-async-storage/async-storage/lib/module/types.js +2 -0
  61. package/node_modules/@react-native-async-storage/async-storage/lib/module/types.js.map +1 -0
  62. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/AsyncStorage.d.ts +10 -0
  63. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/AsyncStorage.native.d.ts +16 -0
  64. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/RCTAsyncStorage.d.ts +2 -0
  65. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/helpers.d.ts +5 -0
  66. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/hooks.d.ts +2 -0
  67. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/index.d.ts +4 -0
  68. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/shouldFallbackToLegacyNativeModule.d.ts +1 -0
  69. package/node_modules/@react-native-async-storage/async-storage/lib/typescript/types.d.ts +113 -0
  70. package/node_modules/@react-native-async-storage/async-storage/macos/RNCAsyncStorage.xcodeproj/project.pbxproj +385 -0
  71. package/node_modules/@react-native-async-storage/async-storage/macos/RNCAsyncStorage.xcodeproj/xcshareddata/xcschemes/RNCAsyncStorage-macOS.xcscheme +67 -0
  72. package/node_modules/@react-native-async-storage/async-storage/macos/RNCAsyncStorage.xcodeproj/xcshareddata/xcschemes/RNCAsyncStorage.xcscheme +67 -0
  73. package/node_modules/@react-native-async-storage/async-storage/package.json +197 -0
  74. package/node_modules/@react-native-async-storage/async-storage/src/AsyncStorage.native.ts +356 -0
  75. package/node_modules/@react-native-async-storage/async-storage/src/AsyncStorage.ts +173 -0
  76. package/node_modules/@react-native-async-storage/async-storage/src/RCTAsyncStorage.ts +28 -0
  77. package/node_modules/@react-native-async-storage/async-storage/src/helpers.ts +74 -0
  78. package/node_modules/@react-native-async-storage/async-storage/src/hooks.ts +11 -0
  79. package/node_modules/@react-native-async-storage/async-storage/src/index.ts +7 -0
  80. package/node_modules/@react-native-async-storage/async-storage/src/shouldFallbackToLegacyNativeModule.ts +34 -0
  81. package/node_modules/@react-native-async-storage/async-storage/src/types.ts +155 -0
  82. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/PropertySheet.props +16 -0
  83. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/ReactNativeAsyncStorage.vcxproj +172 -0
  84. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/ReactNativeAsyncStorage.vcxproj.filters +34 -0
  85. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/packages.config +4 -0
  86. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage.sln +172 -0
  87. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/PropertySheet.props +16 -0
  88. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/ReactNativeAsyncStorage61.vcxproj +157 -0
  89. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/ReactNativeAsyncStorage61.vcxproj.filters +34 -0
  90. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/packages.config +4 -0
  91. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61.sln +195 -0
  92. package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage62.sln +192 -0
  93. package/node_modules/@react-native-async-storage/async-storage/windows/code/DBStorage.cpp +599 -0
  94. package/node_modules/@react-native-async-storage/async-storage/windows/code/DBStorage.h +162 -0
  95. package/node_modules/@react-native-async-storage/async-storage/windows/code/RNCAsyncStorage.h +118 -0
  96. package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactNativeAsyncStorage.def +3 -0
  97. package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.cpp +20 -0
  98. package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.h +23 -0
  99. package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.idl +7 -0
  100. package/node_modules/@react-native-async-storage/async-storage/windows/code/pch.cpp +3 -0
  101. package/node_modules/@react-native-async-storage/async-storage/windows/code/pch.h +15 -0
  102. package/node_modules/merge-options/index.d.ts +2 -0
  103. package/node_modules/merge-options/index.js +171 -0
  104. package/node_modules/merge-options/index.mjs +8 -0
  105. package/node_modules/merge-options/license +21 -0
  106. package/node_modules/merge-options/node_modules/is-plain-obj/index.d.ts +29 -0
  107. package/node_modules/merge-options/node_modules/is-plain-obj/index.js +10 -0
  108. package/node_modules/merge-options/node_modules/is-plain-obj/license +9 -0
  109. package/node_modules/merge-options/node_modules/is-plain-obj/package.json +38 -0
  110. package/node_modules/merge-options/node_modules/is-plain-obj/readme.md +54 -0
  111. package/node_modules/merge-options/package.json +59 -0
  112. package/node_modules/merge-options/readme.md +130 -0
  113. package/package.json +131 -130
  114. package/src/components/Chart/appexChart/appexChart.html +23 -23
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Copyright (c) Nicolas Gallagher.
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ // @ts-ignore Cannot find module 'merge-options' or its corresponding type declarations
10
+ import mergeOptions from 'merge-options';
11
+ import type {
12
+ AsyncStorageStatic,
13
+ MultiCallback,
14
+ MultiGetCallback,
15
+ } from './types';
16
+
17
+ const merge = mergeOptions.bind({
18
+ concatArrays: true,
19
+ ignoreUndefined: true,
20
+ });
21
+
22
+ function mergeLocalStorageItem(key: string, value: string) {
23
+ const oldValue = window.localStorage.getItem(key);
24
+ if (oldValue) {
25
+ const oldObject = JSON.parse(oldValue);
26
+ const newObject = JSON.parse(value);
27
+ const nextValue = JSON.stringify(merge(oldObject, newObject));
28
+ window.localStorage.setItem(key, nextValue);
29
+ } else {
30
+ window.localStorage.setItem(key, value);
31
+ }
32
+ }
33
+
34
+ function createPromise<Result, Callback extends Function>(
35
+ getValue: () => Result,
36
+ callback?: Callback
37
+ ): Promise<Result> {
38
+ return new Promise((resolve, reject) => {
39
+ try {
40
+ const value = getValue();
41
+ callback?.(null, value);
42
+ resolve(value);
43
+ } catch (err) {
44
+ callback?.(err);
45
+ reject(err);
46
+ }
47
+ });
48
+ }
49
+
50
+ function createPromiseAll<ReturnType, Result, ResultProcessor extends Function>(
51
+ promises: Promise<Result>[],
52
+ callback?: MultiCallback | MultiGetCallback,
53
+ processResult?: ResultProcessor
54
+ ): Promise<ReturnType> {
55
+ return Promise.all(promises).then(
56
+ (result) => {
57
+ const value = processResult?.(result) ?? null;
58
+ callback?.(null, value);
59
+ return Promise.resolve(value);
60
+ },
61
+ (errors) => {
62
+ callback?.(errors);
63
+ return Promise.reject(errors);
64
+ }
65
+ );
66
+ }
67
+
68
+ const AsyncStorage: AsyncStorageStatic = {
69
+ /**
70
+ * Fetches `key` value.
71
+ */
72
+ getItem: (key, callback) => {
73
+ return createPromise(() => window.localStorage.getItem(key), callback);
74
+ },
75
+
76
+ /**
77
+ * Sets `value` for `key`.
78
+ */
79
+ setItem: (key, value, callback) => {
80
+ return createPromise(
81
+ () => window.localStorage.setItem(key, value),
82
+ callback
83
+ );
84
+ },
85
+
86
+ /**
87
+ * Removes a `key`
88
+ */
89
+ removeItem: (key, callback) => {
90
+ return createPromise(() => window.localStorage.removeItem(key), callback);
91
+ },
92
+
93
+ /**
94
+ * Merges existing value with input value, assuming they are stringified JSON.
95
+ */
96
+ mergeItem: (key, value, callback) => {
97
+ return createPromise(() => mergeLocalStorageItem(key, value), callback);
98
+ },
99
+
100
+ /**
101
+ * Erases *all* AsyncStorage for the domain.
102
+ */
103
+ clear: (callback) => {
104
+ return createPromise(() => window.localStorage.clear(), callback);
105
+ },
106
+
107
+ /**
108
+ * Gets *all* keys known to the app, for all callers, libraries, etc.
109
+ */
110
+ getAllKeys: (callback) => {
111
+ return createPromise(() => {
112
+ const numberOfKeys = window.localStorage.length;
113
+ const keys: string[] = [];
114
+ for (let i = 0; i < numberOfKeys; i += 1) {
115
+ const key = window.localStorage.key(i) || '';
116
+ keys.push(key);
117
+ }
118
+ return keys;
119
+ }, callback);
120
+ },
121
+
122
+ /**
123
+ * (stub) Flushes any pending requests using a single batch call to get the data.
124
+ */
125
+ flushGetRequests: () => undefined,
126
+
127
+ /**
128
+ * multiGet resolves to an array of key-value pair arrays that matches the
129
+ * input format of multiSet.
130
+ *
131
+ * multiGet(['k1', 'k2']) -> [['k1', 'val1'], ['k2', 'val2']]
132
+ */
133
+ multiGet: (keys, callback) => {
134
+ const promises = keys.map((key) => AsyncStorage.getItem(key));
135
+ const processResult = (result: string[]) =>
136
+ result.map((value, i) => [keys[i], value]);
137
+ return createPromiseAll(promises, callback, processResult);
138
+ },
139
+
140
+ /**
141
+ * Takes an array of key-value array pairs.
142
+ * multiSet([['k1', 'val1'], ['k2', 'val2']])
143
+ */
144
+ multiSet: (keyValuePairs, callback) => {
145
+ const promises = keyValuePairs.map((item) =>
146
+ AsyncStorage.setItem(item[0], item[1])
147
+ );
148
+ return createPromiseAll(promises, callback);
149
+ },
150
+
151
+ /**
152
+ * Delete all the keys in the `keys` array.
153
+ */
154
+ multiRemove: (keys, callback) => {
155
+ const promises = keys.map((key) => AsyncStorage.removeItem(key));
156
+ return createPromiseAll(promises, callback);
157
+ },
158
+
159
+ /**
160
+ * Takes an array of key-value array pairs and merges them with existing
161
+ * values, assuming they are stringified JSON.
162
+ *
163
+ * multiMerge([['k1', 'val1'], ['k2', 'val2']])
164
+ */
165
+ multiMerge: (keyValuePairs, callback) => {
166
+ const promises = keyValuePairs.map((item) =>
167
+ AsyncStorage.mergeItem(item[0], item[1])
168
+ );
169
+ return createPromiseAll(promises, callback);
170
+ },
171
+ };
172
+
173
+ export default AsyncStorage;
@@ -0,0 +1,28 @@
1
+ // @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'.
2
+ import { NativeModules, TurboModuleRegistry } from 'react-native';
3
+ import { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule';
4
+
5
+ // TurboModuleRegistry falls back to NativeModules so we don't have to try go
6
+ // assign NativeModules' counterparts if TurboModuleRegistry would resolve
7
+ // with undefined.
8
+ let RCTAsyncStorage = TurboModuleRegistry
9
+ ? TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows
10
+ TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') ||
11
+ TurboModuleRegistry.get('RNCAsyncStorage')
12
+ : NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows
13
+ NativeModules['RNC_AsyncSQLiteDBStorage'] ||
14
+ NativeModules['RNCAsyncStorage'];
15
+
16
+ if (!RCTAsyncStorage && shouldFallbackToLegacyNativeModule()) {
17
+ if (TurboModuleRegistry) {
18
+ RCTAsyncStorage =
19
+ TurboModuleRegistry.get('AsyncSQLiteDBStorage') ||
20
+ TurboModuleRegistry.get('AsyncLocalStorage');
21
+ } else {
22
+ RCTAsyncStorage =
23
+ NativeModules['AsyncSQLiteDBStorage'] ||
24
+ NativeModules['AsyncLocalStorage'];
25
+ }
26
+ }
27
+
28
+ export default RCTAsyncStorage;
@@ -0,0 +1,74 @@
1
+ import type { ErrorLike } from './types';
2
+
3
+ export function checkValidArgs(keyValuePairs: unknown[], callback: unknown) {
4
+ if (
5
+ !Array.isArray(keyValuePairs) ||
6
+ keyValuePairs.length === 0 ||
7
+ !Array.isArray(keyValuePairs[0])
8
+ ) {
9
+ throw new Error(
10
+ '[AsyncStorage] Expected array of key-value pairs as first argument to multiSet'
11
+ );
12
+ }
13
+
14
+ if (callback && typeof callback !== 'function') {
15
+ if (Array.isArray(callback)) {
16
+ throw new Error(
17
+ '[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?'
18
+ );
19
+ }
20
+
21
+ throw new Error(
22
+ '[AsyncStorage] Expected function as second argument to multiSet'
23
+ );
24
+ }
25
+ }
26
+
27
+ export function checkValidInput(...input: unknown[]) {
28
+ const [key, value] = input;
29
+
30
+ if (typeof key !== 'string') {
31
+ console.warn(
32
+ `[AsyncStorage] Using ${typeof key} type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\nKey passed: ${key}\n`
33
+ );
34
+ }
35
+
36
+ if (input.length > 1 && typeof value !== 'string') {
37
+ if (value == null) {
38
+ throw new Error(
39
+ `[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .removeItem method instead.\nPassed value: ${value}\nPassed key: ${key}\n`
40
+ );
41
+ } else {
42
+ console.warn(
43
+ `[AsyncStorage] The value for key "${key}" is not a string. This can lead to unexpected behavior/errors. Consider stringifying it.\nPassed value: ${value}\nPassed key: ${key}\n`
44
+ );
45
+ }
46
+ }
47
+ }
48
+
49
+ export function convertError(error?: ErrorLike): Error | null {
50
+ if (!error) {
51
+ return null;
52
+ }
53
+
54
+ const out = new Error(error.message);
55
+ (out as any).key = error.key;
56
+ return out;
57
+ }
58
+
59
+ export function convertErrors(
60
+ errs?: ErrorLike[]
61
+ ): ReadonlyArray<Error | null> | null {
62
+ const errors = ensureArray(errs);
63
+ return errors ? errors.map((e) => convertError(e)) : null;
64
+ }
65
+
66
+ function ensureArray(e?: ErrorLike | ErrorLike[]): ErrorLike[] | null {
67
+ if (Array.isArray(e)) {
68
+ return e.length === 0 ? null : e;
69
+ } else if (e) {
70
+ return [e];
71
+ } else {
72
+ return null;
73
+ }
74
+ }
@@ -0,0 +1,11 @@
1
+ import AsyncStorage from './AsyncStorage';
2
+ import type { AsyncStorageHook } from './types';
3
+
4
+ export function useAsyncStorage(key: string): AsyncStorageHook {
5
+ return {
6
+ getItem: (...args) => AsyncStorage.getItem(key, ...args),
7
+ setItem: (...args) => AsyncStorage.setItem(key, ...args),
8
+ mergeItem: (...args) => AsyncStorage.mergeItem(key, ...args),
9
+ removeItem: (...args) => AsyncStorage.removeItem(key, ...args),
10
+ };
11
+ }
@@ -0,0 +1,7 @@
1
+ import AsyncStorage from './AsyncStorage';
2
+
3
+ export { useAsyncStorage } from './hooks';
4
+
5
+ export type { AsyncStorageStatic } from './types';
6
+
7
+ export default AsyncStorage;
@@ -0,0 +1,34 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ export function shouldFallbackToLegacyNativeModule(): boolean {
4
+ const expoConstants =
5
+ NativeModules['NativeUnimoduleProxy']?.modulesConstants?.ExponentConstants;
6
+
7
+ if (expoConstants) {
8
+ /**
9
+ * In SDK <= 39, appOwnership is defined in managed apps but executionEnvironment is not.
10
+ * In bare React Native apps using expo-constants, appOwnership is never defined, so
11
+ * isLegacySdkVersion will be false in that context.
12
+ */
13
+ const isLegacySdkVersion =
14
+ expoConstants.appOwnership && !expoConstants.executionEnvironment;
15
+
16
+ /**
17
+ * Expo managed apps don't include the @react-native-async-storage/async-storage
18
+ * native modules yet, but the API interface is the same, so we can use the version
19
+ * exported from React Native still.
20
+ *
21
+ * If in future releases (eg: @react-native-async-storage/async-storage >= 2.0.0) this
22
+ * will likely not be valid anymore, and the package will need to be included in the Expo SDK
23
+ * to continue to work.
24
+ */
25
+ if (
26
+ isLegacySdkVersion ||
27
+ ['storeClient', 'standalone'].includes(expoConstants.executionEnvironment)
28
+ ) {
29
+ return true;
30
+ }
31
+ }
32
+
33
+ return false;
34
+ }
@@ -0,0 +1,155 @@
1
+ export type ErrorLike = {
2
+ message: string;
3
+ key: string;
4
+ };
5
+
6
+ export type Callback = (error?: Error | null) => void;
7
+
8
+ export type CallbackWithResult<T> = (
9
+ error?: Error | null,
10
+ result?: T | null
11
+ ) => void;
12
+
13
+ export type KeyValuePair = [string, string | null];
14
+
15
+ export type MultiCallback = (errors?: readonly (Error | null)[] | null) => void;
16
+
17
+ export type MultiGetCallback = (
18
+ errors?: readonly (Error | null)[] | null,
19
+ result?: readonly KeyValuePair[]
20
+ ) => void;
21
+
22
+ export type MultiRequest = {
23
+ keys: readonly string[];
24
+ callback?: MultiGetCallback;
25
+ keyIndex: number;
26
+ resolve?: (result: readonly KeyValuePair[]) => void;
27
+ reject?: (error?: any) => void;
28
+ };
29
+
30
+ export type AsyncStorageHook = {
31
+ getItem: (callback?: CallbackWithResult<string>) => Promise<string | null>;
32
+ setItem: (value: string, callback?: Callback) => Promise<void>;
33
+ mergeItem: (value: string, callback?: Callback) => Promise<void>;
34
+ removeItem: (callback?: Callback) => Promise<void>;
35
+ };
36
+
37
+ /**
38
+ * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value
39
+ * storage system that is global to the app. It should be used instead of
40
+ * LocalStorage.
41
+ *
42
+ * See https://react-native-async-storage.github.io/async-storage/docs/api
43
+ */
44
+ export type AsyncStorageStatic = {
45
+ /**
46
+ * Fetches an item for a `key` and invokes a callback upon completion.
47
+ *
48
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#getitem
49
+ */
50
+ getItem: (
51
+ key: string,
52
+ callback?: CallbackWithResult<string>
53
+ ) => Promise<string | null>;
54
+
55
+ /**
56
+ * Sets the value for a `key` and invokes a callback upon completion.
57
+ *
58
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#setitem
59
+ */
60
+ setItem: (key: string, value: string, callback?: Callback) => Promise<void>;
61
+
62
+ /**
63
+ * Removes an item for a `key` and invokes a callback upon completion.
64
+ *
65
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#removeitem
66
+ */
67
+ removeItem: (key: string, callback?: Callback) => Promise<void>;
68
+
69
+ /**
70
+ * Merges an existing `key` value with an input value, assuming both values
71
+ * are stringified JSON.
72
+ *
73
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#mergeitem
74
+ */
75
+ mergeItem: (key: string, value: string, callback?: Callback) => Promise<void>;
76
+
77
+ /**
78
+ * Erases *all* `AsyncStorage` for all clients, libraries, etc. You probably
79
+ * don't want to call this; use `removeItem` or `multiRemove` to clear only
80
+ * your app's keys.
81
+ *
82
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#clear
83
+ */
84
+ clear: (callback?: Callback) => Promise<void>;
85
+
86
+ /**
87
+ * Gets *all* keys known to your app; for all callers, libraries, etc.
88
+ *
89
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#getallkeys
90
+ */
91
+ getAllKeys: (
92
+ callback?: CallbackWithResult<readonly string[]>
93
+ ) => Promise<readonly string[]>;
94
+
95
+ /**
96
+ * The following batched functions are useful for executing a lot of
97
+ * operations at once, allowing for native optimizations and provide the
98
+ * convenience of a single callback after all operations are complete.
99
+ *
100
+ * These functions return arrays of errors, potentially one for every key.
101
+ * For key-specific errors, the Error object will have a key property to
102
+ * indicate which key caused the error.
103
+ */
104
+
105
+ /**
106
+ * Flushes any pending requests using a single batch call to get the data.
107
+ *
108
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#flushgetrequests
109
+ * */
110
+ flushGetRequests: () => void;
111
+
112
+ /**
113
+ * This allows you to batch the fetching of items given an array of `key`
114
+ * inputs. Your callback will be invoked with an array of corresponding
115
+ * key-value pairs found.
116
+ *
117
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#multiget
118
+ */
119
+ multiGet: (
120
+ keys: readonly string[],
121
+ callback?: MultiGetCallback
122
+ ) => Promise<readonly KeyValuePair[]>;
123
+
124
+ /**
125
+ * Use this as a batch operation for storing multiple key-value pairs. When
126
+ * the operation completes you'll get a single callback with any errors.
127
+ *
128
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#multiset
129
+ */
130
+ multiSet: (
131
+ keyValuePairs: [string, string][],
132
+ callback?: MultiCallback
133
+ ) => Promise<void>;
134
+
135
+ /**
136
+ * Call this to batch the deletion of all keys in the `keys` array.
137
+ *
138
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#multiremove
139
+ */
140
+ multiRemove: (
141
+ keys: readonly string[],
142
+ callback?: MultiCallback
143
+ ) => Promise<void>;
144
+
145
+ /**
146
+ * Batch operation to merge in existing and new values for a given set of
147
+ * keys. This assumes that the values are stringified JSON.
148
+ *
149
+ * See https://react-native-async-storage.github.io/async-storage/docs/api#multimerge
150
+ */
151
+ multiMerge: (
152
+ keyValuePairs: [string, string][],
153
+ callback?: MultiCallback
154
+ ) => Promise<void>;
155
+ };
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ImportGroup Label="PropertySheets" />
4
+ <PropertyGroup Label="UserMacros" />
5
+ <!--
6
+ To customize common C++/WinRT project properties:
7
+ * right-click the project node
8
+ * expand the Common Properties item
9
+ * select the C++/WinRT property page
10
+
11
+ For more advanced scenarios, and complete documentation, please see:
12
+ https://github.com/Microsoft/cppwinrt/tree/master/nuget
13
+ -->
14
+ <PropertyGroup />
15
+ <ItemDefinitionGroup />
16
+ </Project>
@@ -0,0 +1,172 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" />
4
+ <PropertyGroup Label="Globals">
5
+ <CppWinRTOptimized>true</CppWinRTOptimized>
6
+ <CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
7
+ <MinimalCoreWin>true</MinimalCoreWin>
8
+ <ProjectGuid>{4855D892-E16C-404D-8286-0089E0F7F9C4}</ProjectGuid>
9
+ <ProjectName>ReactNativeAsyncStorage</ProjectName>
10
+ <RootNamespace>ReactNativeAsyncStorage</RootNamespace>
11
+ <DefaultLanguage>en-US</DefaultLanguage>
12
+ <MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
13
+ <AppContainerApplication>true</AppContainerApplication>
14
+ <ApplicationType>Windows Store</ApplicationType>
15
+ <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
16
+ <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0</WindowsTargetPlatformVersion>
17
+ <WindowsTargetPlatformMinVersion>10.0.16299.0</WindowsTargetPlatformMinVersion>
18
+ </PropertyGroup>
19
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20
+ <PropertyGroup Label="ReactNativeWindowsProps">
21
+ <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(SolutionDir), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
22
+ </PropertyGroup>
23
+ <ItemGroup Label="ProjectConfigurations">
24
+ <ProjectConfiguration Include="Debug|ARM">
25
+ <Configuration>Debug</Configuration>
26
+ <Platform>ARM</Platform>
27
+ </ProjectConfiguration>
28
+ <ProjectConfiguration Include="Debug|ARM64">
29
+ <Configuration>Debug</Configuration>
30
+ <Platform>ARM64</Platform>
31
+ </ProjectConfiguration>
32
+ <ProjectConfiguration Include="Debug|Win32">
33
+ <Configuration>Debug</Configuration>
34
+ <Platform>Win32</Platform>
35
+ </ProjectConfiguration>
36
+ <ProjectConfiguration Include="Debug|x64">
37
+ <Configuration>Debug</Configuration>
38
+ <Platform>x64</Platform>
39
+ </ProjectConfiguration>
40
+ <ProjectConfiguration Include="Release|ARM">
41
+ <Configuration>Release</Configuration>
42
+ <Platform>ARM</Platform>
43
+ </ProjectConfiguration>
44
+ <ProjectConfiguration Include="Release|ARM64">
45
+ <Configuration>Release</Configuration>
46
+ <Platform>ARM64</Platform>
47
+ </ProjectConfiguration>
48
+ <ProjectConfiguration Include="Release|Win32">
49
+ <Configuration>Release</Configuration>
50
+ <Platform>Win32</Platform>
51
+ </ProjectConfiguration>
52
+ <ProjectConfiguration Include="Release|x64">
53
+ <Configuration>Release</Configuration>
54
+ <Platform>x64</Platform>
55
+ </ProjectConfiguration>
56
+ </ItemGroup>
57
+ <PropertyGroup Label="Configuration">
58
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
59
+ <CharacterSet>Unicode</CharacterSet>
60
+ <GenerateManifest>false</GenerateManifest>
61
+ </PropertyGroup>
62
+ <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
63
+ <UseDebugLibraries>true</UseDebugLibraries>
64
+ <LinkIncremental>true</LinkIncremental>
65
+ </PropertyGroup>
66
+ <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
67
+ <UseDebugLibraries>false</UseDebugLibraries>
68
+ <WholeProgramOptimization>true</WholeProgramOptimization>
69
+ <LinkIncremental>false</LinkIncremental>
70
+ </PropertyGroup>
71
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
72
+ <ImportGroup Label="ExtensionSettings">
73
+ </ImportGroup>
74
+ <ImportGroup Label="PropertySheets">
75
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
76
+ </ImportGroup>
77
+ <ImportGroup Label="PropertySheets">
78
+ <Import Project="PropertySheet.props" />
79
+ </ImportGroup>
80
+ <ImportGroup Label="ReactNativeWindowsPropertySheets">
81
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" />
82
+ </ImportGroup>
83
+ <PropertyGroup Label="UserMacros" />
84
+ <PropertyGroup />
85
+ <ItemDefinitionGroup>
86
+ <ClCompile>
87
+ <PrecompiledHeader>Use</PrecompiledHeader>
88
+ <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
89
+ <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
90
+ <WarningLevel>Level4</WarningLevel>
91
+ <AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
92
+ <!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
93
+ <AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
94
+ <DisableSpecificWarnings>28204</DisableSpecificWarnings>
95
+ <PreprocessorDefinitions>_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
96
+ <AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
97
+ </ClCompile>
98
+ <Link>
99
+ <SubSystem>Console</SubSystem>
100
+ <GenerateWindowsMetadata>true</GenerateWindowsMetadata>
101
+ <ModuleDefinitionFile>..\code\ReactNativeAsyncStorage.def</ModuleDefinitionFile>
102
+ <AdditionalDependencies>winsqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
103
+ <DelayLoadDLLs>winsqlite3.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
104
+ </Link>
105
+ </ItemDefinitionGroup>
106
+ <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
107
+ <ClCompile>
108
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
109
+ </ClCompile>
110
+ </ItemDefinitionGroup>
111
+ <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
112
+ <ClCompile>
113
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
114
+ </ClCompile>
115
+ </ItemDefinitionGroup>
116
+ <ItemGroup>
117
+ <ClInclude Include="..\code\pch.h" />
118
+ <ClInclude Include="..\code\ReactPackageProvider.h">
119
+ <DependentUpon>..\code\ReactPackageProvider.idl</DependentUpon>
120
+ </ClInclude>
121
+ <ClInclude Include="..\code\DBStorage.h" />
122
+ <ClInclude Include="..\code\RNCAsyncStorage.h" />
123
+ </ItemGroup>
124
+ <ItemGroup>
125
+ <ClCompile Include="..\code\pch.cpp">
126
+ <PrecompiledHeader>Create</PrecompiledHeader>
127
+ </ClCompile>
128
+ <ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
129
+ <ClCompile Include="..\code\ReactPackageProvider.cpp">
130
+ <DependentUpon>..\code\ReactPackageProvider.idl</DependentUpon>
131
+ </ClCompile>
132
+ <ClCompile Include="..\code\DBStorage.cpp" />
133
+ </ItemGroup>
134
+ <ItemGroup>
135
+ <Midl Include="..\code\ReactPackageProvider.idl" />
136
+ </ItemGroup>
137
+ <ItemGroup>
138
+ <None Include="packages.config" />
139
+ <None Include="..\code\ReactNativeAsyncStorage.def" />
140
+ </ItemGroup>
141
+ <ItemGroup>
142
+ <None Include="PropertySheet.props" />
143
+ </ItemGroup>
144
+ <ItemGroup>
145
+ <ProjectReference Include="$(ReactNativeWindowsDir)\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj">
146
+ <Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
147
+ <Private>false</Private>
148
+ </ProjectReference>
149
+ </ItemGroup>
150
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
151
+ <ImportGroup Label="ReactNativeWindowsTargets">
152
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" />
153
+ </ImportGroup>
154
+ <Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
155
+ <PropertyGroup>
156
+ <ErrorText>This project references targets in your node_modules\react-native-windows folder. The missing file is {0}.</ErrorText>
157
+ </PropertyGroup>
158
+ <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" />
159
+ <Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" />
160
+ </Target>
161
+ <ImportGroup Label="ExtensionTargets">
162
+ <Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
163
+ </ImportGroup>
164
+ <Target Name="Deploy" />
165
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
166
+ <PropertyGroup>
167
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
168
+ </PropertyGroup>
169
+ <Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
170
+ <Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
171
+ </Target>
172
+ </Project>