Questions tagged [asyncstorage]

AsyncStorage is an asynchronous, unencrypted, persistent, key-value storage system for React Native.

The React Native documentation can be found here and the official one here.

It is recommended that you use an abstraction on top of AsyncStorage instead of AsyncStorage directly for anything more than light usage, since it operates globally.

It has support for callbacks and promises.

970 questions
66
votes
9 answers

Is React Native's Async Storage secure?

I want to store sensitive data locally in a React Native app. Is the data only available to the app that wrote it?
yogiben
  • 835
  • 1
  • 8
  • 9
59
votes
6 answers

Wipe AsyncStorage in react native

I notice that I am wasting a certain amount of time debugging redux actions that I am persisting to AsyncStorage in react-native thanks to redux-persist. Sometimes I'd just like to wipe AsyncStorage to save some development time and try with fresh…
jsdario
  • 6,477
  • 7
  • 41
  • 75
54
votes
11 answers

React Native - How to see what's stored in AsyncStorage?

I save some items to AsyncStorage in React Native and I am using chrome debugger and iOS simulator. Without react native, using regular web development localStorage, I was able to see the stored localStorage items under Chrome Debugger > Resources >…
Wonka
  • 8,244
  • 21
  • 73
  • 121
34
votes
7 answers

How to test Async Storage with Jest?

I'm building an app with React Native. I want to minimize how often I communicate to the database, so I make heavy use of AsyncStorage. There's a lot of room for bugs in the translation between DB and AsyncStorage though. Therefore, I want to make…
Brian Case
  • 373
  • 1
  • 3
  • 7
33
votes
5 answers

React Native - Play Store Warning "Starting May 5th you must let us know why your app requires broad storage access"

I have a react native app which is on play store for some time and recently i received this important notice from play store, stating if i don't fix this my app will be removed from play store. Can anyone tell me what this is and how to fix it? Here…
Mandeep Bagga
  • 393
  • 4
  • 11
32
votes
3 answers

Waiting for AsyncStorage.getItem()

I am using AsyncStorage in my React Native application to store information about the user. The getItem() function is asynchronous and requires me to implement a callback when I want to load data from the storage system.…
Adam Jakiela
  • 2,188
  • 7
  • 30
  • 48
29
votes
1 answer

Using Realm in React Native app with Redux

I am about to undertake the development of a React Native app and am thoroughly convinced of the benefits of managing the app's state using Redux, however I'd like to make the app's data available whilst offline by using Realm for persistent…
oldo.nicho
  • 2,149
  • 2
  • 25
  • 39
27
votes
8 answers

How to remove an item from AsyncStorage in react-native

How to remove an item from AsyncStorage? right now I am trying this code: AsyncStorage.removeItem('userId'); but this is not working for me.
achu
  • 639
  • 2
  • 10
  • 26
19
votes
4 answers

How to check if a key exists in AsyncStorage in React Native? getItem() always returns a promise object

I'm trying to check whether a key is available in AsyncStorage with AsyncStorage.getItem('key_name'). If the key is not available it is not returning null, it still returns following promise object: Promise _45:0 _54:null _65:null _81:1 My…
Mostafiz Rahman
  • 8,169
  • 7
  • 57
  • 74
17
votes
3 answers

React-Native AsyncStorage.clear() is failing on IOS

I'm using AsyncStorage.clear() which is working just fine on Android but when run using iOS platform (real device) I'm getting this error and can't find anything online about it. Error: Failed to delete storage directory.Error…
Robel Robel Lingstuyl
  • 1,341
  • 1
  • 11
  • 28
17
votes
2 answers

default values from initial state are loaded before store rehydrates with redux-persist

I'm having trouble accessing saved data after app starts with redux-persist. The reducer initializes with data defined in my initial state. By the time the previous session's state loads with AsyncStorage, the component is already displayed with the…
amirfl
  • 1,634
  • 2
  • 18
  • 34
14
votes
3 answers

TypeError: undefined is not an object (evaluating '_asyncStorage.AsyncStorage.setItem')

Version: @react-native-community/async-storage = ^1.6.1 Problem: Importing AsyncStorage like this: import { AsyncStorage } from '@react-native-community/async-storage' Using in my code like this: AsyncStorage.setItem('locale',…
SimonartM
  • 668
  • 2
  • 11
  • 26
14
votes
3 answers

React Native StackNavigator initialRouteName

In React Native Navigation library 'react-navigation' How could I set StackNavigator initialRouteName by AsyncStorage? function getInitialScreen() { AsyncStorage.getItem('initialScreen') .then(screenName => { return…
amorenew
  • 10,760
  • 10
  • 47
  • 69
14
votes
2 answers

How and where to save the whole redux store using AsyncStorage

I was wondering if I have to do something like this to save the whole store of my app using AsyncStorage in my react-native app and check if it exists when the app is starting. var store; _loadInitialState = async () => { try { var value =…
Luis Rizo
  • 2,009
  • 4
  • 15
  • 34
13
votes
6 answers

React Native - Return all JSON data in AsyncStorage?

In my React Native app's AsyncStorage, I have multiple JSON objects, each with a unique key id like so: '62834456': data: { "foo": "bar", "nicknames": [ "grizz", "example" ], ... and so on } They have been pushed into AsyncStorage stringified.…
zahnzy
  • 237
  • 1
  • 2
  • 13
1
2 3
64 65