react-native code push: allowable code change? - react-native

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.

Related

How to deploy codespush bundle on old targets when there are native changes on the new build

Before i continue, let me let you know that i know the code to deply to a targeted build for codepush
appcenter codepush release-react -a aountName/appName -d Production -m --description "CommentHere" -t versionName
I have tried to figure this out on my own and i have not been able to.
I have several versions of my app which i have deploy using CodePush and everything works well but I started having fears of crashes when i installed new packages on the latest build.
This implies the current code base would have new native differences as compaird to the old version.
The question is how can i deploy my new build with new native codes
and packages present to an old version of my app which does not have those
native packages without running into several crashes from all the users using the old version of the app...
I ask this cos i have a feeling if i push the new build with the new changes in UI and native chnages to the old version of my app, the app old app would crash.
If a bug comes in for an old version, how do I fix it and deploy it
for the old version only? Bugs may be critical and not everyone will
have the latest version of the app Or, the bug may only exist on a old
version of the app.
I await your response.
Code push will not affect any native code written within the Android or the iOS projects of a React-Native application. If you read the documentations carefully, it specifically says that it does not change / modify / update the native portion of the app.
Why?
This is because of the way the CodePush mechanism works. In essence, CodePush only stores and triggers the update of the JS bundle of the React-Native application.
This is why we wrap only the JS main app instance with CodePush HOC (Higher Order Component). This is what's happening when you do:
CodePush(MyApp); //wrapping the js bundle at app-root
So, unfortunately in your case, if there are native codes involved, regardless of deployment to a new or old version of the app, it has to be a AppStore / Playstore driven deployment.

I need help uploading something to expo

I want to create my own podcast app.
I found this pre-written code online (github.com/diego3g/rocketcasts) and want to tweak it in order to create my own app.
How do I upload this code into expo?
Unfortunately that React-Native app was not built using Expo. You can tell because it has ios and android folders in its root directory.
Digging deeper you can see that it uses react-native-config as a dependency. This dependency requires access to native code, which Expo does not allow. You would have to go through and remove any dependency that requires native code if you wish to use Expo. This may remove functionality and could take some time to resolve issues.
Also this application was built using react-native: 0.47.2. Currently the most recent version of react-native is 0.57.8 with 0.58.0 just around the corner. That is quite a jump to make if you plan on upgrading the react-native version. Upgrading RN is not as simple as just changing a version code.
Similarly the repos last commit was over a year ago. That means that the majority of dependencies will be out of date and will need upgraded. Again, some dependencies aren’t a simple upgrade you would need to check every single one to make sure that it doesn’t cause unforeseen problems. You would also need to check their compatibility with Expo.
Personally I wouldn’t copy the project. I would look at how they have implemented the functionality and then in a new react-native project I would re-implement the functionality. That way all dependencies would be up to date and you would know that it would work.
Going down the path of editing an existing project like this one may be quite a challenge.
Either way good luck.
You can find more information about Expo here https://docs.expo.io/
And you can find a good explanation of the differences between Expo and react-native init here What is the difference between Expo and React Native?
The standard way to tweak an existing GitHub repository you don't own is to:
fork the repo (that is a GitHub operation, creating a copy of the repo in your account)
clone it and modify it: you can then push back to your GitHub fork.

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

Does react native enable live update without updating app?

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.