Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 7462ee4

Browse files
author
max-mironov
authored
Updated CodePushDemoApp for RN 0.43 (#785)
1 parent ae271f3 commit 7462ee4

File tree

24 files changed

+872
-151
lines changed

24 files changed

+872
-151
lines changed

Examples/CodePushDemoApp/.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["react-native-stage-0/decorator-support"]
2+
"presets": ["react-native"]
33
}

Examples/CodePushDemoApp/.flowconfig

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ node_modules/react-native/flow
2222
flow/
2323

2424
[options]
25+
emoji=true
26+
2527
module.system=haste
2628

2729
experimental.strict_type_args=true
@@ -34,11 +36,12 @@ suppress_type=$FlowIssue
3436
suppress_type=$FlowFixMe
3537
suppress_type=$FixMe
3638

37-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
38-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
39+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
40+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
3941
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
42+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4043

4144
unsafe.enable_getters_and_setters=true
4245

4346
[version]
44-
^0.36.0
47+
^0.40.0

Examples/CodePushDemoApp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ local.properties
3434
#
3535
node_modules/
3636
npm-debug.log
37+
yarn-error.log
3738

3839
# BUCK
3940
buck-out/

Examples/CodePushDemoApp/NuGet.Config

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'react-native';
2+
import React from 'react';
3+
import Index from '../index.android.js';
4+
5+
// Note: test renderer must be required after react-native.
6+
import renderer from 'react-test-renderer';
7+
8+
it('renders correctly', () => {
9+
const tree = renderer.create(
10+
<Index />
11+
);
12+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'react-native';
2+
import React from 'react';
3+
import Index from '../index.ios.js';
4+
5+
// Note: test renderer must be required after react-native.
6+
import renderer from 'react-test-renderer';
7+
8+
it('renders correctly', () => {
9+
const tree = renderer.create(
10+
<Index />
11+
);
12+
});
Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import re
2-
31
# To learn about Buck see [Docs](https://buckbuild.com/).
42
# To run your application with Buck:
53
# - install Buck
@@ -11,56 +9,57 @@ import re
119
#
1210

1311
lib_deps = []
12+
1413
for jarfile in glob(['libs/*.jar']):
15-
name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
14+
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
1615
lib_deps.append(':' + name)
1716
prebuilt_jar(
1817
name = name,
1918
binary_jar = jarfile,
2019
)
2120

2221
for aarfile in glob(['libs/*.aar']):
23-
name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
22+
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
2423
lib_deps.append(':' + name)
2524
android_prebuilt_aar(
2625
name = name,
2726
aar = aarfile,
2827
)
2928

3029
android_library(
31-
name = 'all-libs',
32-
exported_deps = lib_deps
30+
name = "all-libs",
31+
exported_deps = lib_deps,
3332
)
3433

3534
android_library(
36-
name = 'app-code',
37-
srcs = glob([
38-
'src/main/java/**/*.java',
39-
]),
40-
deps = [
41-
':all-libs',
42-
':build_config',
43-
':res',
44-
],
35+
name = "app-code",
36+
srcs = glob([
37+
"src/main/java/**/*.java",
38+
]),
39+
deps = [
40+
":all-libs",
41+
":build_config",
42+
":res",
43+
],
4544
)
4645

4746
android_build_config(
48-
name = 'build_config',
49-
package = 'com.codepushdemoapp',
47+
name = "build_config",
48+
package = "com.codepushdemoapp",
5049
)
5150

5251
android_resource(
53-
name = 'res',
54-
res = 'src/main/res',
55-
package = 'com.codepushdemoapp',
52+
name = "res",
53+
package = "com.codepushdemoapp",
54+
res = "src/main/res",
5655
)
5756

5857
android_binary(
59-
name = 'app',
60-
package_type = 'debug',
61-
manifest = 'src/main/AndroidManifest.xml',
62-
keystore = '//android/keystores:debug',
63-
deps = [
64-
':app-code',
65-
],
58+
name = "app",
59+
keystore = "//android/keystores:debug",
60+
manifest = "src/main/AndroidManifest.xml",
61+
package_type = "debug",
62+
deps = [
63+
":app-code",
64+
],
6665
)

Examples/CodePushDemoApp/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import com.android.build.OutputFile
6666
*/
6767

6868
apply from: "../../node_modules/react-native/react.gradle"
69-
apply from: "../../../../android/codepush.gradle"
69+
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
7070

7171
/**
7272
* Set this to true to create two separate APKs instead of one:
@@ -127,10 +127,10 @@ android {
127127
}
128128

129129
dependencies {
130+
compile project(':react-native-code-push')
130131
compile fileTree(dir: "libs", include: ["*.jar"])
131132
compile "com.android.support:appcompat-v7:23.0.1"
132133
compile "com.facebook.react:react-native:+" // From node_modules
133-
compile project(':react-native-code-push')
134134
}
135135

136136
// Run this once to be able to run the application with BUCK

Examples/CodePushDemoApp/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
<activity
2020
android:name=".MainActivity"
2121
android:label="@string/app_name"
22-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
22+
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
23+
android:windowSoftInputMode="adjustResize">
2324
<intent-filter>
2425
<action android:name="android.intent.action.MAIN" />
2526
<category android:name="android.intent.category.LAUNCHER" />

Examples/CodePushDemoApp/android/app/src/main/java/com/codepushdemoapp/MainApplication.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
package com.codepushdemoapp;
22

33
import android.app.Application;
4-
import android.util.Log;
54

65
import com.facebook.react.ReactApplication;
7-
import com.facebook.react.ReactInstanceManager;
6+
import com.microsoft.codepush.react.CodePush;
87
import com.facebook.react.ReactNativeHost;
98
import com.facebook.react.ReactPackage;
109
import com.facebook.react.shell.MainReactPackage;
1110
import com.facebook.soloader.SoLoader;
1211

13-
import com.microsoft.codepush.react.CodePush;
1412
import java.util.Arrays;
1513
import java.util.List;
1614

1715
public class MainApplication extends Application implements ReactApplication {
1816

1917
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18+
2019
@Override
2120
protected String getJSBundleFile() {
2221
return CodePush.getJSBundleFile();
23-
}
22+
}
23+
2424
@Override
25-
protected boolean getUseDeveloperSupport() {
25+
public boolean getUseDeveloperSupport() {
2626
return BuildConfig.DEBUG;
2727
}
2828

2929
@Override
3030
protected List<ReactPackage> getPackages() {
3131
return Arrays.<ReactPackage>asList(
3232
new MainReactPackage(),
33-
new CodePush("deployment-key-here", MainApplication.this, BuildConfig.DEBUG)
33+
new CodePush("deployment-key-here", getApplicationContext(), BuildConfig.DEBUG)
3434
);
3535
}
3636
};

0 commit comments

Comments
 (0)