Skip to content

Commit 25bc7fd

Browse files
authored
Merge pull request #50 from react-native-community/template-update-0.60.3
updated template to match latest version
2 parents e4ee885 + 3b1b16e commit 25bc7fd

File tree

6 files changed

+62
-31
lines changed

6 files changed

+62
-31
lines changed

template/App.tsx

100644100755
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Sample React Native App
33
* https://github.com/facebook/react-native
4-
*
4+
*
55
* Generated with the TypeScript template
66
* https://github.com/emin93/react-native-template-typescript
77
*
@@ -35,6 +35,11 @@ const App = () => {
3535
contentInsetAdjustmentBehavior="automatic"
3636
style={styles.scrollView}>
3737
<Header />
38+
{global.HermesInternal == null ? null : (
39+
<View style={styles.engine}>
40+
<Text style={styles.footer}>Engine: Hermes</Text>
41+
</View>
42+
)}
3843
<View style={styles.body}>
3944
<View style={styles.sectionContainer}>
4045
<Text style={styles.sectionTitle}>Step One</Text>
@@ -73,6 +78,10 @@ const styles = StyleSheet.create({
7378
scrollView: {
7479
backgroundColor: Colors.lighter,
7580
},
81+
engine: {
82+
position: 'absolute',
83+
right: 0,
84+
},
7685
body: {
7786
backgroundColor: Colors.white,
7887
},
@@ -94,6 +103,14 @@ const styles = StyleSheet.create({
94103
highlight: {
95104
fontWeight: '700',
96105
},
106+
footer: {
107+
color: Colors.dark,
108+
fontSize: 12,
109+
fontWeight: '600',
110+
padding: 4,
111+
paddingRight: 12,
112+
textAlign: 'right',
113+
},
97114
});
98115

99116
export default App;

template/__tests__/App-test.tsx

100644100755
File mode changed.

template/android/app/build.gradle

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ import com.android.build.OutputFile
7676
*/
7777

7878
project.ext.react = [
79-
entryFile: "index.js"
79+
entryFile: "index.js",
80+
enableHermes: false, // clean and rebuild if changing
8081
]
8182

8283
apply from: "../../node_modules/react-native/react.gradle"
@@ -97,13 +98,26 @@ def enableSeparateBuildPerCPUArchitecture = false
9798
def enableProguardInReleaseBuilds = false
9899

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

108122
android {
109123
compileSdkVersion rootProject.ext.compileSdkVersion
@@ -159,19 +173,30 @@ android {
159173
output.versionCodeOverride =
160174
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
161175
}
176+
162177
}
163178
}
179+
180+
packagingOptions {
181+
pickFirst '**/armeabi-v7a/libc++_shared.so'
182+
pickFirst '**/x86/libc++_shared.so'
183+
pickFirst '**/arm64-v8a/libc++_shared.so'
184+
pickFirst '**/x86_64/libc++_shared.so'
185+
pickFirst '**/x86/libjsc.so'
186+
pickFirst '**/armeabi-v7a/libjsc.so'
187+
}
164188
}
165189

166190
dependencies {
167191
implementation fileTree(dir: "libs", include: ["*.jar"])
168192
implementation "com.facebook.react:react-native:+" // From node_modules
169193

170-
// JSC from node_modules
171-
if (useIntlJsc) {
172-
implementation 'org.webkit:android-jsc-intl:+'
194+
if (enableHermes) {
195+
def hermesPath = "../../node_modules/hermesvm/android/";
196+
debugImplementation files(hermesPath + "hermes-debug.aar")
197+
releaseImplementation files(hermesPath + "hermes-release.aar")
173198
} else {
174-
implementation 'org.webkit:android-jsc:+'
199+
implementation jscFlavor
175200
}
176201
}
177202

template/android/app/src/main/java/com/helloworld/MainApplication.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.helloworld;
22

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

56
import com.facebook.react.PackageList;
7+
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8+
import com.facebook.react.bridge.JavaScriptExecutorFactory;
69
import com.facebook.react.ReactApplication;
710
import com.facebook.react.ReactNativeHost;
811
import com.facebook.react.ReactPackage;

template/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
},
99
"dependencies": {
1010
"react": "16.8.6",
11-
"react-native": "0.60.0"
11+
"react-native": "0.60.3"
1212
},
1313
"devDependencies": {
14-
"@babel/core": "^7.3.3",
15-
"@babel/runtime": "^7.3.1",
14+
"@babel/core": "^7.5.0",
15+
"@babel/runtime": "^7.5.0",
1616
"@react-native-community/eslint-config": "^0.0.3",
1717
"@types/jest": "^24.0.15",
1818
"@types/react": "^16.8.23",
19-
"@types/react-native": "^0.60.0",
19+
"@types/react-native": "^0.60.1",
2020
"@types/react-test-renderer": "^16.8.2",
2121
"babel-jest": "^24.1.0",
2222
"jest": "^24.1.0",
2323
"metro-react-native-babel-preset": "^0.54.1",
24-
"react-test-renderer": "^16.8.6",
24+
"react-test-renderer": "16.8.6",
2525
"typescript": "^3.5.3"
2626
},
2727
"jest": {

template/tsconfig.json

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

0 commit comments

Comments
 (0)