r/reactnative • u/richpeopleshit • Apr 18 '20
The React Native 10 commandments
Thou shalt never upgrade a react native version without at least having 72 hours of dedicated time.
When you can't figure out what's wrong then delete node_modules, delete Pods, delete DerivedData, delete cache, and rebuild everything.
Something running perfectly on ios has a 50% chance of being laggy on android.
Every library added to your project will break your build at some point in the future.
Never install a library that hasn't been updated in the last
63 months.The answer to your question is in a closed github issue.
Don't be afraid to get into the native code and make changes.
Native code is a frightening place, only make changes as a last resort.
If you close your eyes before running a build command it has a 25% higher chance of building successfully.
All changes made to the native build systems will be forgotten until it breaks your build at a later date.
5
u/richpeopleshit Apr 18 '20
They are not etched in stone yet so I'm open to any suggestions :)
2
Apr 18 '20
number 1 is the holy grail for me... switched to flutter and been having a better experience there...
1
u/kbcool iOS & Android Apr 19 '20
Even minor version updates of third party libraries are guaranteed to break API contracts. Although I think this is a universal law with JavaScript.
52
u/getinnocuous21 Apr 18 '20
this is too accurate. and i've only been using RN for about 2 weeks
10
u/dandmcd Apr 19 '20
It never gets better. React Native is a miserable experience compared to normal React.
2
1
2
u/getinnocuous21 Apr 19 '20
in all fairness though, despite the odd issue i'm actually really enjoying it
1
u/FoxBearBear Apr 19 '20
I’m on react for about 2 weeks too and native for 2 days. Yesterday I spent some time debuting the code and it was not working because I used “ ” instead of ‘ ‘
1
0
13
17
u/arndomor Apr 18 '20
All true, except the first one, the best(sometimes only) way to upgrade a minor version is to restart a new project from scratch and copy your code over.
90% of the stuff takes you 10% of the time compared to native. And 10% of the things that you can easily do in native land will take you 90% time to find an unmaintained package or create some native bridge yourself.
6
5
8
u/exosoul Apr 18 '20
Something running perfectly on ios has a 50% chance of being laggy completely broken on android.
6
3
u/rockpilp Apr 18 '20
Error messages will be useful and understandable almost 50% of the time. git bisect is often more helpful.
3
u/shawn2910 Apr 18 '20
Something running perfectly on the simulator has a higher chance of failing to build too been suffering with this for the last week
3
2
2
2
u/atwarog Apr 24 '20
Building a project successfully, then coming back the next day, has a 50% chance of not building, even if no code was changed.
2
Jul 12 '20
lol so true, just encountered a n.6 https://github.com/facebook/react-native/issues/27307 which required me to open this one: https://github.com/facebook/react-native/issues/29348
2
u/osoese Apr 18 '20
6. The answer to your question is in a closed github issue. => suggesting a solution that breaks rule 5. Never install a library that hasn't been updated in the last 6 3 months. and forces you to use something that => rule 4. Every library added to your project will break your build at some point in the future.
and ofc expo is gonna update with breaking changes three versions ago so your work around isnt on it and this will happen the moment your 6 months coding spree starts to work and the day after you were too tired to build it last night. (true story for me)
...but I still love react native and even expo and ...
as a solid work around
...browserify with local import
good post
1
u/Tayk5 Apr 18 '20
The library could have been updated within the last 3 months but it could have a closed issue where someone fixed your issue by changing a config file or some other thing.
1
1
u/adrianwechner Apr 19 '20
Why is it that you cant upgrade tn version? Or how would you do it without copying code?
1
u/billcosbysbutt Apr 19 '20
I've never copied code into a new project to perform an upgrade. I've been maintaining the same project since 0.54.0 and had one issue when upgrading (I think to 0.60). Most times I have to wait for a dependency to update but I've never had to wait for more than a week or so.
I'm assuming people are making poor choices when adding dependencies. Most updates have been fine for me.
1
1
1
Apr 23 '20
I've found RN much more pleasant than React, because styling on a huge screen is hard. I don't have CSS skills.
But I find this list almost useless to me, although its probably funny/ sarcastic to a lot of other people.
It took me 2 hours to upgrade to 0.62 from 0.61.5.
Sure, but this is already recommended by RN
Android is easier for me and prefer editing xml and gradle files instead of weirdly formatted XCode proprietary files. Yes, I have an android device.
I did not know this. It might hit me in the future. But all libraries will break in the future if its not maintained: not if its maintained, e.g. https://github.com/airbnb/native-navigation
I've installed old libraries that have worked just fine.
Github issues are always a nice place to find problems, they could be closed or open though.
Don't be afraid? its not about fear, its about skill and knowledge. If you want to change it, know what you're changing, just like anything.
Doesn't this depend on what youre trying to achieve. Change native code IF you need to.
... thats just made up obviously.
Not if you understand what youre doing. Also, isn't that the same will all code. Forget about it until it breaks or you need to make a change.
12
u/Tayk5 Apr 18 '20
Oh man, this makes me concerned about choosing to learn RN over Flutter. Are there any Flutter devs here willing to share your Flutter experiences versus RN?