Does react native enable live update without updating app? - react-native

I saw somewhere that you can update your code live in production with react-native (I can't remember where I saw it)
However, the javascript is bundled and packaged with the app, I don't think you can update javascript code without a new release.
Does react-native enable you to live update your js code in production or not?

Ya you can manage it with expo or you can use third party continuous deployment tools like code-push from Microsoft.
https://github.com/Microsoft/react-native-code-push
you can easily manage Staging and Production and environment.
you can roll out to some percentage.
can revert back.
all the js code can be updated but no native code.Otherwise you may face crashing issues.

Related

Best practice for using Expo development builds while also having Testflight version

I'm building a React Native app and, because I'm working on payments, Expo recommends I use their development build methodology. This is working pretty well.
I am also beginning to push versions of my app to App Store Connect, to share them with specific testers via Testflight. This also works fine.
However, as the developer, I can't have both the development build and the latest Testflight version installed on my phone at the same time because they have the same name.
I'm curious what are best practices React Native developers have to get around situations like this. Is it renaming the development build version of the app to free up that namespace?
To install both at the same time you need to create your development clients with different bundle identifier. There is a guide for that here https://docs.expo.dev/build-reference/variants/.

Code-Push with CI/CD and native dependency changes

I am readying an app for release to the app stores and I'm concerned with CI/CD pipeline and Code-Push.
How does this scenario play out:
If a developer makes NPM dependency updates and there is a package updated that has native code changes that the JS relies on, will Code-Push still update the JS bundle on user devices ahead of their device downloading the native code updates?
Just so my question is clear, I'm not trying to OTA update native code - I'm referring to a situation where some package like react-native-device-info has native Java/Swift code and also has JS code that requires some api or event constant from the native code. If you bump the package version for react-native-device-info to a new release and there is changes to both native and JS code, would code-push have any way to know to not update the bundle until the native code/app was updated because the JS bundle has code that depends on the native code?
Or, am I thinking of using the tool Code-Push wrong?
The way codepush works is that it updates the JS bundle of your app. Your requirement is to update a NPM package which has a native change and update only your client side which is not possible.
If you do this you will probably end up with a crash of your app when the JS contacts the native code.
would code-push have any way to know to not update the bundle until the native code/app was updated because the JS bundle has code that depends on the native code?
Simple answer NO
Codepush is targeted on a version number so your new version which hits the stores will have a new version number so no point of updating the bundle of the old version of the app.
If you really want all your users to move to a new version push an alert or some sort of message using codepush asking the user to update.

code push react native not changed library updates on users App

When I changed a library (like 'react-native-image-crop-picker') version on package.json and distribute it with code push in users app the version not changed.
They see older version of that library in app.
what should I do?
Code Push only works with JS code. It doesn't allow to push native binaries. In your case, you have to update app bundles in stores to update your native dependencies.
The CodePush plugin helps get product improvements in front of your end users instantly, by keeping your JavaScript and images synchronized with updates you release to the CodePush server.
Taken from Code Push docs.

Expo uses old code even though new code has been deployed

I have a react-native app that is using Expo.
In the beginning of the project I pushed some code to the default publishing channel that was never intended to be used in production.
Since then I have released dozens of versions to production and mostly all works as expected. (New installs gets the latest JS code)
However, a few users still gets old versions of the code, even though they literally just downloaded the app from App Store / Google Play.
This is extremely frustrating. How can I make sure that fresh downloads of the app will download the correct/latest version och my JS?
Note that this is not related to the app detecting new code that might be available for download. It is the fact that the wrong code is downloaded and used to begin with. Is there any way to remove all JS-code except the very last version that I published? I imagine that would solve my issue
Turns out, expo don’t always do this successfully. You need to rebuild the react native bundle before publishing.https://proandroiddev.com/bundling-react-native-during-android-release-builds-ec52c24e200d
This is what expo gives as a feature known as Over the Air updates (OTA). Whenever a new version is built with expo channel, it automatically updates even in the app store and play store. But there is a way to disable the updates. the expo documentation for disabling:
It is possible to entirely disable OTA JavaScript updates in a standalone app, by setting updates.enabled to false in app.json. This will ignore all code paths that fetch app bundles from Expo's servers. In this case, all updates to your app will need to be routed through the iOS App Store and/or Google Play Store.
This setting is ignored in the Expo client.
And I do recommend you to read the documents of OTA, which is a good feature when you get to know all of it.
The expo link is expo OTA

react-native code push: allowable code change?

I'm using react-native-code-push for my app.
I had released several versions that change only a few of js bugs, which worked fine.
Recently I realized that if a code pushed release involves any change of native code other than javascript, the app crashes while updating. I added several react native packages that need manual linking such as react-native-maps, and released update to some targeted versions hoping them to take those, but no luck.
Then what if an update only involves adding light libraries (using npm install) which don't require native linking? I wonder to what extent exactly the code push allows client-side code updating.
Basically, when you want to add some native code involving link you will have to rebuild your apk / ipa and re-upload it to the stores. If you want to add a new plugin without link there should not be any problem
One advice I could give is to only push bug fixes to your production app. You should not push new features with codepush since apple review (almost) all the applications.