Skip to content

Commit 3b736f6

Browse files
committed
fix: update to react-native 0.60.5
1 parent f30aef3 commit 3b736f6

File tree

21 files changed

+574
-828
lines changed

21 files changed

+574
-828
lines changed

.gitignore

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,29 @@ build/
3030
local.properties
3131
*.iml
3232

33+
# Visual Studio Code
34+
#
35+
.vscode/
36+
3337
# node.js
3438
#
3539
node_modules/
3640
npm-debug.log
3741
yarn-error.log
3842

3943
# BUCK
44+
#
4045
buck-out/
4146
\.buckd/
4247
*.keystore
4348

4449
# fastlane
4550
#
51+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
52+
# screenshots whenever they are needed.
53+
# For more information about the recommended setup visit:
54+
# https://docs.fastlane.tools/best-practices/source-control/
55+
4656
*/fastlane/report.xml
4757
*/fastlane/Preview.html
4858
*/fastlane/screenshots
@@ -51,7 +61,12 @@ buck-out/
5161
#
5262
*.jsbundle
5363

54-
# Tests
64+
# CocoaPods
65+
#
66+
/ios/Pods/
67+
5568

56-
.jest/
57-
coverage/
69+
# Custom
70+
#
71+
coverage/
72+
build/

android/app/build.gradle

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import com.android.build.OutputFile
1818
* // the entry file for bundle generation
1919
* entryFile: "index.android.js",
2020
*
21+
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22+
* bundleCommand: "ram-bundle",
23+
*
2124
* // whether to bundle JS and assets in debug mode
2225
* bundleInDebug: false,
2326
*
@@ -73,7 +76,7 @@ import com.android.build.OutputFile
7376
*/
7477

7578
project.ext.react = [
76-
entryFile: "index.js"
79+
entryFile: "index.js",
7780
]
7881

7982
apply from: "../../node_modules/react-native/react.gradle"
@@ -93,6 +96,28 @@ def enableSeparateBuildPerCPUArchitecture = false
9396
*/
9497
def enableProguardInReleaseBuilds = false
9598

99+
/**
100+
* The preferred build flavor of JavaScriptCore.
101+
*
102+
* For example, to use the international variant, you can use:
103+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
104+
*
105+
* The international variant includes ICU i18n library and necessary data
106+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
107+
* give correct results when using with locales other than en-US. Note that
108+
* this variant is about 6MiB larger per architecture than default.
109+
*/
110+
def jscFlavor = 'org.webkit:android-jsc:+'
111+
112+
/**
113+
* Whether to enable the Hermes VM.
114+
*
115+
* This should be set on project.ext.react and mirrored here. If it is not set
116+
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
117+
* and the benefits of using Hermes will therefore be sharply reduced.
118+
*/
119+
def enableHermes = project.ext.react.get("enableHermes", false);
120+
96121
android {
97122
compileSdkVersion rootProject.ext.compileSdkVersion
98123

@@ -116,8 +141,22 @@ android {
116141
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
117142
}
118143
}
144+
signingConfigs {
145+
debug {
146+
storeFile file('debug.keystore')
147+
storePassword 'android'
148+
keyAlias 'androiddebugkey'
149+
keyPassword 'android'
150+
}
151+
}
119152
buildTypes {
153+
debug {
154+
signingConfig signingConfigs.debug
155+
}
120156
release {
157+
// Caution! In production, you need to generate your own keystore file.
158+
// see https://facebook.github.io/react-native/docs/signed-apk-android.
159+
signingConfig signingConfigs.debug
121160
minifyEnabled enableProguardInReleaseBuilds
122161
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
123162
}
@@ -126,21 +165,38 @@ android {
126165
applicationVariants.all { variant ->
127166
variant.outputs.each { output ->
128167
// For each separate APK per architecture, set a unique version code as described here:
129-
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
130-
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
168+
// https://developer.android.com/studio/build/configure-apk-splits.html
169+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
131170
def abi = output.getFilter(OutputFile.ABI)
132171
if (abi != null) { // null for the universal-debug, universal-release variants
133172
output.versionCodeOverride =
134173
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
135174
}
175+
136176
}
137177
}
178+
179+
packagingOptions {
180+
pickFirst '**/armeabi-v7a/libc++_shared.so'
181+
pickFirst '**/x86/libc++_shared.so'
182+
pickFirst '**/arm64-v8a/libc++_shared.so'
183+
pickFirst '**/x86_64/libc++_shared.so'
184+
pickFirst '**/x86/libjsc.so'
185+
pickFirst '**/armeabi-v7a/libjsc.so'
186+
}
138187
}
139188

140189
dependencies {
141190
implementation fileTree(dir: "libs", include: ["*.jar"])
142-
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
143191
implementation "com.facebook.react:react-native:+" // From node_modules
192+
193+
if (enableHermes) {
194+
def hermesPath = "../../node_modules/hermesvm/android/";
195+
debugImplementation files(hermesPath + "hermes-debug.aar")
196+
releaseImplementation files(hermesPath + "hermes-release.aar")
197+
} else {
198+
implementation jscFlavor
199+
}
144200
}
145201

146202
// Run this once to be able to run the application with BUCK
@@ -149,3 +205,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
149205
from configurations.compile
150206
into 'libs'
151207
}
208+
209+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

android/app/proguard-rules.pro

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,3 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11-
12-
# If your project uses WebView with JS, uncomment the following
13-
# and specify the fully qualified class name to the JavaScript interface
14-
# class:
15-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16-
# public *;
17-
#}

android/app/src/debug/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" android:networkSecurityConfig="@xml/react_native_config" />
8-
</manifest>
7+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
8+
</manifest>

android/app/src/debug/res/xml/react_native_config.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

android/app/src/main/java/com/example/MainApplication.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package com.example;
22

33
import android.app.Application;
4+
import android.util.Log;
45

6+
import com.facebook.react.PackageList;
7+
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8+
import com.facebook.react.bridge.JavaScriptExecutorFactory;
59
import com.facebook.react.ReactApplication;
610
import com.facebook.react.ReactNativeHost;
711
import com.facebook.react.ReactPackage;
8-
import com.facebook.react.shell.MainReactPackage;
912
import com.facebook.soloader.SoLoader;
1013

11-
import java.util.Arrays;
1214
import java.util.List;
1315

1416
public class MainApplication extends Application implements ReactApplication {
@@ -21,9 +23,11 @@ public boolean getUseDeveloperSupport() {
2123

2224
@Override
2325
protected List<ReactPackage> getPackages() {
24-
return Arrays.<ReactPackage>asList(
25-
new MainReactPackage()
26-
);
26+
@SuppressWarnings("UnnecessaryLocalVariable")
27+
List<ReactPackage> packages = new PackageList(this).getPackages();
28+
// Packages that cannot be autolinked yet can be added manually here, for example:
29+
// packages.add(new MyReactNativePackage());
30+
return packages;
2731
}
2832

2933
@Override

android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<!-- Base application theme. -->
44
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
55
<!-- Customize your theme here. -->
6+
<item name="android:textColor">#000000</item>
67
</style>
78

89
</resources>

android/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ buildscript {
1313
jcenter()
1414
}
1515
dependencies {
16-
classpath 'com.android.tools.build:gradle:3.3.1'
16+
classpath("com.android.tools.build:gradle:3.4.1")
1717

1818
// NOTE: Do not place your application dependencies here; they belong
1919
// in the individual module build.gradle files
@@ -23,11 +23,16 @@ buildscript {
2323
allprojects {
2424
repositories {
2525
mavenLocal()
26-
google()
27-
jcenter()
2826
maven {
2927
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
30-
url "$rootDir/../node_modules/react-native/android"
28+
url("$rootDir/../node_modules/react-native/android")
29+
}
30+
maven {
31+
// Android JSC is installed from npm
32+
url("$rootDir/../node_modules/jsc-android/dist")
3133
}
34+
35+
google()
36+
jcenter()
3237
}
3338
}

android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
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+
20+
android.useAndroidX=true
21+
android.enableJetifier=true
1.26 KB
Binary file not shown.

0 commit comments

Comments
 (0)