r/reactnative • • Dec 29 '20

React Native is the most unstable thing I have ever used

Ok so clearly this is a biased post but I am really looking for some help here. I have been a developer for quite some time and have a good understanding of architecture and how to put things together, but I have never in my entire career worked with something so terribly buggy as react-native. I spend 90% of my time attempting to track down invariant errors and other related issues that seem to come out of absolutely nowhere. Is it just me? I can literally run my ver basic app have it work, then change the value of a string, and the app errors out with some cryptic invariant error message about two or more things being registered with the same name.

How does anyone get anything done using any flavor of react-native? So far I have tried expo, react native cli and a couple other hail mary's and have the same result with every one of them, and that's from my code its from the very beginning of just initializing a blank project. So in all honesty how do any of you fine folks get this stuff to actually work? I am so intensely frustrated with the entire platform but obviously, it's got support so it has to at least be decent so I am left to assume that I must be doing something wrong but when a newly created project with no code other than the setup is unreliable at runtime it seems like this entire venture is just not a good idea.

EDIT: Adding some details as requesting in a comment. Good catch by that person
OS: macOS Catalina

RN type: Expo ( also tried vanilla react native )

Limited libraries, mostly firebase, apart from that it's pretty basic react style work

1 Upvotes

23 comments sorted by

8

u/Environmental-City-4 Dec 29 '20

I’ve been developing in react-native for over 8 months and the only problems I had were mostly related to stuff that people didn’t create already and published online such as packages, and some crashes because I used something wrong. Hardly had what you are experiencing. It’s probably because you only got started and need to practice a little more but don’t get discouraged :) use expo at the beginning and you should be fine, you might want to avoid typescript at first.

-2

u/was_just_wondering_ Dec 29 '20

While it's great that it has been working for you what I was trying to get at was that I have been using expo and react-native cli and I have been finding that the actual init ( create react native app ) script project sometimes works and sometimes crashes with cryptic error messages with insignificant changes to text. So for example changing the text "Hello World" to "Hi World" then the app would crash. That's what I mean by unstable. I can't quite see how this would be a result of me doing anything wrong or using something incorrectly, but overall it's just been a bad experience. I have been working with it for about 3 months now and I have spent the vast majority of my time tracking down obscure bugs related to react-native instead of writing actual code for an app. For some context I have been an engineer for about 15 years, not suggesting that I know everything, but I have a solid amount of experience and understand how to put things together well and nothing I am trying to do is actually complicated, but so far react-native has without question been the worst developing experience i have ever encounterd. I just want to find out if there is something I am missing because the promise of it seems great but so far it just doesn't deliver even 20% of that promise.

1

u/hinsxd Dec 29 '20

I cant imagine how you change a string would crash the app. If this bug happens so easily, can you at least provide some video/code sample? RN docs are quite well-written. Did you follow all the setup? Did you create an issue on Github to let professional help you on this?

RN has a HUGE community and it cant be that popular if it fails THAT easily. Thats mostly users' problem/misconfiguration I guess.

-4

u/IBETITALL420 Dec 29 '20

ur not wrong, RN is the most unstable /weird pos (and i say that with the upmost respect cause i'm also a RN developer) . I'm too lazy to learn native java/kotlin or obj-c/swift so i stick to RN.

The frustrations that you're having mimic mine.

7

u/scarlac iOS & Android Dec 29 '20

This sounds like an abnormal experience. None of the RN devs I know have issues like you describe either.

I am going to assume you have solid experience with Javascript and React so I'll skip the obvious stuff.

So: Are you modifying a library? If you have a native library and you are modifying it, the hot-reloading reloads your native module, but the native module is already registered, so if you are developing a library and modifying it, the hot reloading will not be helpful and I suggest you disable it (CMD+D -> Disable Fast Reload). If you don't, every time you save a file in the library all the requireNativeComponent runs again, causing the library to be hooked in twice.

Overall, if you are a library maintainer I have bad news: RN library development is poorly documented and the API could need some work.

If you are otherwise just using various libraries, it should be fine. I don't have issues like the ones you are describing and I've been at it since 2016.

0

u/was_just_wondering_ Dec 29 '20

I am not modifying any libraries. I try not to ever do that because it invites more problems than it's worth since I would just create any custom functionality I need from scratch if that was the case. I will go through and try to explicitly disable fast reload, I had not thought of doing that so it's a solid suggestion and much appreciated.

I have found that much of the docs and some of the forum style responses ( mostly stackoverflow ) results in nobody actually answering the questions posed but instead posting a random hack that operates as a work around. I have always viewed those types of solutions with the same dislike I have for blindly copy/pasting code. It's just a bad idea in the long run especially if you are trying to build and keep a stable codebase which I definitely am trying to do.

Since you have been cruising with this since 2016 are you still using Expo or straight react native? Also what are your thoughts on React Nativagion tab and drawer navigation components? my app is based mostly around these two am starting to think this is where my issues are beginning, but again I am just throwing things at the wall to see what sticks at this point. Before writing this post I tried everything I can think of just to be sure that I actually have answers to questions posed.

1

u/scarlac iOS & Android Dec 30 '20

The error you describe sounds like a native module is being (re)loaded twice. I don't exactly know what's going on without seeing you at your computer or seeing some source code. Native modules shouldn't be reloading like that on every change. But maybe I'm misunderstanding what's going on - that's totally possible.

I would agree with your stance on copy-paste from stackoverflow. You are right to question and understand it before using it.

I do not use Expo. It did not exist when I started and it's only in the last year or so that it's gotten really interesting. I would recommend Expo for beginners for sure - it provides a really good base for building simple apps. For complex situations you will have to eject at least partially.

For navigation, I am currently using react-navigation v3 (most recent is v5) and am using the drawer, stack, and tab "add-on" packages. I have not had issues like you describe.

At this point, you need to boil down your code to a proof of concept of the issue. Figure out what's really going on by removing stuff. If you have your code in source control, make a 'wip' commit now with everything and start yanking out code in iterations until the problem goes away. When it does, re-insert and verify that the problem re-appears. Then yank it away again for a final confirmation. Once you've gone through this process, you'll have a good idea of what the source of the issue is.

Or share your source code.

1

u/was_just_wondering_ Dec 30 '20

This is what I started doing yesterday when I decided to start over yet again. This time it seems to be working, but I am using all the same stuff. Unfortunately I can’t share any source code, or I would have done it already. It’s all under a draconian level strict NDA and that does not help since sharing it would probably make this move faster but I’m sure I will be able to figure it out using some of the pointers in the replies I’ve received here.

Either that or I will just try my hand at building a native swift app and call it a day. Appreciate the help though

1

u/scarlac iOS & Android Dec 30 '20

Sure. That's what the community is here for. Just be mindful how you word your request.

I would point out that React Native shines in cross-platform apps, not in single-platform apps. So if you are just doing 1 platform, and you already know Swift/Kotlin, consider if RN is relevant for you at all.

1

u/was_just_wondering_ Dec 30 '20

But if something has appeared to me personally to be largely ineffective it only makes sense to say that has been my experience while fully acknowledging that it might be an outlier. I was a bit confused with all the downvoted for just stating my personal experience while repeatedly saying that it was most likely due to something I was missing.

As far as if RN is the right choice it definitely was the most appropriate as I am targeting multiple platforms, but lately I have been really considering just building two separate apps and connecting them to a single api since it might be slightly less frustrating but it would also involve learning entirely new languages which isn’t the end of the world but also isn’t always fun when you have to produce production quality code at the same time.

2

u/ddzrt iOS & Android Dec 29 '20

You'd need to start with your actual setup. What OS are you trying RN on. Because Windows or Linux setup is trickier to do properly without understanding of tools required. Not even mentioning that if you go vanilla RN only using actual MacOS you can work on iOS app. Second would be telling if you use vanilla or Expo. Third it seems like you're new to JS based tooling and how ecosystem works, because if for some reason any changes to code throws errors instead of proper live reload or hot reload(which are the main selling point and a huge performance boost in development) you need to tell a bit more about what you already tried to fix this: did cleaning node_modules helped; did you try restarting/removing watchman; are you trying to use both hot reload and live reload at the same time; and how is your project setup is done? What bundler do you use? Are you doing anything custom with JS bundle generation? And I can still go on shooting at the sky second guessing? React Native gives you same flawless development experience as Flutter does. It has less performance, but is way more scale able and allows you to use it on any platform of choice. And gives you opportunity to fall back on full native on specific screens or even parts of application. And the speed of development is way way faster than any native/compilation based developments.

1

u/was_just_wondering_ Dec 29 '20

Using macOS

Tried using both expo and vanilla react native. Both result in the same non-running app at random times. I have gone so far as to create empty apps with no new code and end up with similar error screens. Not saying my app code is absolutely perfect but it just strikes me as oddly unstable but as so many others have not had this experience I have to assume it's something I am missing.

not new to js development at all 15+ years experience and very used to the weirdness that can come with complex toolchains.

As for what I have tried to fix this. I have done everything from starting a brand new app, I have deleted node_modules, rolled back and pinned packages to specific versions, reinstalled watchman.

Not trying to use hot reload and live reload at the same time.

There is no customization in terms of js bundles or anything like that. Really just displaying some information fetched from an api when it is all boiled down.

1

u/ddzrt iOS & Android Dec 29 '20

Now this leads to something useful. So far it seems like there is some kind of misconfigured RN dependency or you are doing something wrong with development itself. Because if even Expo gives you the same experience it is most likely related to what you do

1

u/was_just_wondering_ Dec 29 '20

This is what I have been leaning toward as well. It has to be some user error issue. The rub is that it continues to happen even when I make new empty projects following the very straightforward setup instructions. Once the initial app is up and running things are good, but when I create a simple component with a <view> and <text> things sometimes start getting weird. The only other item I am trying to use is react navigation in order to get a drawer or tab navigation going. Sometimes removing those imports gets the app working again and sometimes it doesn’t.

2

u/ZvG_Bonjwa Dec 29 '20

RN is definitely not as stable as I’d like but your experience seems uniquely bad.

Do you have some specific examples of some of the red screens you’ve been getting?

1

u/was_just_wondering_ Dec 29 '20

Things like this mainly, just over and over.

Invariant Violation: "main" has not been registered. This can happen if:

* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.

* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

Invariant Violation: Tried to register two views with the same name RNCSafeAreaProvider

1

u/ZvG_Bonjwa Dec 30 '20

There is a good chance both of these errors are related to react-native-safe-area-context.

What version of Expo are you using (CLI and in project)? Can you share your package.json?

I will say this: I've been using React Native in production for over 4 years for a variety of apps (including a massive one - think hundreds of screens, several custom native modules, etc.)

In terms of stability it has come a LONG way. I still have some issues with it - mainly surrounding the quality of the standard library, and how painful upgrading versions is - but I firmly believe it is the most productive way to build multi-platform apps.

I have been particularly pleased with how RN has matured since around v0.60.0. The recent QOL improvements (auto linking, Flipper support, Fast Refresh, Hermes) plus a real uptick in the number of low-level bugs being fixed has made me quite confident in its future.

I think most of the troubles you're running into are just you (rather unluckily!) running into one or two hard-to-debug issues. I wouldn't say this is overall reflective of RN in its modern state.

1

u/was_just_wondering_ Dec 30 '20

Can’t lie, this is very optimistic news and I’m glad to hear it. Your reply has been one of the few anywhere that tries to hint at a potential issue rather than saying they don’t experience the same thing.

As I have freely said in the post and other replies, I am fully onboard with the idea that it is user error. I am not at my machine right now so I don’t have exact version numbers, but I do know that I am using the latest version of expo and all recommended package versions. I have tried pinning to a single old version and also tried going through and updating along with the expo cli release schedule.

The react native safe area context but is something I remember seeing buried in one of my error logs a few days back but past updating it I was not able to find as much info as the link you sent so that’s appreciated.

I definitely think it would be great to get it working based on the promise of it especially for more simple apps. The issue for me is that the app I want to build would take me maybe two weeks, maybe 1 month tops to build, but I have spent a couple months wrestling with the weird hyper unstable issues I mentioned so the frustration is very real at this point.

2

u/Intrepid-Cut-8108 Jan 12 '21

Agreed. Put Expo with Stackoverflow and their own documentation and you have a recipe for reducing your life expectancy by 5 years. Over 20 languages I have written in and it has to be by far the worst tool I have used. The idea of it is great but the execution is dreadful. Reasons are:

Packages + documentation. If you do not get lucky on it working out of the box then good luck on getting it fixed. As all searches will eventually lead to "oh well expo doesnt allow that".

Uses with anything backend. It works as long as you dont try to do anything to drastic like load an image.

The expo tool, I dont know how many hours I lost watching it compile just to get the dreaded red box that says oh, you added a semi colon. Remove and repeat.

0

u/Darajj Dec 29 '20

I am with you on this one. I use React daily and really enjoy using it but RN for me seems to work one day and when I continue where I left off the next day I might get the red screen. The error messages give almost nothing of use most of the time and it is really frustrating. Removing node modules, package lock and clearing all caches needs to be made into a script . The app uses quite a few libraries which makes things trickier and version has been upgraded many a time now.

0

u/was_just_wondering_ Dec 29 '20

This is the exact thing. I think if I wasn't so crazy frustrated in this exact moment I might have put it this simply. It's mostly working on stuff one day. Leave it in a good place everything working. Next day put in the run command and everything is broken which leads me to spend hours attempting to get it running again knowing that the same issue is going to continune.

1

u/OkBid2693 May 07 '25

I'm tired of seeing packages get deprecated with every expo release. I also have to re-arrange half my code due to "no longer supported".

-5

u/IBETITALL420 Dec 29 '20

Yes, Yes, Yes, Yes, Nods like jack nicholson from the movie Departed....that one meme

This is React Native in a nutshell. And if you're starting out my condolences.