Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Swap the native module used when in Expo managed workflow (#368)
* Add a .expo.js file to use the built-in react-native RCTAsyncStorage until RNC module ships with it
- Loading branch information
1 parent
22e7583
commit f9d1924
Showing
4 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Expo managed workflow supported native backend | ||
/src/RCTAsyncStorage.expo.js @brentvatne |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Expo managed apps don't include the @react-native-community/async-storage | ||
* native modules yet, but the API interface is the same, so we can use the version | ||
* exported from React Native still. | ||
* | ||
* If in future releases (eg: @react-native-community/async-storage >= 2.0.0) this | ||
* will likely not be valid anymore, and the package will need to be included in the Expo SDK | ||
* to continue to work. | ||
*/ | ||
const {NativeModules} = require('react-native'); | ||
const RCTAsyncStorage = NativeModules.AsyncSQLiteDBStorage || NativeModules.AsyncLocalStorage; | ||
|
||
export default RCTAsyncStorage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const {NativeModules} = require('react-native'); | ||
|
||
const RCTAsyncStorage = | ||
NativeModules.PlatformLocalStorage || // Support for external modules, like react-native-windows | ||
NativeModules.RNC_AsyncSQLiteDBStorage || | ||
NativeModules.RNCAsyncStorage; | ||
|
||
export default RCTAsyncStorage; |