Skip to content

Commit 583fc9c

Browse files
committed
Update example to RN 0.61.1
1 parent cb7c376 commit 583fc9c

File tree

11 files changed

+581
-526
lines changed

11 files changed

+581
-526
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ yarn-error.log
3939
buck-out/
4040
\.buckd/
4141
*.keystore
42+
!debug.keystore
4243

4344
# Bundle artifact
4445
*.jsbundle

example/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

example/android/app/debug.keystore

2.2 KB
Binary file not shown.
Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
package com.rnpermissionsexample;
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
}

example/android/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ buildscript {
1313
jcenter()
1414
}
1515
dependencies {
16-
classpath("com.android.tools.build:gradle:3.4.1")
16+
classpath("com.android.tools.build:gradle:3.4.2")
1717

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

3535
google()
3636
jcenter()
37+
maven { url 'https://jitpack.io' }
3738
}
3839
}
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

example/ios/Podfile

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

44
target 'RNPermissionsExample' do
5+
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
6+
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
7+
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
8+
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
59
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'
10+
pod 'React-Core', :path => '../node_modules/react-native/'
11+
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
12+
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
813
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
914
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
1015
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
@@ -14,13 +19,15 @@ target 'RNPermissionsExample' do
1419
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
1520
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
1621
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
17-
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
22+
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
1823

1924
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
2025
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
2126
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
2227
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
23-
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
28+
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
29+
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
30+
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
2431

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

0 commit comments

Comments
 (0)