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

Commit a585cbb

Browse files
deecewanMax
authored andcommitted
hoist non-react static methods in decorator (#1037)
1 parent 751bf02 commit a585cbb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CodePush.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import requestFetchAdapter from "./request-fetch-adapter";
44
import { AppState, Platform } from "react-native";
55
import RestartManager from "./RestartManager";
66
import log from "./logging";
7+
import hoistStatics from 'hoist-non-react-statics';
78

89
let NativeCodePush = require("react-native").NativeModules.CodePush;
910
const PackageMixins = require("./package-mixins")(NativeCodePush);
@@ -451,7 +452,7 @@ function codePushify(options = {}) {
451452
}
452453

453454
var decorator = (RootComponent) => {
454-
return class CodePushComponent extends React.Component {
455+
const extended = class CodePushComponent extends React.Component {
455456
componentDidMount() {
456457
if (options.checkFrequency === CodePush.CheckFrequency.MANUAL) {
457458
CodePush.notifyAppReady();
@@ -503,6 +504,8 @@ function codePushify(options = {}) {
503504
return <RootComponent {...props} />
504505
}
505506
}
507+
508+
return hoistStatics(extended, RootComponent);
506509
}
507510

508511
if (typeof options === "function") {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"dependencies": {
2020
"code-push": "1.11.2-beta",
2121
"glob": "^5.0.15",
22+
"hoist-non-react-statics": "^2.3.1",
2223
"inquirer": "1.1.2",
2324
"plist": "1.2.0",
2425
"xcode": "0.9.2"

0 commit comments

Comments
 (0)