mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 02:14:52 +08:00
guard against codePushDownloadDidProgress(...) or codePushStatusDidChange(...) not being defined
This commit is contained in:
11
CodePush.js
11
CodePush.js
@@ -428,8 +428,15 @@ function codePushify(options = {}) {
|
||||
CodePush.notifyAppReady();
|
||||
} else {
|
||||
let rootComponentInstance = this.refs.rootComponent;
|
||||
let syncStatusCallback = rootComponentInstance && rootComponentInstance.codePushStatusDidChange.bind(rootComponentInstance);
|
||||
let downloadProgressCallback = rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress.bind(rootComponentInstance);
|
||||
if (rootComponentInstance && rootComponentInstance.codePushStatusDidChange) {
|
||||
syncStatusCallback = rootComponentInstance.codePushStatusDidChange.bind(rootComponentInstance);
|
||||
}
|
||||
|
||||
let downloadProgressCallback;
|
||||
if (rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress) {
|
||||
downloadProgressCallback = rootComponentInstance.codePushDownloadDidProgress.bind(rootComponentInstance);
|
||||
}
|
||||
|
||||
CodePush.sync(options, syncStatusCallback, downloadProgressCallback);
|
||||
if (options.checkFrequency === CodePush.CheckFrequency.ON_APP_RESUME) {
|
||||
ReactNative.AppState.addEventListener("change", (newState) => {
|
||||
|
||||
Reference in New Issue
Block a user