From df909cf4e6aa99fbd9c662cfd9f313a9b07e157e Mon Sep 17 00:00:00 2001 From: Geoffrey Goh Date: Thu, 18 Aug 2016 12:05:36 -0700 Subject: [PATCH] oops --- CodePush.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CodePush.js b/CodePush.js index 1c88bbe..efc27f3 100644 --- a/CodePush.js +++ b/CodePush.js @@ -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);