Skip to content

Commit 7e220ec

Browse files
authored
Merge pull request #33 from a7urag/upgrade_rn_0.61
Upgrade React Native to 0.61.5
2 parents 091d106 + 7503d4a commit 7e220ec

File tree

14 files changed

+964
-1427
lines changed

14 files changed

+964
-1427
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ This repo supports the latest version of React Native (v0.57.8+) supported by RN
1414

1515
**UPDATE** (2nd November '19): RNN upgraded to v2.26.2 | RN to 0.59.10
1616

17+
**UPDATE** (27th April '20): RNN upgraded to v3.7.0 | RN to 0.61.5 | React to 16.9.0
18+
1719
### Who is this for?
1820

1921
Someone looking to jumpstart building apps using RN and prefers TS. The base setup has been taken care of, just `yarn install` and get going from respective IDEs.

android/app/build.gradle

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import com.android.build.OutputFile
7373
*/
7474

7575
project.ext.react = [
76-
entryFile: "index.js"
76+
entryFile: "index.js"
7777
]
7878

7979
apply from: "../../node_modules/react-native/react.gradle"
@@ -93,6 +93,10 @@ def enableSeparateBuildPerCPUArchitecture = false
9393
*/
9494
def enableProguardInReleaseBuilds = false
9595

96+
def jscFlavor = 'org.webkit:android-jsc:+'
97+
98+
def enableHermes = project.ext.react.get("enableHermes", false);
99+
96100
android {
97101
compileSdkVersion rootProject.ext.compileSdkVersion
98102
buildToolsVersion rootProject.ext.buildToolsVersion
@@ -110,6 +114,7 @@ android {
110114
packagingOptions {
111115
exclude "lib/arm64-v8a/libgnustl_shared.so"
112116
}
117+
missingDimensionStrategy "RNN.reactNativeVersion", "reactNative60"
113118
}
114119
compileOptions {
115120
sourceCompatibility JavaVersion.VERSION_1_8
@@ -134,7 +139,7 @@ android {
134139
variant.outputs.each { output ->
135140
// For each separate APK per architecture, set a unique version code as described here:
136141
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
137-
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3]
142+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3]
138143
def abi = output.getFilter(OutputFile.ABI)
139144
if (abi != null) { // null for the universal-debug, universal-release variants
140145
output.versionCodeOverride =
@@ -147,12 +152,20 @@ android {
147152
dependencies {
148153
implementation fileTree(dir: "libs", include: ["*.jar"])
149154
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
150-
implementation "com.facebook.react:react-native:+" // From node_modules
155+
implementation "com.facebook.react:react-native:0.61.5" // From node_modules
151156
implementation project(':react-native-navigation')
152157

153158
implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
154159
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
155160
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
161+
162+
if (enableHermes) {
163+
def hermesPath = "../../node_modules/hermes-engine/android/";
164+
debugImplementation files(hermesPath + "hermes-debug.aar")
165+
releaseImplementation files(hermesPath + "hermes-release.aar")
166+
} else {
167+
implementation jscFlavor
168+
}
156169
}
157170

158171
// Run this once to be able to run the application with BUCK
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
package com.fridayapp;
22

3-
//import com.facebook.react.ReactActivity;
43
import com.reactnativenavigation.NavigationActivity;
54

65
public class MainActivity extends NavigationActivity {
76

8-
/**
9-
* Returns the name of the main component registered from JavaScript.
10-
* This is used to schedule rendering of the component.
11-
*/
12-
// @Override
13-
// protected String getMainComponentName() {
14-
// return "FridayApp";
15-
// }
167
}
Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package com.fridayapp;
22

3-
import android.app.Application;
43

5-
import com.facebook.react.ReactApplication;
64
import com.facebook.react.ReactNativeHost;
75
import com.facebook.react.ReactPackage;
8-
import com.facebook.react.shell.MainReactPackage;
9-
import com.facebook.soloader.SoLoader;
106

117
import com.reactnativenavigation.NavigationApplication;
128
import com.reactnativenavigation.react.NavigationReactNativeHost;
@@ -20,63 +16,28 @@ public class MainApplication extends NavigationApplication {
2016
@Override
2117
protected ReactGateway createReactGateway() {
2218
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
23-
@Override
24-
protected String getJSMainModuleName() {
25-
return "index";
26-
}
27-
};
19+
@Override
20+
protected String getJSMainModuleName() {
21+
return "index";
22+
}
23+
};
2824

29-
return new ReactGateway(this, isDebug(), host);
25+
return new ReactGateway(this, isDebug(), host);
3026
}
3127

3228
@Override
3329
public boolean isDebug() {
34-
return BuildConfig.DEBUG;
30+
return BuildConfig.DEBUG;
3531
}
3632

3733
protected List<ReactPackage> getPackages() {
38-
// Add additional packages you require here
39-
// No need to add RnnPackage and MainReactPackage
40-
return Arrays.<ReactPackage>asList(
41-
// eg. new VectorIconsPackage()
42-
);
34+
return Arrays.<ReactPackage>asList(
35+
// eg. new VectorIconsPackage()
36+
);
4337
}
4438

4539
@Override
4640
public List<ReactPackage> createAdditionalReactPackages() {
47-
return getPackages();
41+
return getPackages();
4842
}
49-
}
50-
51-
//public class MainApplication extends Application implements ReactApplication {
52-
//
53-
// private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
54-
// @Override
55-
// public boolean getUseDeveloperSupport() {
56-
// return BuildConfig.DEBUG;
57-
// }
58-
//
59-
// @Override
60-
// protected List<ReactPackage> getPackages() {
61-
// return Arrays.<ReactPackage>asList(
62-
// new MainReactPackage()
63-
// );
64-
// }
65-
//
66-
// @Override
67-
// protected String getJSMainModuleName() {
68-
// return "index";
69-
// }
70-
// };
71-
//
72-
// @Override
73-
// public ReactNativeHost getReactNativeHost() {
74-
// return mReactNativeHost;
75-
// }
76-
//
77-
// @Override
78-
// public void onCreate() {
79-
// super.onCreate();
80-
// SoLoader.init(this, /* native exopackage */ false);
81-
// }
82-
//}
43+
}

android/build.gradle

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,34 @@ allprojects {
3030
jcenter()
3131
maven {
3232
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
33-
url "$rootDir/../node_modules/react-native/android"
33+
url("$rootDir/../node_modules/react-native/android")
34+
}
35+
maven {
36+
// Android JSC is installed from npm
37+
url("$rootDir/../node_modules/jsc-android/dist")
3438
}
3539
maven { url 'https://jitpack.io' }
40+
3641
}
3742
}
3843

3944
subprojects { subproject ->
40-
afterEvaluate {
41-
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
42-
android {
43-
variantFilter { variant ->
44-
def names = variant.flavors*.name
45-
if (names.contains("reactNative51") || names.contains("reactNative55")) {
46-
setIgnore(true)
47-
}
48-
}
49-
}
45+
afterEvaluate {
46+
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
47+
android {
48+
variantFilter { variant ->
49+
def names = variant.flavors*.name
50+
if (names.contains("reactNative51") ||
51+
names.contains("reactNative55") ||
52+
names.contains("reactNative56") ||
53+
names.contains("reactNative57") ||
54+
names.contains("reactNative57_5")
55+
) {
56+
setIgnore(true)
5057
}
58+
}
5159
}
60+
}
5261
}
53-
54-
55-
task wrapper(type: Wrapper) {
56-
gradleVersion = '4.7'
57-
distributionUrl = distributionUrl.replace("bin", "all")
5862
}
63+

android/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19+
android.useAndroidX=true
20+
android.enableJetifier=true

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip

android/settings.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
rootProject.name = 'FridayApp'
2+
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
23
include ':react-native-navigation'
3-
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
4+
project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app')
45
include ':app'

0 commit comments

Comments
 (0)