@react-native-async-storage/async-storage
Advanced tools
Comparing version
@@ -13,9 +13,10 @@ "use strict"; | ||
// @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'. | ||
let RCTAsyncStorage = _reactNative.NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows | ||
// TurboModuleRegistry falls back to NativeModules so we don't have to try go | ||
// assign NativeModules' counterparts if TurboModuleRegistry would resolve | ||
// with undefined. | ||
let RCTAsyncStorage = _reactNative.TurboModuleRegistry ? _reactNative.TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows | ||
_reactNative.TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || _reactNative.TurboModuleRegistry.get('RNCAsyncStorage') : _reactNative.NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows | ||
_reactNative.NativeModules['RNC_AsyncSQLiteDBStorage'] || _reactNative.NativeModules['RNCAsyncStorage']; | ||
if (!RCTAsyncStorage && (0, _shouldFallbackToLegacyNativeModule.shouldFallbackToLegacyNativeModule)()) { | ||
// TurboModuleRegistry falls back to NativeModules so we don't have to try go | ||
// assign NativeModules' counterparts if TurboModuleRegistry would resolve | ||
// with undefined. | ||
if (_reactNative.TurboModuleRegistry) { | ||
@@ -22,0 +23,0 @@ RCTAsyncStorage = _reactNative.TurboModuleRegistry.get('AsyncSQLiteDBStorage') || _reactNative.TurboModuleRegistry.get('AsyncLocalStorage'); |
// @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'. | ||
import { NativeModules, TurboModuleRegistry } from 'react-native'; | ||
import { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule'; | ||
let RCTAsyncStorage = NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows | ||
import { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule'; // TurboModuleRegistry falls back to NativeModules so we don't have to try go | ||
// assign NativeModules' counterparts if TurboModuleRegistry would resolve | ||
// with undefined. | ||
let RCTAsyncStorage = TurboModuleRegistry ? TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows | ||
TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || TurboModuleRegistry.get('RNCAsyncStorage') : NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows | ||
NativeModules['RNC_AsyncSQLiteDBStorage'] || NativeModules['RNCAsyncStorage']; | ||
if (!RCTAsyncStorage && shouldFallbackToLegacyNativeModule()) { | ||
// TurboModuleRegistry falls back to NativeModules so we don't have to try go | ||
// assign NativeModules' counterparts if TurboModuleRegistry would resolve | ||
// with undefined. | ||
if (TurboModuleRegistry) { | ||
@@ -12,0 +13,0 @@ RCTAsyncStorage = TurboModuleRegistry.get('AsyncSQLiteDBStorage') || TurboModuleRegistry.get('AsyncLocalStorage'); |
{ | ||
"name": "@react-native-async-storage/async-storage", | ||
"version": "1.18.1", | ||
"version": "1.18.2", | ||
"description": "Asynchronous, persistent, key-value storage system for React Native.", | ||
@@ -100,2 +100,4 @@ "main": "lib/commonjs/index.js", | ||
"resolutions": { | ||
"body-parser/qs": "^6.7.3", | ||
"find-babel-config/json5": "^2.1.1", | ||
"npm/chalk": "^4.1.2" | ||
@@ -102,0 +104,0 @@ }, |
@@ -5,11 +5,14 @@ // @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'. | ||
let RCTAsyncStorage = | ||
NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows | ||
NativeModules['RNC_AsyncSQLiteDBStorage'] || | ||
NativeModules['RNCAsyncStorage']; | ||
// TurboModuleRegistry falls back to NativeModules so we don't have to try go | ||
// assign NativeModules' counterparts if TurboModuleRegistry would resolve | ||
// with undefined. | ||
let RCTAsyncStorage = TurboModuleRegistry | ||
? TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows | ||
TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || | ||
TurboModuleRegistry.get('RNCAsyncStorage') | ||
: NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows | ||
NativeModules['RNC_AsyncSQLiteDBStorage'] || | ||
NativeModules['RNCAsyncStorage']; | ||
if (!RCTAsyncStorage && shouldFallbackToLegacyNativeModule()) { | ||
// TurboModuleRegistry falls back to NativeModules so we don't have to try go | ||
// assign NativeModules' counterparts if TurboModuleRegistry would resolve | ||
// with undefined. | ||
if (TurboModuleRegistry) { | ||
@@ -16,0 +19,0 @@ RCTAsyncStorage = |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
408488
0.39%3116
0.13%