This commit is contained in:
Geoffrey Goh
2016-08-18 12:05:36 -07:00
parent e1edb83ab4
commit df909cf4e6

View File

@@ -430,13 +430,19 @@ function codePushify(options = {}) {
let rootComponentInstance = this.refs.rootComponent;
let syncStatusCallback;
if (rootComponentInstance && rootComponentInstance.codePushStatusDidChange && rootComponentInstance instanceof React.Component) {
syncStatusCallback = rootComponentInstance.codePushStatusDidChange.bind(rootComponentInstance);
if (rootComponentInstance && rootComponentInstance.codePushStatusDidChange) {
syncStatusCallback = rootComponentInstance.codePushStatusDidChange;
if (rootComponentInstance instanceof React.Component) {
syncStatusCallback = syncStatusCallback.bind(rootComponentInstance);
}
}
let downloadProgressCallback;
if (rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress && rootComponentInstance instanceof React.Component) {
downloadProgressCallback = rootComponentInstance.codePushDownloadDidProgress.bind(rootComponentInstance);
if (rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress) {
downloadProgressCallback = rootComponentInstance.codePushDownloadDidProgress;
if (rootComponentInstance instanceof React.Component) {
downloadProgressCallback = downloadProgressCallback.bind(rootComponentInstance);
}
}
CodePush.sync(options, syncStatusCallback, downloadProgressCallback);