Skip to content

Commit 40f21df

Browse files
Marked pod as a static framework
This forced an upgrade to React Native 0.61 Fixes #5
1 parent 5feef46 commit 40f21df

20 files changed

Lines changed: 798 additions & 359 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"editor.insertSpaces": false,
33
"editor.formatOnSave": true,
4-
"react-native-tools.projectRoot": "example"
4+
"react-native-tools.projectRoot": "example",
5+
"eslint.enable": false
56
}

example/android/app/build.gradle

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

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

@@ -176,23 +176,14 @@ 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/";
186+
def hermesPath = "../../node_modules/hermes-engine/android/";
196187
debugImplementation files(hermesPath + "hermes-debug.aar")
197188
releaseImplementation files(hermesPath + "hermes-release.aar")
198189
} else {
Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
package com.example;
22

33
import android.app.Application;
4-
import android.util.Log;
4+
import android.content.Context;
55

66
import com.facebook.react.PackageList;
7-
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8-
import com.facebook.react.bridge.JavaScriptExecutorFactory;
97
import com.facebook.react.ReactApplication;
108
import com.facebook.react.ReactNativeHost;
119
import com.facebook.react.ReactPackage;
1210
import com.facebook.soloader.SoLoader;
1311

12+
import java.lang.reflect.InvocationTargetException;
1413
import java.util.List;
1514

1615
public class MainApplication extends Application implements ReactApplication {
17-
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18-
@Override
19-
public boolean getUseDeveloperSupport() {
20-
return BuildConfig.DEBUG;
21-
}
2216

23-
@Override
24-
protected List<ReactPackage> getPackages() {
25-
@SuppressWarnings("UnnecessaryLocalVariable")
26-
List<ReactPackage> packages = new PackageList(this).getPackages();
27-
// Packages that cannot be autolinked yet can be added manually here, for example:
28-
// packages.add(new MyReactNativePackage());
29-
return packages;
30-
}
17+
private final ReactNativeHost mReactNativeHost =
18+
new ReactNativeHost(this) {
19+
@Override
20+
public boolean getUseDeveloperSupport() {
21+
return BuildConfig.DEBUG;
22+
}
3123

32-
@Override
33-
protected String getJSMainModuleName() {
34-
return "index";
35-
}
36-
};
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+
};
3738

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

example/android/app/src/main/res/values/colors.xml

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

example/android/app/src/main/res/values/styles.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
55
<!-- Customize your theme here. -->
66
<item name="android:textColor">#000000</item>
7-
<item name="android:windowBackground">@color/background</item>
87
</style>
98

109
</resources>

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ buildscript {
66
minSdkVersion = 21
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

example/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
root: ['.'],
88
alias: {
99
'react-native-help-scout': '../library/src',
10+
'react-native': './node_modules/react-native',
1011
react: './node_modules/react',
1112
},
1213
},

example/ios/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2020
moduleName:@"example"
2121
initialProperties:nil];
2222

23-
rootView.backgroundColor = [[UIColor alloc] initWithRed:0.0f green:0.0f blue:0.0f alpha:1];
23+
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
2424

2525
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
2626
UIViewController *rootViewController = [UIViewController new];

0 commit comments

Comments
 (0)