hoist non-react static methods in decorator (#1037)

This commit is contained in:
David Buchan-Swanson
2017-10-10 00:05:21 +10:00
committed by Max
parent 751bf02836
commit a585cbb003
2 changed files with 5 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import requestFetchAdapter from "./request-fetch-adapter";
import { AppState, Platform } from "react-native";
import RestartManager from "./RestartManager";
import log from "./logging";
import hoistStatics from 'hoist-non-react-statics';
let NativeCodePush = require("react-native").NativeModules.CodePush;
const PackageMixins = require("./package-mixins")(NativeCodePush);
@@ -451,7 +452,7 @@ function codePushify(options = {}) {
}
var decorator = (RootComponent) => {
return class CodePushComponent extends React.Component {
const extended = class CodePushComponent extends React.Component {
componentDidMount() {
if (options.checkFrequency === CodePush.CheckFrequency.MANUAL) {
CodePush.notifyAppReady();
@@ -503,6 +504,8 @@ function codePushify(options = {}) {
return <RootComponent {...props} />
}
}
return hoistStatics(extended, RootComponent);
}
if (typeof options === "function") {

View File

@@ -19,6 +19,7 @@
"dependencies": {
"code-push": "1.11.2-beta",
"glob": "^5.0.15",
"hoist-non-react-statics": "^2.3.1",
"inquirer": "1.1.2",
"plist": "1.2.0",
"xcode": "0.9.2"