This is just a quick bug fix release that also improves upon the existing getCurrentPackage
method. It is now available on NPM and can be updated immediately by running npm i --save react-native-code-push@latest
.
New Features
-
Metadata about the currently running update can now be reliably retrieved The existing
getCurrentPackage
method allowed programmatically retrieving the metadata for CodePush updates (e.g. what is its label? is it mandatory?), but unfortunately, it would always return the "latest" locally available update, which could either be the running update or a pending update. Therefore, there wasn't a reliable way to get the metadata for the update that is currently running, that disregarded any pending updates To address this, we are deprecating thegetCurrentPackage
method and replacing it with a newgetUpdateMetadata
method that allows explicitly specifying whether you want the metadata for the running, pending or latest (using the same behavior asgetCurrentPackage
) update. Check out the docs for more details.import codePush, { UpdateState } from "react-native-code-push"; // Reliably get the running update metadata // Both of these calls are equivalent codePush.getUpdateMetadata(); codePush.getUpdateMetadata(UpdateState.RUNNING); // Check if there is a pending update, and if so, get its metadata codePush.getUpdateMetadata(UpdateState.PENDING); // Provides the same behavior as the existing getCurrentPackage method. // The return object still contains the isPending property to determine // if the latest update is pending or not. codePush.getUpdateMetadata(UpdateState.LATEST);
-
The
notifyApplicationReady
method has been aliased asnotifyAppReady
to be more consistent with the use of "App" instead of "Application" in most React Native APIs (e.g.AppRegistry
,AppState
). To prevent a breaking change,notifyApplicationReady
isn't removed, but our docs will prescribe the new alias moving forward.
Bug Fixes (iOS)
- We resolved a bug where CodePush updates on disk weren't correctly being cleared after bumping the app version when using React Native packager as opposed to specifying
[CodePush bundleURL]
as your JS bundle location.