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

Commit 37d243c

Browse files
author
max-mironov
committed
2 parents a2e17a8 + 3d5bf1a commit 37d243c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CodePush.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,15 @@ function codePushify(options = {}) {
482482
}
483483

484484
render() {
485-
return <RootComponent {...this.props} ref={"rootComponent"} />
485+
const props = {...this.props};
486+
487+
// we can set ref property on class components only (not stateless)
488+
// check it by render method
489+
if (RootComponent.prototype.render) {
490+
props.ref = "rootComponent";
491+
}
492+
493+
return <RootComponent {...props} />
486494
}
487495
}
488496
}

android/codepush.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Adapted from https://raw.githubusercontent.com/facebook/react-native/master/local-cli/generator-android/templates/src/app/react.gradle
22

3+
import java.nio.file.Paths;
4+
35
def config = project.hasProperty("react") ? project.react : [];
46
def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"
57

@@ -22,7 +24,10 @@ gradle.projectsEvaluated {
2224
def productFlavors = android.productFlavors.collect { flavor -> flavor.name }
2325
if (!productFlavors) productFlavors.add('')
2426
def nodeModulesPath;
25-
if (project.hasProperty('nodeModulesPath')) {
27+
if (config.root) {
28+
nodeModulesPath = Paths.get(config.root, "/node_modules");
29+
}
30+
else if (project.hasProperty('nodeModulesPath')) {
2631
nodeModulesPath = project.nodeModulesPath
2732
} else {
2833
nodeModulesPath = "../../node_modules";

0 commit comments

Comments
 (0)