I know this question is asked before but I applied the solutions offered on Warning: Can't call setState (or forceUpdate) on an unmounted component
When I run this program in Expo the program starts and gives warning message "Warning: Can't call setState (or forceUpdate) on an unmounted component ..." but after some time it hangs up. If I build signed apk it takes too much time to install and the application immediately crashes after start up.
The source code of the application is here please give me the idea why I am still getting this warning message. Thanks in advance.
I didn't used React native user flux somehow right way. So that I have made changes to source code that mainly on App.js for the login process. All the changes could be seen as "stackoverflow question - warning-cant-call-setstate-or-forceupdate" commit messages on github for this question.
Related
I have a Vue3 app which is giving me multiple errors only when I mount a specific component within my generic modal component. On desktop across browsers I get zero errors and everything works as expected. On iOS (using desktop Safari connected locally to capture console logs) it shows the log below, along with a few other "Maximum recursive updates..." from other components (which have nothing to do with the modal or it's inner template).
I've checked every single component that is listed in the error below ("at~") and every other component that is used in that modal template (it's only one template that breaks) and NONE of them are using a mounted hook, so the "Unhandled exception during mounted hook" doesn't make any sense.
I know this is not much to go on, but has anyone else seen this recursive error happen only in certain components and only in iOS before?
In addition to the above, I've double checked all logic for any recursive issues and have found none. And, if there really were some, I would assume they would show up on desktop as well, not only on iOS.
Pretty stumped here, friends.
I have a React Native app. It works well most of the time, but in our automated error detection framework, I can see some users infrequently run into a crash in React Native. There is a SIGABRT and a bunch of lines like this in the stack trace:
facebook::react::JSIExecutor::defaultTimeoutInvoker
I'm reasonably confident that the issue isn't directly in my application's code -- not only is the stacktrace all React Native stuff, but one of my coworkers triggered the error right after logging in a couple times, and I've never triggered this error myself despite testing the login flow many times.
Other websites make it seem like the error might actually be in a native module (but not React Native itself), but I wasn't able to figure out how to debug which native module it could be (the error doesn't happen often enough to easily just try disabling native modules one by one or anything like that).
Is there a way to get more information about what is actually causing a crash when the crash is in native code?
Thanks!
I've a strange problem in app I'm currently coding.
Here is the story of the app :
I've used React Native's ScrollView as a horizontal slider,
I display maximum 5~6 slides so I don't need to use FlatList for this.
Slides are actually records coming from the database so actually they are some dynamic components
and slider works as expected.
In every slide, there are also are some option buttons (Touchables) to send data to the server.
When the user presses a button app is opening a modal window to confirm and then sending some data to server.
Until now all is okay.
The Problem :
But in some slides of the slider I'm having a strange problem :
"console.log" commands and also network commands to send data to server is not working.
On the screen, I see Buttons(Touchables) are working and also the modal I've coded is also appearing & disappearing according to the state variables. But somehow console.log commands and also network commands are not even executed. Since I can't log anything it's also hard to understand the problem.
Is there anyone had a similar problem ?
Thanks
I've finally solved this problem, wanted to share my experience here.
In the app I was making post requests to the backend with Axios,
but I wasn't interested in the result of this post requests,
they were just log records so the result of backend calls weren't important.
So I didn't use any "await" command or didn't code anything like Promise.then / catch,
just posted with Axios and scrolled to another slide in my app without waiting for the backend.
After the 8th Axios post, app started not to work.
It seems like working .. touchable effects , modals even navigation works
but nothing else was working. Event console.log commands weren't working.
It's an interesting behavior of React Native , but I've understood the situation after reading the blog below :
https://medium.com/#rotemmiz/react-native-internals-a-wider-picture-part-1-messagequeue-js-thread-7894a7cba868#
Basic reason was that in the backend (NodeJS) I didn't return any response,
there wasn't any command like res.send("success") .. so frontend React Native app was waiting for the response.. event if I didn't use any await or Promise it was still trying to get the response and after the 7-8 call it was blocking the main thread.
If there is a way to configure Axios not to wait for the backend to answer for the post request, please write here.
Need to get the timer going even if the app is running in backgroung.
Trying to use react-native-background-timer library to do so, but getting this error:
undefined is not an object (evaluating 'RNBackgroundTimer.setTimeout)
On some research got to know that I will have to eject expo to be able to use this.
Is there a way to do this with expo?
Yes actually within Expo itself you can use their Background Fetch API to handle all background tasks, it uses TaskManager under the hood to do that. You don't need to use react-native-background-timer.
Further details of this API and application is found here.
Hope this Helps!
In the following code, the first console.log message prints pretty much instantly. Then everything just hangs (I'm initially assumed it was waiting for the body of the response to be returned). The Body of the response is only about 26K, the time waiting seems to be indefinite UNLESS, I shake the phone and interact with the debug menu. As soon as I interact with the debug menu, the promise resolves and everything moves along as expected. My interactions with the debug menu can be simple, like hide inspector, show inspector, just takes something to kick the promise resolution into gear and everything is fine.
fetch(SEARCH_URL, requestBody)
.then((response) => {console.log(response); return response.json();})
.then((responseData) => {
debugger
...
Note:
Disconnecting from the debugger and running the code does not exhibit the slowness (and not being connected to the debugger ignores the debugger statements)
And yes, I have rebooted the computer.
Might have found something in https://github.com/facebook/react-native/issues/6679
As you've found out yourself, this is a known bug that should be fixed in react-native v0.31
It is a known bug that parsing responses can lag badly when remote debugging is enabled. Disabling remote debugging should speed this up a lot.
You can read the issue for details and other workarounds.
What worked for me is moving the fetch calls inside the constructor of a react component. Otherwise they never resolve. Hope this helps