Skip to content

Commit

Permalink
fix: react-native-windows support
Browse files Browse the repository at this point in the history
Summary:

The [react-native-windows](https://github.com/Microsoft/react-native-windows) repo provides Windows build target support to React Native projects. It provides AsyncStorage support through the module name `AsyncLocalStorage` (exact file is [here](https://github.com/Microsoft/react-native-windows/blob/master/RNWCS/ReactWindows/ReactNative/Modules/Storage/AsyncStorageModule.cs)) but commit 547445c removed the reference to `NativeModules.AsyncLocalStorage` from this repo which broke Windows support. This PR adds that back in.
  • Loading branch information
sbeca authored and Krzysztof Borowy committed Apr 5, 2019
1 parent 22d4e5e commit b2a1d2d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/AsyncStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
const {NativeModules} = require('react-native');

const RCTAsyncStorage =
NativeModules.RNC_AsyncSQLiteDBStorage || NativeModules.RNCAsyncStorage;
NativeModules.AsyncLocalStorage || // Support for external modules, like react-native-windows
NativeModules.RNC_AsyncSQLiteDBStorage ||
NativeModules.RNCAsyncStorage;

if (!RCTAsyncStorage) {
throw new Error(`@RNCommunity/AsyncStorage: NativeModule.RCTAsyncStorage is null.
Expand Down

0 comments on commit b2a1d2d

Please sign in to comment.