Skip to content

Commit 55864a2

Browse files
authored
Upgrade to RN 0.61.5 (#94)
1 parent 12984da commit 55864a2

File tree

15 files changed

+1120
-958
lines changed

15 files changed

+1120
-958
lines changed

.flowconfig

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
; Ignore "BUCK" generated dirs
66
<PROJECT_ROOT>/\.buckd/
77

8-
; Ignore unexpected extra "@providesModule"
9-
.*/node_modules/.*/node_modules/fbjs/.*
10-
11-
; Ignore duplicate module providers
12-
; For RN Apps installed via npm, "Libraries" folder is inside
13-
; "node_modules/react-native" but in the source repo it is in the root
14-
node_modules/react-native/Libraries/react-native/React.js
15-
168
; Ignore polyfills
179
node_modules/react-native/Libraries/polyfills/.*
1810

@@ -21,7 +13,7 @@ node_modules/react-native/Libraries/polyfills/.*
2113
node_modules/warning/.*
2214

2315
; Flow doesn't support platforms
24-
.*/Libraries/Utilities/HMRLoadingView.js
16+
.*/Libraries/Utilities/LoadingView.js
2517

2618
[untyped]
2719
.*/node_modules/@react-native-community/cli/.*/.*
@@ -42,27 +34,11 @@ module.file_ext=.js
4234
module.file_ext=.json
4335
module.file_ext=.ios.js
4436

45-
module.system=haste
46-
module.system.haste.use_name_reducers=true
47-
# get basename
48-
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
49-
# strip .js or .js.flow suffix
50-
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
51-
# strip .ios suffix
52-
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
53-
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
54-
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
55-
module.system.haste.paths.blacklist=.*/__tests__/.*
56-
module.system.haste.paths.blacklist=.*/__mocks__/.*
57-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
58-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
59-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
60-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
62-
6337
munge_underscores=true
6438

65-
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
39+
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
40+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
41+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
6642

6743
suppress_type=$FlowIssue
6844
suppress_type=$FlowFixMe
@@ -96,4 +72,4 @@ untyped-import
9672
untyped-type-import
9773

9874
[version]
99-
^0.98.0
75+
^0.105.0

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23-
project.xcworkspace
2423

2524
# Android/IntelliJ
2625
#
@@ -40,6 +39,7 @@ yarn-error.log
4039
buck-out/
4140
\.buckd/
4241
*.keystore
42+
!debug.keystore
4343

4444
# fastlane
4545
#

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The driving goal of the architecture of the boilerplate is separation of concern
4646

4747
The boilerplate contains:
4848

49-
- a [React Native](https://facebook.github.io/react-native/) (v**0.60.5**) application (in "[ejected](https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md)" mode to allow using dependencies that rely on native code)
49+
- a [React Native](https://facebook.github.io/react-native/) (v**0.61.5**) application (in "[ejected](https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md)" mode to allow using dependencies that rely on native code)
5050
- a [clear directory layout](#directory-layout) to provide a base architecture for your application
5151
- [Redux](https://redux.js.org/) (v4.0.1) to help manage state
5252
- [Redux Persist](https://github.com/rt2zz/redux-persist) (v5.10.0) to persist the Redux state
@@ -115,15 +115,15 @@ Assuming you have all the requirements installed, you can setup and run the proj
115115
- `keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000`
116116
- `cd ../..` to come back to the root folder
117117
- `yarn start` to start the metro bundler, in a dedicated terminal
118-
- `yarn react-native run-android` to run the Android application (remember to start a simulator or connect an Android phone)
118+
- `yarn android` to run the Android application (remember to start a simulator or connect an Android phone)
119119

120120
### iOS
121121

122122
- `cd ios`
123123
- `pod install` to install pod dependencies
124124
- `cd ..` to come back to the root folder
125125
- `yarn start` to start the metro bundler, in a dedicated terminal
126-
- `yarn react-native run-ios` to run the iOS application (remember to start a simulator or connect an iPhone phone)
126+
- `yarn ios` to run the iOS application (remember to start a simulator or connect an iPhone phone)
127127

128128
## Useful documentation
129129

File renamed without changes.

android/app/build.gradle

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,23 +174,14 @@ android {
174174
}
175175
}
176176
}
177-
178-
packagingOptions {
179-
pickFirst '**/armeabi-v7a/libc++_shared.so'
180-
pickFirst '**/x86/libc++_shared.so'
181-
pickFirst '**/arm64-v8a/libc++_shared.so'
182-
pickFirst '**/x86_64/libc++_shared.so'
183-
pickFirst '**/x86/libjsc.so'
184-
pickFirst '**/armeabi-v7a/libjsc.so'
185-
}
186177
}
187178

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

192183
if (enableHermes) {
193-
def hermesPath = "../../node_modules/hermesvm/android/";
184+
def hermesPath = "../../node_modules/hermes-engine/android/";
194185
debugImplementation files(hermesPath + "hermes-debug.aar")
195186
releaseImplementation files(hermesPath + "hermes-release.aar")
196187
} else {

android/app/debug.keystore

2.18 KB
Binary file not shown.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
public class MainActivity extends ReactActivity {
99

1010
/**
11-
* Returns the name of the main component registered from JavaScript.
12-
* This is used to schedule rendering of the component.
11+
* Returns the name of the main component registered from JavaScript. This is used to schedule
12+
* rendering of the component.
1313
*/
1414
@Override
1515
protected String getMainComponentName() {
Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
package com.boilerplate;
22

33
import android.app.Application;
4-
5-
import android.util.Log;
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-
}
23-
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-
}
32-
33-
@Override
34-
protected String getJSMainModuleName() {
35-
return "index";
36-
}
37-
};
15+
private final ReactNativeHost mReactNativeHost =
16+
new ReactNativeHost(this) {
17+
@Override
18+
public boolean getUseDeveloperSupport() {
19+
return BuildConfig.DEBUG;
20+
}
21+
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+
}
30+
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
4847
}
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+
}
73+
}
4974
}

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

ios/BoilerplateTests/BoilerplateTests.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 BoilerplateTests : 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);

ios/Podfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
platform :ios, '9.0'
22
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3+
34
target 'Boilerplate' do
45
# Pods for Boilerplate
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"
510
pod 'React', :path => '../node_modules/react-native/'
6-
pod 'React-Core', :path => '../node_modules/react-native/React'
7-
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/'
814
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
915
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
1016
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
@@ -14,12 +20,16 @@ target 'Boilerplate' do
1420
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
1521
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
1622
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
17-
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
23+
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
24+
1825
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
1926
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
2027
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
2128
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
22-
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'
32+
2333
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
2434
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
2535
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

0 commit comments

Comments
 (0)