Skip to content

Commit 8269288

Browse files
authored
Merge pull request #76 from react-native-community/rn-0.61
Upgrade to RN 0.61.1
2 parents 557e791 + 5188e83 commit 8269288

File tree

10 files changed

+93
-63
lines changed

10 files changed

+93
-63
lines changed

template/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @format
99
*/
1010

11-
import React, {Fragment} from 'react';
11+
import React from 'react';
1212
import {
1313
SafeAreaView,
1414
StyleSheet,
@@ -28,7 +28,7 @@ import {
2828

2929
const App = () => {
3030
return (
31-
<Fragment>
31+
<>
3232
<StatusBar barStyle="dark-content" />
3333
<SafeAreaView>
3434
<ScrollView
@@ -70,7 +70,7 @@ const App = () => {
7070
</View>
7171
</ScrollView>
7272
</SafeAreaView>
73-
</Fragment>
73+
</>
7474
);
7575
};
7676

template/_gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ yarn-error.log
4444
buck-out/
4545
\.buckd/
4646
*.keystore
47+
!debug.keystore
4748

4849
# fastlane
4950
#

template/android/app/build.gradle

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,27 +176,18 @@ android {
176176

177177
}
178178
}
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-
}
188179
}
189180

190181
dependencies {
191182
implementation fileTree(dir: "libs", include: ["*.jar"])
192183
implementation "com.facebook.react:react-native:+" // From node_modules
193184

194185
if (enableHermes) {
195-
def hermesPath = "../../node_modules/hermesvm/android/";
196-
debugImplementation files(hermesPath + "hermes-debug.aar")
197-
releaseImplementation files(hermesPath + "hermes-release.aar")
186+
def hermesPath = "../../node_modules/hermes-engine/android/";
187+
debugImplementation files(hermesPath + "hermes-debug.aar")
188+
releaseImplementation files(hermesPath + "hermes-release.aar")
198189
} else {
199-
implementation jscFlavor
190+
implementation jscFlavor
200191
}
201192
}
202193

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

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

55
public class MainActivity extends ReactActivity {
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-
@Override
12-
protected String getMainComponentName() {
13-
return "HelloWorld";
14-
}
7+
/**
8+
* Returns the name of the main component registered from JavaScript. This is used to schedule
9+
* rendering of the component.
10+
*/
11+
@Override
12+
protected String getMainComponentName() {
13+
return "HelloWorld";
14+
}
1515
}
Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
package com.helloworld;
22

33
import android.app.Application;
4-
import android.util.Log;
5-
4+
import android.content.Context;
65
import com.facebook.react.PackageList;
7-
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8-
import com.facebook.react.bridge.JavaScriptExecutorFactory;
96
import com.facebook.react.ReactApplication;
107
import com.facebook.react.ReactNativeHost;
118
import com.facebook.react.ReactPackage;
129
import com.facebook.soloader.SoLoader;
13-
10+
import java.lang.reflect.InvocationTargetException;
1411
import java.util.List;
1512

1613
public class MainApplication extends Application implements ReactApplication {
1714

18-
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
19-
@Override
20-
public boolean getUseDeveloperSupport() {
21-
return BuildConfig.DEBUG;
22-
}
15+
private final ReactNativeHost mReactNativeHost =
16+
new ReactNativeHost(this) {
17+
@Override
18+
public boolean getUseDeveloperSupport() {
19+
return BuildConfig.DEBUG;
20+
}
2321

24-
@Override
25-
protected List<ReactPackage> getPackages() {
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;
31-
}
22+
@Override
23+
protected List<ReactPackage> getPackages() {
24+
@SuppressWarnings("UnnecessaryLocalVariable")
25+
List<ReactPackage> packages = new PackageList(this).getPackages();
26+
// Packages that cannot be autolinked yet can be added manually here, for example:
27+
// packages.add(new MyReactNativePackage());
28+
return packages;
29+
}
3230

33-
@Override
34-
protected String getJSMainModuleName() {
35-
return "index";
36-
}
37-
};
31+
@Override
32+
protected String getJSMainModuleName() {
33+
return "index";
34+
}
35+
};
3836

3937
@Override
4038
public ReactNativeHost getReactNativeHost() {
@@ -45,5 +43,32 @@ public ReactNativeHost getReactNativeHost() {
4543
public void onCreate() {
4644
super.onCreate();
4745
SoLoader.init(this, /* native exopackage */ false);
46+
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
47+
}
48+
49+
/**
50+
* Loads Flipper in React Native templates.
51+
*
52+
* @param context
53+
*/
54+
private static void initializeFlipper(Context context) {
55+
if (BuildConfig.DEBUG) {
56+
try {
57+
/*
58+
We use reflection here to pick up the class that initializes Flipper,
59+
since Flipper library is not available in release mode
60+
*/
61+
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
62+
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
63+
} catch (ClassNotFoundException e) {
64+
e.printStackTrace();
65+
} catch (NoSuchMethodException e) {
66+
e.printStackTrace();
67+
} catch (IllegalAccessException e) {
68+
e.printStackTrace();
69+
} catch (InvocationTargetException e) {
70+
e.printStackTrace();
71+
}
72+
}
4873
}
4974
}

template/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ buildscript {
66
minSdkVersion = 16
77
compileSdkVersion = 28
88
targetSdkVersion = 28
9-
supportLibVersion = "28.0.0"
109
}
1110
repositories {
1211
google()
1312
jcenter()
1413
}
1514
dependencies {
16-
classpath("com.android.tools.build:gradle:3.4.1")
15+
classpath("com.android.tools.build:gradle:3.4.2")
1716

1817
// NOTE: Do not place your application dependencies here; they belong
1918
// in the individual module build.gradle files
@@ -34,5 +33,6 @@ allprojects {
3433

3534
google()
3635
jcenter()
36+
maven { url 'https://jitpack.io' }
3737
}
3838
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

template/ios/HelloWorldTests/HelloWorldTests.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#import <React/RCTRootView.h>
1313

1414
#define TIMEOUT_SECONDS 600
15-
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
15+
#define TEXT_TO_LOOK_FOR @"Welcome to React"
1616

1717
@interface HelloWorldTests : XCTestCase
1818

@@ -40,11 +40,13 @@ - (void)testRendersWelcomeScreen
4040
BOOL foundElement = NO;
4141

4242
__block NSString *redboxError = nil;
43+
#ifdef DEBUG
4344
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
4445
if (level >= RCTLogLevelError) {
4546
redboxError = message;
4647
}
4748
});
49+
#endif
4850

4951
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
5052
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
@@ -57,8 +59,10 @@ - (void)testRendersWelcomeScreen
5759
return NO;
5860
}];
5961
}
60-
62+
63+
#ifdef DEBUG
6164
RCTSetLogFunction(RCTDefaultLogFunction);
65+
#endif
6266

6367
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
6468
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);

template/ios/Podfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
33

44
target 'HelloWorld' do
55
# Pods for HelloWorld
6+
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
7+
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
8+
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
9+
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
610
pod 'React', :path => '../node_modules/react-native/'
7-
pod 'React-Core', :path => '../node_modules/react-native/React'
8-
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
11+
pod 'React-Core', :path => '../node_modules/react-native/'
12+
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
13+
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
914
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
1015
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
1116
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
@@ -15,13 +20,15 @@ target 'HelloWorld' do
1520
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
1621
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
1722
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
18-
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
23+
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
1924

2025
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
2126
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
2227
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
2328
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
24-
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
29+
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
30+
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
31+
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
2532

2633
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
2734
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'

template/package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6+
"android": "react-native run-android",
7+
"ios": "react-native run-ios",
68
"start": "react-native start",
79
"test": "jest"
810
},
911
"dependencies": {
10-
"react": "16.8.6",
11-
"react-native": "0.60.5"
12+
"react": "16.8.1",
13+
"react-native": "0.61.1"
1214
},
1315
"devDependencies": {
1416
"@babel/core": "^7.5.0",
1517
"@babel/runtime": "^7.5.0",
1618
"@react-native-community/eslint-config": "^0.0.3",
1719
"@types/jest": "^24.0.18",
18-
"@types/react": "^16.9.2",
19-
"@types/react-native": "^0.60.14",
20-
"@types/react-test-renderer": "^16.9.0",
20+
"@types/react": "16.8.19",
21+
"@types/react-native": "0.60.15",
22+
"@types/react-test-renderer": "16.8.1",
2123
"babel-jest": "^24.1.0",
2224
"jest": "^24.1.0",
23-
"metro-react-native-babel-preset": "0.54.1",
24-
"react-test-renderer": "16.8.6",
25+
"metro-react-native-babel-preset": "^0.51.1",
26+
"react-test-renderer": "16.8.1",
2527
"typescript": "^3.6.3"
2628
},
2729
"jest": {

0 commit comments

Comments
 (0)