Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setItem is not a function #1160

Open
2 of 5 tasks
coderBeat opened this issue Nov 12, 2024 · 1 comment
Open
2 of 5 tasks

setItem is not a function #1160

coderBeat opened this issue Nov 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@coderBeat
Copy link

What happened?

I am using @react-native-async-storage/async-storage for storing the data.

import AsyncStorage from '@react-native-async-storage/async-storage';
AsyncStorage.setItem(DATA_KEY, JSON.stringify(data));

it gives me the following error:

(NOBRIDGE) ERROR Error storing data [TypeError: _reactNativeSensitiveInfo.default.setItem is not a function (it is undefined)]

Why I am getting this error ?

Version

2.0.0

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

info Fetching system and libraries information...
System:
  OS: macOS 13.5.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 361.97 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.9.0
    path: ~/.nvm/versions/node/v20.9.0/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 10.1.0
    path: ~/.nvm/versions/node/v20.9.0/bin/npm
  Watchman:
    version: 2024.08.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/xxxxxxxx/.rvm/gems/ruby-3.3.4/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "25"
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 30.0.3
      - 31.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-29 | Google Play Intel x86 Atom
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs Intel x86_64 Atom
      - android-34 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12169540
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 3.3.4
    path: /Users/xxxxxxxx/.rvm/rubies/ruby-3.3.4/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: 15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: 0.76.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Steps to Reproduce

  1. Import AsyncStorage from '@react-native-async-storage/async-storage'
  2. call setItem:
    AsyncStorage.setItem(DATA_KEY, JSON.stringify(data));
@coderBeat coderBeat added the bug Something isn't working label Nov 12, 2024
@coder-shubh
Copy link

It's woking fine I think there should be any code error from your side.

Package
@react-native-async-storage/async-storage": "^2.1.0"

Using
import AsyncStorage from '@react-native-async-storage/async-storage';
AsyncStorage.setItem('DATA_KEY', JSON.stringify(data));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants