Async-storage: Async-Storage compatiblility with react-native 0.62.0-rc2?

Created on 17 Feb 2020  路  7Comments  路  Source: react-native-async-storage/async-storage

You want to:


I am using Async-Storage since it is required by redux-persistence. currently, I have react-native version 0.59 I would like to upgrade to 0.60+ but I am getting some errors during runtime regarding Async Storage not sure if it is a bug or something I missed during the upgrade process.
But the app compiles fine without any issues as I manually linked the library.
Is Async-Storage compabtible with react-native 0.62.0-rc2?

Details:


The error I am having:
image

Android

Most helpful comment

Do you have something like the following snippet in your MainApplication?

@Override
protected List<ReactPackage> getPackages() {
    List<ReactPackage> packages = new PackageList(this).getPackages();
    packages.add(new AsyncStoragePackage());
    return packages;
}

If so, you've added AsyncStoragePackage twice. Once with auto-linking, and again manually. You should remove the latter.

All 7 comments

Seems like some "leftovers" from 0.59 are blocking auto-linking. Have you tried what error message says?

Seems like some "leftovers" from 0.59 are blocking auto-linking. Have you tried what error message says?

What do you mean by "leftovers"?
If you mean that the code for the module is created in getPackages() twice I already checked that and found that it's not created twice. Not just that I also checked all places that need the library to be created on.

Btw the react-native version is 0.62 cause I did the upgrade manually depending on the following git changes here:
https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.62.0-rc.2

@Krizzu Can you please tell me what is the problem I am having?

Do you have something like the following snippet in your MainApplication?

@Override
protected List<ReactPackage> getPackages() {
    List<ReactPackage> packages = new PackageList(this).getPackages();
    packages.add(new AsyncStoragePackage());
    return packages;
}

If so, you've added AsyncStoragePackage twice. Once with auto-linking, and again manually. You should remove the latter.

@tido64 That was it, thank you, sir. I am closing this now.

@0x01Brain sorry, I've been off for some time.

By "leftovers" I meant code that was used pre-upgraded to link native modules. Since there's auto-linking in place in 0.60+, there's no need for that.

Happy to see that you've got it fixed :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muhammadn picture muhammadn  路  58Comments

loic-lopez picture loic-lopez  路  37Comments

josmithua picture josmithua  路  20Comments

hms111111 picture hms111111  路  24Comments

santhanakrishnanstark picture santhanakrishnanstark  路  67Comments