Skip to content

Commit 2e93f1e

Browse files
committed
Updated example for RN 0.31
1 parent fbd7e56 commit 2e93f1e

File tree

6 files changed

+47
-34
lines changed

6 files changed

+47
-34
lines changed

Example/android/app/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
android:targetSdkVersion="22" />
1212

1313
<application
14+
android:name=".MainApplication"
1415
android:allowBackup="true"
1516
android:label="@string/app_name"
1617
android:icon="@mipmap/ic_launcher"
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package com.example;
22

33
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;
94

105
public class MainActivity extends ReactActivity {
116

@@ -17,29 +12,4 @@ public class MainActivity extends ReactActivity {
1712
protected String getMainComponentName() {
1813
return "Example";
1914
}
20-
21-
@Override
22-
protected String getJSMainModuleName() {
23-
return "Example/index.android";
24-
}
25-
26-
/**
27-
* Returns whether dev mode should be enabled.
28-
* This enables e.g. the dev menu.
29-
*/
30-
@Override
31-
protected boolean getUseDeveloperSupport() {
32-
return BuildConfig.DEBUG;
33-
}
34-
35-
/**
36-
* A list of packages used by the app. If the app uses additional views
37-
* or modules besides the default ones, add more packages here.
38-
*/
39-
@Override
40-
protected List<ReactPackage> getPackages() {
41-
return Arrays.<ReactPackage>asList(
42-
new MainReactPackage()
43-
);
44-
}
4515
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.example;
2+
3+
import android.app.Application;
4+
5+
import com.facebook.react.ReactApplication;
6+
import com.facebook.react.ReactNativeHost;
7+
import com.facebook.react.ReactPackage;
8+
import com.facebook.react.shell.MainReactPackage;
9+
10+
import java.util.Arrays;
11+
import java.util.List;
12+
13+
/**
14+
* Created by jean on 22/08/16.
15+
*/
16+
public class MainApplication extends Application implements ReactApplication {
17+
18+
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
19+
@Override
20+
protected String getJSMainModuleName() {
21+
return "Example/index.android";
22+
}
23+
24+
@Override
25+
protected boolean getUseDeveloperSupport() {
26+
return BuildConfig.DEBUG;
27+
}
28+
29+
@Override
30+
protected List<ReactPackage> getPackages() {
31+
return Arrays.<ReactPackage>asList(
32+
new MainReactPackage()
33+
);
34+
}
35+
};
36+
37+
@Override
38+
public ReactNativeHost getReactNativeHost() {
39+
return mReactNativeHost;
40+
}
41+
}

Example/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.3.1'
8+
classpath 'com.android.tools.build:gradle:2.1.2'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Mon Aug 22 14:05:27 CEST 2016
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"babel-eslint": "^3.1.15",
3636
"eslint": "^0.23.0",
3737
"eslint-plugin-react": "^2.5.2",
38-
"react": "^15.0.2",
39-
"react-native": "^0.26.2",
38+
"react": "15.2.1",
39+
"react-native": "^0.31.0",
4040
"rimraf": "^2.5.2"
4141
}
4242
}

0 commit comments

Comments
 (0)