Skip to content

Commit 50744d4

Browse files
committed
added RN 57.2 (android compilation improved)
1 parent 8d589e9 commit 50744d4

File tree

29 files changed

+3180
-2588
lines changed

29 files changed

+3180
-2588
lines changed

.babelrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"presets": ["react-native"]
2+
"presets": ["module:metro-react-native-babel-preset"],
3+
"plugins": [
4+
["@babel/plugin-proposal-decorators", { "legacy": true }]
5+
]
36
}

.flowconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ node_modules/react-native/flow-github/
2929
[options]
3030
emoji=true
3131

32+
esproposal.optional_chaining=enable
33+
esproposal.nullish_coalescing=enable
34+
3235
module.system=haste
3336
module.system.haste.use_name_reducers=true
3437
# get basename
@@ -64,4 +67,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
6467
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
6568

6669
[version]
67-
^0.75.0
70+
^0.78.0

.ncurc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"upgrade": true,
3+
"reject": [
4+
"@babel/core",
5+
"@babel/plugin-proposal-class-properties",
6+
"@babel/plugin-proposal-decorators",
7+
"@babel/runtime",
8+
"metro-react-native-babel-preset",
9+
"react-native-device-info",
10+
"react",
11+
"schedule",
12+
"eslint",
13+
"eslint-plugin-react",
14+
"eslint-plugin-jest"
15+
]
16+
}

android/app/build.gradle

Lines changed: 7 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,6 @@ apply plugin: "com.android.application"
22

33
import com.android.build.OutputFile
44

5-
/**
6-
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7-
* and bundleReleaseJsAndAssets).
8-
* These basically call `react-native bundle` with the correct arguments during the Android build
9-
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10-
* bundle directly from the development server. Below you can see all the possible configurations
11-
* and their defaults. If you decide to add a configuration block, make sure to add it before the
12-
* `apply from: "../../node_modules/react-native/react.gradle"` line.
13-
*
14-
* project.ext.react = [
15-
* // the name of the generated asset file containing your JS bundle
16-
* bundleAssetName: "index.android.bundle",
17-
*
18-
* // the entry file for bundle generation
19-
* entryFile: "index.android.js",
20-
*
21-
* // whether to bundle JS and assets in debug mode
22-
* bundleInDebug: false,
23-
*
24-
* // whether to bundle JS and assets in release mode
25-
* bundleInRelease: true,
26-
*
27-
* // whether to bundle JS and assets in another build variant (if configured).
28-
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29-
* // The configuration property can be in the following formats
30-
* // 'bundleIn${productFlavor}${buildType}'
31-
* // 'bundleIn${buildType}'
32-
* // bundleInFreeDebug: true,
33-
* // bundleInPaidRelease: true,
34-
* // bundleInBeta: true,
35-
*
36-
* // whether to disable dev mode in custom build variants (by default only disabled in release)
37-
* // for example: to disable dev mode in the staging build type (if configured)
38-
* devDisabledInStaging: true,
39-
* // The configuration property can be in the following formats
40-
* // 'devDisabledIn${productFlavor}${buildType}'
41-
* // 'devDisabledIn${buildType}'
42-
*
43-
* // the root of your project, i.e. where "package.json" lives
44-
* root: "../../",
45-
*
46-
* // where to put the JS bundle asset in debug mode
47-
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48-
*
49-
* // where to put the JS bundle asset in release mode
50-
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51-
*
52-
* // where to put drawable resources / React Native assets, e.g. the ones you use via
53-
* // require('./image.png')), in debug mode
54-
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55-
*
56-
* // where to put drawable resources / React Native assets, e.g. the ones you use via
57-
* // require('./image.png')), in release mode
58-
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59-
*
60-
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61-
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62-
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
63-
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64-
* // for example, you might want to remove it from here.
65-
* inputExcludes: ["android/**", "ios/**"],
66-
*
67-
* // override which node gets called and with what additional arguments
68-
* nodeExecutableAndArgs: ["node"],
69-
*
70-
* // supply additional arguments to the packager
71-
* extraPackagerArgs: []
72-
* ]
73-
*/
74-
755
project.ext.react = [
766
entryFile: "index.js"
777
]
@@ -106,6 +36,10 @@ android {
10636
ndk {
10737
abiFilters "armeabi-v7a", "x86"
10838
}
39+
multiDexEnabled true
40+
dexOptions {
41+
javaMaxHeapSize "8g"
42+
}
10943
}
11044
splits {
11145
abi {
@@ -137,10 +71,12 @@ android {
13771
}
13872

13973
dependencies {
74+
implementation project(':react-native-navigation')
75+
implementation 'com.android.support:multidex:1.0.3'
14076
implementation fileTree(dir: "libs", include: ["*.jar"])
14177
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
78+
implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
14279
implementation "com.facebook.react:react-native:+" // From node_modules
143-
implementation project(':react-native-navigation')
14480
}
14581

14682
// Run this once to be able to run the application with BUCK

android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
package="com.reduxtemplate">
33

44
<uses-permission android:name="android.permission.INTERNET" />
5+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
6+
<uses-permission android:name="android.permission.VIBRATE" />
7+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
58
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
79

810
<application
911
android:name=".MainApplication"

android/app/src/main/java/com/reduxtemplate/MainActivity.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,4 @@
44

55
public class MainActivity extends SplashActivity {
66

7-
/**
8-
* Returns the name of the main component registered from JavaScript.
9-
* This is used to schedule rendering of the component.
10-
*/
11-
12-
protected String getMainComponentName() {
13-
return "reduxTemplate";
14-
}
157
}

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.reduxtemplate;
22

33
import com.facebook.react.ReactPackage;
4+
import com.facebook.soloader.SoLoader;
45
import com.reactnativenavigation.NavigationApplication;
56

67
import java.util.Arrays;
@@ -18,7 +19,7 @@ protected List<ReactPackage> getPackages() {
1819
// Add additional packages you require here
1920
// No need to add RnnPackage and MainReactPackage
2021
return Arrays.<ReactPackage>asList(
21-
// eg. new VectorIconsPackage()
22+
// new VectorIconsPackage()
2223
);
2324
}
2425

@@ -29,6 +30,12 @@ public List<ReactPackage> createAdditionalReactPackages() {
2930

3031
@Override
3132
public String getJSMainModuleName() {
32-
return "index";
33+
return "index";
34+
}
35+
36+
@Override
37+
public void onCreate() {
38+
super.onCreate();
39+
SoLoader.init(this, /* native exopackage */ false);
3340
}
3441
}

android/build.gradle

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4+
ext {
5+
buildToolsVersion = "27.0.3"
6+
minSdkVersion = 16
7+
compileSdkVersion = 27
8+
targetSdkVersion = 26
9+
supportLibVersion = "27.1.1"
10+
}
411
repositories {
512
jcenter()
613
google()
714
}
815
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.0.1'
16+
classpath 'com.android.tools.build:gradle:3.1.4'
17+
18+
// NOTE: Do not place your application dependencies here; they belong
19+
// in the individual module build.gradle files
1020
}
1121
}
1222

@@ -18,17 +28,12 @@ allprojects {
1828
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
1929
url "$rootDir/../node_modules/react-native/android"
2030
}
21-
maven {
22-
url 'https://maven.google.com/'
23-
name 'Google'
24-
}
31+
google()
2532
}
2633
}
2734

28-
ext {
29-
buildToolsVersion = "26.0.3"
30-
minSdkVersion = 16
31-
compileSdkVersion = 26
32-
targetSdkVersion = 26
33-
supportLibVersion = "26.1.0"
35+
36+
task wrapper(type: Wrapper) {
37+
gradleVersion = '4.4'
38+
distributionUrl = distributionUrl.replace("bin", "all")
3439
}

android/gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
1212
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13-
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
13+
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
1414

1515
# When configured, Gradle will run in incubating parallel mode.
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
18-
# org.gradle.parallel=true
18+
org.gradle.parallel=true
1919

2020
android.useDeprecatedNdk=true
21+
android.enableAapt2=false
2.01 KB
Binary file not shown.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
#Mon Apr 02 17:58:08 BRT 2018
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
7-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 commit comments

Comments
 (0)