File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 7
7
* will likely not be valid anymore, and the package will need to be included in the Expo SDK
8
8
* to continue to work.
9
9
*/
10
- const { NativeModules} = require ( 'react-native' ) ;
11
- const RCTAsyncStorage = NativeModules . AsyncSQLiteDBStorage || NativeModules . AsyncLocalStorage ;
10
+ const { NativeModules, TurboModuleRegistry} = require ( 'react-native' ) ;
12
11
13
- export default RCTAsyncStorage ;
12
+ let RCTAsyncStorage ;
13
+
14
+ // TurboModuleRegistry falls back to NativeModules
15
+ // so we don't have to try go assign NativeModules'
16
+ // counterparts if TurboModuleRegistry would resolve
17
+ // with undefined.
18
+ if ( TurboModuleRegistry ) {
19
+ RCTAsyncStorage = TurboModuleRegistry . get ( "AsyncSQLiteDBStorage" ) || TurboModuleRegistry . get ( "AsyncLocalStorage" ) ;
20
+ } else {
21
+ RCTAsyncStorage = NativeModules . AsyncSQLiteDBStorage || NativeModules . AsyncLocalStorage ;
22
+ }
23
+
24
+ export default RCTAsyncStorage ;
You can’t perform that action at this time.
0 commit comments