seigel / pouchdb-react-native

Pouchdb with async storage
MIT License
483 stars 70 forks source link

Async Storage has been extracted from react-native core and will be removed in a future release. #153

Open Arthur-codeX opened 2 years ago

Arthur-codeX commented 2 years ago

Warning: Async Storage has been extracted from react-native core and will be removed in a future release It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. See https://github.com/react-native-async-storage/async-storage

seigel commented 2 years ago

Thanks. Yeah...i have to find some cycles to clean this up, apply the myriad of changes that others have done to keep this working and move forward.

cxandros commented 2 years ago

Hello, here is a patch for async storage, if you use version 7 you have to remove async storage from pouchdb-react-native package and install it separately.

diff --git a/node_modules/pouchdb-adapter-asyncstorage/src/asyncstorage_core.js b/node_modules/pouchdb-adapter-asyncstorage/src/asyncstorage_core.js
index a4c817e..ca18eb3 100644
--- a/node_modules/pouchdb-adapter-asyncstorage/src/asyncstorage_core.js
+++ b/node_modules/pouchdb-adapter-asyncstorage/src/asyncstorage_core.js
@@ -4,7 +4,7 @@
  * Adapted from https://github.com/tradle/asyncstorage-down
  */

-import { AsyncStorage } from 'react-native'
+import AsyncStorage from '@react-native-async-storage/async-storage'
 import {
   safeJsonParse,
   safeJsonStringify
@@ -109,4 +109,4 @@ AsyncStorageCore.destroy = function (dbName, callback) {
   })
 }

-module.exports = AsyncStorageCore
+export default AsyncStorageCore

for version 7 run

rm -r ./node_modules/pouchdb-react-native/node_modules/pouchdb-adapter-asyncstorage/

and the async-storage install npm install --save @react-native-async-storage/async-storage

seigel commented 2 years ago

I will take a look at this soon. Thanks!

msotnikov commented 2 years ago

@seigel I've made a PR https://github.com/seigel/pouchdb-react-native/pull/154

maximiliancsuk commented 1 year ago

Hello! Checking in because I have just stumbled on this error myself. Is there an update?