Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 81e0f13

Browse files
committed
bind 'this' to the react component in the callbacks codePushStatusDidChange(...) and codePushDownloadDidProgress(...)
1 parent 759352d commit 81e0f13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CodePush.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ function codePushify(options = {}) {
428428
CodePush.notifyAppReady();
429429
} else {
430430
let rootComponentInstance = this.refs.rootComponent;
431-
let syncStatusCallback = rootComponentInstance && rootComponentInstance.codePushStatusDidChange;
432-
let downloadProgressCallback = rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress;
431+
let syncStatusCallback = rootComponentInstance && rootComponentInstance.codePushStatusDidChange.bind(rootComponentInstance);
432+
let downloadProgressCallback = rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress.bind(rootComponentInstance);
433433
CodePush.sync(options, syncStatusCallback, downloadProgressCallback);
434434
if (options.checkFrequency === CodePush.CheckFrequency.ON_APP_RESUME) {
435435
ReactNative.AppState.addEventListener("change", (newState) => {

0 commit comments

Comments
 (0)