File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 2
2
import { NativeModules , TurboModuleRegistry } from 'react-native' ;
3
3
import { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule' ;
4
4
5
- import AsyncStorageTurboModule from './NativeAsyncStorageModule' ;
6
-
7
- let RCTAsyncStorage =
8
- AsyncStorageTurboModule ||
9
- NativeModules [ 'PlatformLocalStorage' ] || // Support for external modules, like react-native-windows
10
- NativeModules [ 'RNCAsyncStorage' ] ;
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' ] ;
11
15
12
16
if ( ! RCTAsyncStorage && shouldFallbackToLegacyNativeModule ( ) ) {
13
17
if ( TurboModuleRegistry ) {
You can’t perform that action at this time.
0 commit comments