React Native: Recurring Could Not Connect to Developtment Server error (timeout?) - react-native

I've been trying out React Native lately and I got everything setup right.
Im running my Android Virtual Device and my RN app is displaying and reloading just fine.
However, every after a certain amount of time, when i hit RR (refresh) i get this error:
The only way I can seem to recover from this is if I rerun React native command:
react-native run-android
After that, it's ok again..... until after a few minutes, I get that dreaded RED SCREEN OF DEATH again.
What could be causing this? Timeout of some sort?
TIA

There are some reasons for that.
You have problem on JS files you are using (you can see errors on
react packager)
You are closing the react packager terminal after run your app
It closes itself automatically with some terminal reasons
Do you get any error on react packager?

Related

Metro Bundler does not start (MacOS)

I installed React Native following the requirements in the documentation (https://reactnative.dev/docs/environment-setup) , i got all the simulators working but i have to manually open them everytime i open the project.
If i press m after npm start the following error shows "warn No apps connected. Sending "devMenu" to all React Native apps failed."
(Btw this is my first time using React-Native so sorry if this is a rookie mistake)
Does anyone know any solution ?

Troubleshooting Maximum Stack Call Size Exceeded Error in Expo App

I'm getting the infamous Maximum Stack Call Size Exceeded error in Expo app.
I understand that it's caused by code that keeps calling itself, creating an infinite loop.
Does Expo or React Native provide more information about where this error is? I've already been through my code and didn't find anything. Something a bit more specific would be helpful in narrowing down the issue.
What's evn more interesting in this case is that I only get the error in the Expo Go app. When I run the app in Android Emulator, I don't get the error and the app works fine.
Any suggestions?
I found the culprit and it's totally unexpected.
I develop web front-end in React and mobile in React Native. One of the primary reasons is code sharing.
I have a file that contains all the action types I use in managing the state of my app. Technically not but kind of an enum file. They look like this:
export const SET_IS_AUTHENTICATED = 'SET_IS_AUTHENTICATED';
export const SET_USER_INFO = 'SET_USER_INFO';
In this file, I have exactly 486 action types and this is exactly what was creating the error.
I don't need all of these action types in my mobile app but I'd decided to keep things consistent and I thought this was totally harmless so I've been sharing this enum file in all my React and React Native apps.
Here are two interesting observations:
I just started developing with Expo. Prior to that I was using straight React Native -- created through React Native CLI and I NEVER got any errors for using this file.
Even more interesting is that the Android Emulator does NOT throw any errors in the same project. Only the Expo Go app throws this error.
This may even be by design and not necessarily an undesired side effect of the Expo Go app. Not sure. I'd love to know if others have had similar experiences with the Expo Go app.
This is probably not helpful, but when I upgraded from expo sdk 41 to 43 then I started getting this error. I made no code changes besides the upgrade and now when my app loads I get the error Unhandled promise rejection, [RangeError: Maximum call stack size exceeded.]. I get the error on expo go on both platforms

React native fails to start watch mode or gets stuck while Building JavaScript bundle

I have been working with React native for a few days now. Everything seemed to be working fine until I installed Nativebase. Now either I would get this error:
OR it would get stuck at around 97% while Building JavaScript bundle after a couple of Project restarts and clearing cache. This happens regardless of whether I'm running on my phone or the emulator. I'm using the Expo XDE but its the same with the cmd.

React Native Debugger Broke

I was just coding away, when suddenly the debugger broke and every time I try to reload my app via Expo, cmd shows me the following error:
I am new to react native, hence clueless what might be wrong. Any ideas?
Thanks!
The issue was that remote JS debugging was activated via the developer menu on the phone. I must have accidentally tapped it when reloading the app.

React native server stops transforming every time

React native was working perfectly till today. But, Suddenly I'm facing a weird error. Whenever I try to load js from the react native android app. I'm getting the following messages.. Transforming progress bar is stopping exactly in 96% every time.
Let me know, If you need any extra information.
Thanks,
In my case, This was due to a package called MaterialReactNative. If there is some problem in the package, this will be stopped in transforming. If you want to know which package is making this problem. You can start react native in verbose mode.
react-native start -vvv
I hope that this will help few people who are facing the same issue.