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);