Skip to content

setItem not working in upgrade . reactnative 66.5 -> 77.3 / async-storage 1.15.14-> 1.17.10 #851

Description

@kwangjaeyoo

What happened?

setItem not working in upgrade in reactnative 66-> 77.3 / async-storage 1.15.14-> 1.17.10

this is my setData function (working in before upgrade)

export async function saveData(key: string, value: any) {
try {
await AsyncStorage.setItem(key, JSON.stringify(value), error => {
if (error === null) {
console.log('key = ' + key + ' save success');
} else {
console.log('key = ' + key + ' save failed');
console.log(error);
console.log('error ! ' + JSON.stringify(error));
}
});
} catch (e: any) {
}
}

log--------------------

LOG key = countryCode save failed
LOG undefined
LOG error ! undefined
LOG key = language save failed
LOG undefined
LOG error ! undefined


let keys = await AsyncStorage.getAllKeys();

for (key of keys) {
console.log('!!! ' + key + ' / ' + JSON.stringify(loadData(key)));
}

log ------------------------
LOG !!! countryCode / {"_h":0,"_i":0,"_j":null,"_k":null}
LOG !!! language / {"_h":0,"_i":0,"_j":null,"_k":null}
LOG !!! pushToken / {"_h":0,"_i":0,"_j":null,"_k":null}

Version

1.17.10

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

System:
    OS: macOS 12.5.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 291.50 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.10.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.2 - /opt/homebrew/bin/npm
    Watchman: 2022.10.03.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8815526
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: ^9.1.3 => 9.1.3 
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.3 => 0.70.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to Reproduce

The same issue if you upgrade or newly install the app.

(android , ios same issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions