react-native: Async storage doesn't work when debugging in chrome using genymotion emulator

Using a macbook pro running 10.11.4 El Capitan

Using AsyncStorage api with android geny motion emulator, when debugging in chrome AsyncStorage does not operate

   componentWillMount: function() {
       var token;
       AsyncStorage.getItem('token').then((data) => {
         if(data) {
           token = data;
           return token;
      } else {
        this.setState({
          noAuth: true
        });
      }
    }).then((token) => {
      setTimeout (() => {
        this.setState({
          token: token,
          loading: false,
          noAuth: true
        });
        this.props.navigator.push({
          id: 'HomeView',
          passProps: {'state': this.state},
          sceneConfig: Navigator.SceneConfigs.FadeAndroid
        });
      }, 300);
    }).

This seems to run, but my timeout/navigate to never hits the homepage if i’m in debug mode, obviously this presents a few problems because then i can’t debug why things aren’t working lol. Any guidance would be much appreciated. Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 15
  • Comments: 43 (10 by maintainers)

Most upvoted comments

There seems to be a trend of closing out issues when they’re only inactive due to users waiting for response from maintainers…not a great practice. Here we are almost 2 years later and this still hasn’t been addressed.

@hramos I think we’ve all been really patient regarding this issue, I am no longer working on react native projects at the moment but these issues that impact the speed of development are reasons why I haven’t taken up react native more in my own projects. While my open source project is much less lines of code I am also only one man and I am able to close out all issue tickets with an average time of 2 months at most to get them fixed, Facebook has a market cap of 531.59 billion dollars can we not expect big issues like this to at least be paid attention to in 2 years without being closed out and told dubious reasons why we must now create a new ticket. It’s disappointing to see a project being run this way especially one run by a company with so many resources, is it too much to ask that the build tools for the project work as advertised?

This issue is not getting re-opened. Please go ahead and open a new issue that follows the template, as advised last July.

It’s really quite a pain trying to debug an Android app. The only time AsyncStorage seems to retrieve the items while in debugging mode is when the app first opens. So a lot of the time when you make changes you’d have to close the app & reopen it.

Same issue.

I think this problem should be payed attention.

@hramos it is clear this issue is impacting development, please reopen

@hramos if you don’t have anyone to look at the issue how about you write that on the issue and then perhaps someone can pick it up and submit the PR. I don’t see what the practice of closing issues that you have not even attempted to reproduce really achieves apart from artificially reducing your list of outstanding issues. I’ve seen this happen a lot on the react-native project and it’s pretty depressing to see a project being run like this.

Guys, did you find a solution for that, switching to Expo Storage is not an option. This issue should be prioritize, I mean it is really hard to understand what happens in the app without debugging, it like shooting in the dark. This makes AsyncStorage completely useless for Android.

AsyncStorage works fine using the simulator (when not debugging in chrome), but when using an actual device, it doesn’t work. I’m not sure if I’ve taken all measures, but I just wanted to add to this.

Thanks.

UPDATE I’m using CRNA with Expo and running the program through the Expo XDE and NOT the terminal allows for AsyncStorage to work consistently–both in the simulator and physical device. I’m not sure how helpful this is but for what it’s worth, using RN with Expo through CRNA has been a lot easier for someone like me who’s new to mobile app development (first timer) and come from the “front-end” world. So, despite all the hiccups and some limitations, I’m grateful because the app I’m building and will be publishing would be non-existent. 🙏🏽

getting the same issue… You had 2 years to fix such a bug (not impressed)

same issue here …

I switched to Expo XDE, and now using Expo.SecureStore.setItemAsync and it seems to work fine for now.