question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes after setting state from asyncstorage

See original GitHub issue

React Native version:


System:
    OS: Linux 5.0 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
    Memory: 152.31 MB / 7.70 GB
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/bin/yarn
    npm: 6.13.0 - /usr/local/bin/npm
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.4 => 0.61.4

Steps To Reproduce

On click I wanted to remove a link


function remove(index) {
    AsyncStorage.setItem(
      'links',
      JSON.stringify(Array.from(links).filter((item, i) => i !== index)),
    ).then(() =>
      AsyncStorage.getItem('links')
        .then(link => {
          setLinks(JSON.parse(link));
        })
        .then(() => ToastAndroid.show('Deleted', ToastAndroid.SHORT)),
    );
  }

Describe what you expected to happen: View should be updated but I get this error.

error linkhttps://user-images.githubusercontent.com/16081083/69478141-f160a900-0e14-11ea-8a03-a91464ac16df.png

Snack, code example, screenshot, or link to a repository: https://github.com/a-c-sreedhar-reddy/Link/blob/master/pages/Home.js#L26

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
krizzucommented, Nov 25, 2019

@a-c-sreedhar-reddy

Checked your example, the issue is not related to AsyncStorage. If’d look through the stack trace, you’ll see that the issue comes from the Touchable* from react-native-gesture-handler. Replacing this with Touchable* from RN does not produce the problem.

Head over to react-native-gesture-handler and report issue there.

0reactions
a-c-sreedhar-reddycommented, Nov 26, 2019

Yeah. thanks @Krizzu . VSCode imported it from RNGestureHandler.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes after setting state from asyncstorage/ #27317
My issue was I was importing TouchableOpacity from RNGestureHandler . When imported from react-native there is no issue. ... Sign up for free...
Read more >
React Native: Async Storage setItem causing app to crash
What is happening: When I press on the button to save it (setItem) or when I call save() in the useEffect it crashes...
Read more >
Computer Crashes with Set State and async Storage ... - Reddit
im using a tinder swiper library to show the user quotes. when they swipe down they see a new quote. whenever they leave...
Read more >
@react-native-community/async-storage Code Examples | Snyk
Learn more about how to use @react-native-community/async-storage, based on ... If the app crashed last time, don't restore nav state log("DID CRASH?
Read more >
[Solved]-How to clear AsyncStorage in React-Native?
React Native - How to store auth token and navigate to other screen after login? Proguard app crash (Caused by: java.lang.NoSuchFieldError: no "Lcom/facebook/ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found