Skip to content

Commit 4ef5883

Browse files
author
Krzysztof Borowy
authored
fix(async-storage-persistor): Correctly import AsyncStorage (#820)
1 parent ea10c30 commit 4ef5883

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ yarn add @react-native-async-storage/async-storage
6666
npm install --save @react-native-async-storage/async-storage
6767
```
6868

69-
*Note: If you wish to use your own persistence layer you can use the `storePersistor` option when initializing the client. Read more [Client Options](#client-options)*
69+
*Note: If you wish to use your own persistence layer you can use the `storePersistor` option when initializing the client. Make sure you always have a persistor (either by having AsyncStorage package installed or by explicitly passing a value), else you might get unexpected sideeffects like multiple 'Application Installed' events. Read more [Client Options](#client-options)*
7070

7171
For iOS, install native modules with:
7272

packages/sovran/src/persistor/async-storage-persistor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ let AsyncStorage: {
66
} | null;
77

88
try {
9-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10-
AsyncStorage = require('@react-native-async-storage/async-storage');
9+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-var-requires
10+
AsyncStorage = require('@react-native-async-storage/async-storage').default;
1111
} catch (error) {
1212
AsyncStorage = null;
1313
}

0 commit comments

Comments
 (0)