Skip to content

Commit

Permalink
Upgrade to RN_0.60.3 and Enable Hermes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhaskar Gyan Vardhan committed Jul 16, 2019
1 parent 430ffe6 commit 3d05ebc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
22 changes: 21 additions & 1 deletion App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { Text, View, Button } from 'react-native';
import { Text, View, Button,StyleSheet } from 'react-native';
import {
createStackNavigator,
withNavigationFocus,
Expand All @@ -23,6 +23,11 @@ class HomeScreen extends Component {
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
{global.HermesInternal == null ? null : (
<View style={styles.engine}>
<Text style={styles.footer}>Engine: Hermes</Text>
</View>
)}
<Text>Home Screen</Text>
<Button
title="Go to Flat List"
Expand Down Expand Up @@ -71,6 +76,21 @@ const navigatorStack = createStackNavigator(
initialRouteName: 'HomeCart',
},
);
const styles = StyleSheet.create({

engine: {
position: 'absolute',
right: 0,
},
footer: {
color: "#000000",
fontSize: 12,
fontWeight: '600',
padding: 4,
paddingRight: 12,
textAlign: 'right',
},
});

const App = createAppContainer(navigatorStack);
export default App;
23 changes: 17 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ import com.android.build.OutputFile
*/

project.ext.react = [
entryFile: "index.js"
entryFile: "index.js",
enableHermes: true,
]

apply from: "../../node_modules/react-native/react.gradle"
Expand All @@ -103,8 +104,8 @@ def enableProguardInReleaseBuilds = false
* when using with locales other than en-US.
* Note that this variant is about 6MiB larger per architecture than default.
*/
def useIntlJsc = false

def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion

Expand Down Expand Up @@ -169,6 +170,14 @@ android {
}
}
}
packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
}
}

dependencies {
Expand All @@ -178,11 +187,13 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules

// JSC from node_modules
if (useIntlJsc) {
implementation 'org.webkit:android-jsc-intl:+'
if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation 'org.webkit:android-jsc:+'
implementation jscFlavor
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.reactnativememoryprofile;

import android.app.Application;

import android.util.Log;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
Expand All @@ -10,6 +10,8 @@
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;

import java.util.List;

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"patch-package": "^6.1.2",
"postinstall": "^0.4.2",
"react": "16.8.6",
"react-native": "0.60.0",
"react-native": "0.60.3",
"react-native-device-info": "^0.28.1",
"react-native-elements": "^1.1.0",
"react-native-gesture-handler": "^1.3.0",
Expand All @@ -28,13 +28,13 @@
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/runtime": "^7.4.5",
"@babel/core": "^7.5.4",
"@babel/runtime": "^7.5.4",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.8.0",
"eslint": "^6.0.1",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.54.1",
"metro-react-native-babel-preset": "^0.55.0",
"node-pre-gyp": "^0.13.0",
"react-test-renderer": "16.8.6",
"ws": ">=3.3.1"
Expand Down

0 comments on commit 3d05ebc

Please sign in to comment.