App crashes after setting state from asyncstorage
See original GitHub issueReact 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:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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*
fromreact-native-gesture-handler
. Replacing this withTouchable*
from RN does not produce the problem.Head over to
react-native-gesture-handler
and report issue there.Yeah. thanks @Krizzu . VSCode imported it from RNGestureHandler.