antoniopresto / react-native-local-mongodb

react-native local mongodb storage.
MIT License
304 stars 66 forks source link

Support RN 0.59 AsyncStorage deprecated #53

Closed harveyconnor closed 5 years ago

harveyconnor commented 5 years ago
harveyconnor commented 5 years ago

Alternative solution is to include the storage key in your Datastore constructor, please add typings for this.

import AsyncStorage from '@react-native-community/async-storage';

const db = new Datastore({
    ...,
    storage: AsyncStorage
});
antoniopresto commented 5 years ago

thank you @harveyconnor!

antoniopresto commented 5 years ago

Hy, @harveyconnor - I tested it on a simulator and this branch did not work, were you able to run a project with this change? I had to do a rollback.

harveyconnor commented 5 years ago

@antoniopresto I'm currently using your 3.0.2 branch and it seems to work fine. There are some issues when you remove asyncstorage from node modules as it still gets picked up. I guess its best to wait for more community support on the asyncstorage as it seems its not fully deprecated from RN.

I'm not sure which option we're supposed to used when imported either. We used to import AsyncStorage from 'react-native' and that worked fine, however when we do that there's no default export anymore for AsyncStorage.

Unless we make some changes to RNC AsyncStorage we'll have to wait and see.

narayanchoudhary commented 1 year ago

@harveyconnor After adding the storage option i am not able to retrieve the old data stored

https://github.com/antoniopresto/react-native-local-mongodb/issues/80#issue-1760060398