Skip to content

Commit 6f8ac5d

Browse files
committed
bump to rn 0.18.0
1 parent 1e5dea8 commit 6f8ac5d

File tree

8 files changed

+218
-218
lines changed

8 files changed

+218
-218
lines changed

example/.flowconfig

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@
1414

1515
# Ignore react and fbjs where there are overlaps, but don't ignore
1616
# anything that react-native relies on
17-
.*/node_modules/fbjs-haste/.*/__tests__/.*
18-
.*/node_modules/fbjs-haste/__forks__/Map.js
19-
.*/node_modules/fbjs-haste/__forks__/Promise.js
20-
.*/node_modules/fbjs-haste/__forks__/fetch.js
21-
.*/node_modules/fbjs-haste/core/ExecutionEnvironment.js
22-
.*/node_modules/fbjs-haste/core/isEmpty.js
23-
.*/node_modules/fbjs-haste/crypto/crc32.js
24-
.*/node_modules/fbjs-haste/stubs/ErrorUtils.js
25-
.*/node_modules/react-haste/React.js
26-
.*/node_modules/react-haste/renderers/dom/ReactDOM.js
27-
.*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
17+
.*/node_modules/fbjs/lib/Map.js
18+
.*/node_modules/fbjs/lib/Promise.js
19+
.*/node_modules/fbjs/lib/fetch.js
20+
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
21+
.*/node_modules/fbjs/lib/isEmpty.js
22+
.*/node_modules/fbjs/lib/crc32.js
23+
.*/node_modules/fbjs/lib/ErrorUtils.js
24+
25+
# Flow has a built-in definition for the 'react' module which we prefer to use
26+
# over the currently-untyped source
27+
.*/node_modules/react/react.js
28+
.*/node_modules/react/lib/React.js
29+
.*/node_modules/react/lib/ReactDOM.js
2830

2931
# Ignore commoner tests
3032
.*/node_modules/commoner/test/.*
@@ -55,9 +57,9 @@ suppress_type=$FlowIssue
5557
suppress_type=$FlowFixMe
5658
suppress_type=$FixMe
5759

58-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
59-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
60+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
61+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
6062
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
6163

6264
[version]
63-
0.19.0
65+
0.20.1

example/android/app/build.gradle

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
apply plugin: "com.android.application"
22

3+
import com.android.build.OutputFile
4+
35
/**
46
* The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets.
57
* These basically call `react-native bundle` with the correct arguments during the Android build
@@ -49,6 +51,22 @@ apply plugin: "com.android.application"
4951

5052
apply from: "react.gradle"
5153

54+
/**
55+
* Set this to true to create three separate APKs instead of one:
56+
* - A universal APK that works on all devices
57+
* - An APK that only works on ARM devices
58+
* - An APK that only works on x86 devices
59+
* The advantage is the size of the APK is reduced by about 4MB.
60+
* Upload all the APKs to the Play Store and people will download
61+
* the correct one based on the CPU architecture of their device.
62+
*/
63+
def enableSeparateBuildPerCPUArchitecture = false
64+
65+
/**
66+
* Run Proguard to shrink the Java bytecode in release builds.
67+
*/
68+
def enableProguardInReleaseBuilds = false
69+
5270
android {
5371
compileSdkVersion 23
5472
buildToolsVersion "23.0.1"
@@ -63,18 +81,39 @@ android {
6381
abiFilters "armeabi-v7a", "x86"
6482
}
6583
}
84+
splits {
85+
abi {
86+
enable enableSeparateBuildPerCPUArchitecture
87+
universalApk true
88+
reset()
89+
include "armeabi-v7a", "x86"
90+
}
91+
}
6692
buildTypes {
6793
release {
68-
minifyEnabled false // Set this to true to enable Proguard
94+
minifyEnabled enableProguardInReleaseBuilds
6995
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
7096
}
7197
}
98+
// applicationVariants are e.g. debug, release
99+
applicationVariants.all { variant ->
100+
variant.outputs.each { output ->
101+
// For each separate APK per architecture, set a unique version code as described here:
102+
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
103+
def versionCodes = ["armeabi-v7a":1, "x86":2]
104+
def abi = output.getFilter(OutputFile.ABI)
105+
if (abi != null) { // null for the universal-debug, universal-release variants
106+
output.versionCodeOverride =
107+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
108+
}
109+
}
110+
}
72111
}
73112

74113
dependencies {
75114
compile fileTree(dir: "libs", include: ["*.jar"])
76115
compile "com.android.support:appcompat-v7:23.0.1"
77-
compile "com.facebook.react:react-native:0.17.+"
116+
compile "com.facebook.react:react-native:0.18.+"
78117

79118
compile project(":react-native-linkedin-login")
80119
compile project(':react-native-vector-icons')

example/android/app/proguard-rules.pro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@
4040

4141
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
4242
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
43+
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
4344
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
4445
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
4546
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
4647

48+
-dontwarn com.facebook.react.**
49+
4750
# okhttp
4851

4952
-keepattributes Signature
@@ -58,3 +61,7 @@
5861
-dontwarn java.nio.file.*
5962
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
6063
-dontwarn okio.**
64+
65+
# stetho
66+
67+
-dontwarn com.facebook.stetho.**

example/android/app/react.gradle

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,33 @@ task bundleReleaseJsAndAssets(type: Exec) {
7474
enabled config.bundleInRelease ?: true
7575
}
7676

77+
void runBefore(String dependentTaskName, Task task) {
78+
Task dependentTask = tasks.findByPath(dependentTaskName);
79+
if (dependentTask != null) {
80+
dependentTask.dependsOn task
81+
}
82+
}
83+
7784
gradle.projectsEvaluated {
85+
7886
// hook bundleDebugJsAndAssets into the android build process
87+
7988
bundleDebugJsAndAssets.dependsOn mergeDebugResources
8089
bundleDebugJsAndAssets.dependsOn mergeDebugAssets
81-
processDebugResources.dependsOn bundleDebugJsAndAssets
90+
91+
runBefore('processArmeabi-v7aDebugResources', bundleDebugJsAndAssets)
92+
runBefore('processX86DebugResources', bundleDebugJsAndAssets)
93+
runBefore('processUniversalDebugResources', bundleDebugJsAndAssets)
94+
runBefore('processDebugResources', bundleDebugJsAndAssets)
8295

8396
// hook bundleReleaseJsAndAssets into the android build process
97+
8498
bundleReleaseJsAndAssets.dependsOn mergeReleaseResources
8599
bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets
86-
processReleaseResources.dependsOn bundleReleaseJsAndAssets
100+
101+
runBefore('processArmeabi-v7aReleaseResources', bundleReleaseJsAndAssets)
102+
runBefore('processX86ReleaseResources', bundleReleaseJsAndAssets)
103+
runBefore('processUniversalReleaseResources', bundleReleaseJsAndAssets)
104+
runBefore('processReleaseResources', bundleReleaseJsAndAssets)
105+
87106
}
Lines changed: 32 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,56 @@
11
package com.rnlinkedinloginexample;
22

3-
import android.app.Activity;
4-
import android.os.Bundle;
5-
import android.view.KeyEvent;
3+
import com.facebook.react.ReactActivity;
4+
import com.facebook.react.ReactPackage;
5+
import com.facebook.react.shell.MainReactPackage;
6+
7+
import java.util.Arrays;
8+
import java.util.List;
69

710
import net.jodybrewster.linkedinlogin.RNLinkedinLoginModule; // <------ add here
811
import net.jodybrewster.linkedinlogin.RNLinkedinLoginPackage; // <------ add here
912

1013
import com.oblador.vectoricons.VectorIconsPackage;
1114
import com.linkedin.platform.LISessionManager;
1215

16+
public class MainActivity extends ReactActivity {
1317

14-
import com.facebook.react.LifecycleState;
15-
import com.facebook.react.ReactInstanceManager;
16-
import com.facebook.react.ReactRootView;
17-
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
18-
import com.facebook.react.shell.MainReactPackage;
19-
import com.facebook.soloader.SoLoader;
20-
21-
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
22-
23-
private ReactInstanceManager mReactInstanceManager;
24-
private ReactRootView mReactRootView;
25-
26-
@Override
27-
protected void onCreate(Bundle savedInstanceState) {
28-
super.onCreate(savedInstanceState);
29-
mReactRootView = new ReactRootView(this);
30-
31-
mReactInstanceManager = ReactInstanceManager.builder()
32-
.setApplication(getApplication())
33-
.setBundleAssetName("index.android.bundle")
34-
.setJSMainModuleName("index.android")
35-
.addPackage(new MainReactPackage())
36-
.addPackage(new VectorIconsPackage())
37-
.addPackage(new RNLinkedinLoginPackage(this))
38-
.setUseDeveloperSupport(BuildConfig.DEBUG)
39-
.setInitialLifecycleState(LifecycleState.RESUMED)
40-
.build();
41-
42-
mReactRootView.startReactApplication(mReactInstanceManager, "RNLinkedinLoginExample", null);
43-
44-
setContentView(mReactRootView);
45-
}
46-
47-
// add this method inside your activity class
48-
@Override
49-
protected void onActivityResult(int requestCode, int resultCode, android.content.Intent data) {
50-
LISessionManager.getInstance(getApplicationContext()).onActivityResult(this, requestCode, resultCode, data); // <------ add here
51-
}
52-
18+
/**
19+
* Returns the name of the main component registered from JavaScript.
20+
* This is used to schedule rendering of the component.
21+
*/
5322
@Override
54-
public boolean onKeyUp(int keyCode, KeyEvent event) {
55-
if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) {
56-
mReactInstanceManager.showDevOptionsDialog();
57-
return true;
58-
}
59-
return super.onKeyUp(keyCode, event);
23+
protected String getMainComponentName() {
24+
return "RNLinkedinLoginExample";
6025
}
6126

27+
/**
28+
* Returns whether dev mode should be enabled.
29+
* This enables e.g. the dev menu.
30+
*/
6231
@Override
63-
public void onBackPressed() {
64-
if (mReactInstanceManager != null) {
65-
mReactInstanceManager.onBackPressed();
66-
} else {
67-
super.onBackPressed();
68-
}
32+
protected boolean getUseDeveloperSupport() {
33+
return BuildConfig.DEBUG;
6934
}
7035

36+
/**
37+
* A list of packages used by the app. If the app uses additional views
38+
* or modules besides the default ones, add more packages here.
39+
*/
7140
@Override
72-
public void invokeDefaultOnBackPressed() {
73-
super.onBackPressed();
41+
protected List<ReactPackage> getPackages() {
42+
return Arrays.<ReactPackage>asList(
43+
new MainReactPackage(),
44+
new VectorIconsPackage(),
45+
new RNLinkedinLoginPackage(this));
7446
}
7547

7648
@Override
77-
protected void onPause() {
78-
super.onPause();
49+
public void onActivityResult(int requestCode, int resultCode, android.content.Intent data) {
50+
LISessionManager.getInstance(getApplicationContext()).onActivityResult(this, requestCode, resultCode, data); // <------ add here
7951

80-
if (mReactInstanceManager != null) {
81-
mReactInstanceManager.onPause();
82-
}
52+
super.onActivityResult(requestCode, resultCode, data);
8353
}
8454

85-
@Override
86-
protected void onResume() {
87-
super.onResume();
88-
89-
if (mReactInstanceManager != null) {
90-
mReactInstanceManager.onResume(this, this);
91-
}
92-
}
55+
9356
}

0 commit comments

Comments
 (0)