-
Notifications
You must be signed in to change notification settings - Fork 476
Description
What happened?
I'm on React Native version 0.69.7
and currently using their deprecated AsyncStorage.
I want to migrate over to this package since it's the recommended solution. But when I do, the new package doesn't seem to pick up on my storage on the iPhone simulator
Here's the diff, I'm running it in a few different files:
-import { AsyncStorage } from 'react-native'
+import AsyncStorage from '@react-native-async-storage/async-storage'
When I make that change, I lose persisted data on the simulator. When I run git stash
, I can access my data again. This behavior (undoing the changes, seeing my persisted data) makes me think that @react-native-async-storage/async-storage
is somehow talking to a different store than React Native's version.
Version
1.17.10
What platforms are you seeing this issue on?
- Android
- iOS
- macOS
- Windows
- web
System Information
System:
OS: macOS 13.0
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Memory: 19.19 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/.asdf/installs/nodejs/16.14.0/bin/node
Yarn: 1.22.11 - ~/.asdf/shims/yarn
npm: 8.3.1 - ~/.asdf/plugins/nodejs/shims/npm
Watchman: 2022.10.31.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/tylerwilliams/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.17 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.7 => 0.69.7
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to Reproduce
So I made a reproduction repo and was not able to reproduce the bug. I totally understand if you close this issue, but I'm hoping by posting here, someone might know of something I did wrong.
So if you grab this repo: https://github.com/coolsoftwaretyler/AsyncStorageBugRepro
Then use the old AsyncStorage
import from react-native
and uncomment this line, then run the app, it'll set the value.
Then close the app, comment the line out, and swap to using @react-native-async-storage/async-storage
. I expected not to get the value, but it does work in my reproduction app.