Skip to content

Commit 4d748a8

Browse files
committed
Update the Basic example
1 parent 2462553 commit 4d748a8

File tree

15 files changed

+896
-1398
lines changed

15 files changed

+896
-1398
lines changed

examples/Basic/.babelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["react-native"]
3-
}
2+
"presets": ["react-native"]
3+
}

examples/Basic/.flowconfig

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

examples/Basic/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ yarn-error.log
3939
# BUCK
4040
buck-out/
4141
\.buckd/
42-
android/app/libs
4342
*.keystore
4443

4544
# fastlane

examples/Basic/android/app/BUCK

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.basic',
47+
name = "build_config",
48+
package = "com.basic",
5049
)
5150

5251
android_resource(
53-
name = 'res',
54-
res = 'src/main/res',
55-
package = 'com.basic',
52+
name = "res",
53+
package = "com.basic",
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/Basic/android/app/build.gradle

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ import com.android.build.OutputFile
3333
* // bundleInPaidRelease: true,
3434
* // bundleInBeta: true,
3535
*
36+
* // whether to disable dev mode in custom build variants (by default only disabled in release)
37+
* // for example: to disable dev mode in the staging build type (if configured)
38+
* devDisabledInStaging: true,
39+
* // The configuration property can be in the following formats
40+
* // 'devDisabledIn${productFlavor}${buildType}'
41+
* // 'devDisabledIn${buildType}'
42+
*
3643
* // the root of your project, i.e. where "package.json" lives
3744
* root: "../../",
3845
*
@@ -58,7 +65,7 @@ import com.android.build.OutputFile
5865
* inputExcludes: ["android/**", "ios/**"],
5966
*
6067
* // override which node gets called and with what additional arguments
61-
* nodeExecutableAndArgs: ["node"]
68+
* nodeExecutableAndArgs: ["node"],
6269
*
6370
* // supply additional arguments to the packager
6471
* extraPackagerArgs: []
@@ -84,7 +91,7 @@ def enableProguardInReleaseBuilds = false
8491

8592
android {
8693
compileSdkVersion 23
87-
buildToolsVersion '25.0.0'
94+
buildToolsVersion "23.0.1"
8895

8996
defaultConfig {
9097
applicationId "com.basic"
@@ -128,7 +135,7 @@ android {
128135
dependencies {
129136
compile fileTree(dir: "libs", include: ["*.jar"])
130137
compile "com.android.support:appcompat-v7:23.0.1"
131-
compile "com.facebook.react:react-native:0.41+" // From node_modules
138+
compile "com.facebook.react:react-native:+" // From node_modules
132139
}
133140

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

examples/Basic/android/app/proguard-rules.pro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050

5151
-dontwarn com.facebook.react.**
5252

53+
# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
54+
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
55+
-dontwarn android.text.StaticLayout
56+
5357
# okhttp
5458

5559
-keepattributes Signature

examples/Basic/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/Basic/android/app/src/main/java/com/basic/MainApplication.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package com.basic;
22

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

65
import com.facebook.react.ReactApplication;
7-
import com.facebook.react.ReactInstanceManager;
86
import com.facebook.react.ReactNativeHost;
97
import com.facebook.react.ReactPackage;
108
import com.facebook.react.shell.MainReactPackage;

examples/Basic/android/build.gradle

Lines changed: 1 addition & 1 deletion
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:2.3.0'
8+
classpath 'com.android.tools.build:gradle:2.2.3'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Sun Mar 05 16:59:31 MST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

examples/Basic/android/keystores/BUCK

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
keystore(
2-
name = 'debug',
3-
store = 'debug.keystore',
4-
properties = 'debug.keystore.properties',
5-
visibility = [
6-
'PUBLIC',
7-
],
2+
name = "debug",
3+
properties = "debug.keystore.properties",
4+
store = "debug.keystore",
5+
visibility = [
6+
"PUBLIC",
7+
],
88
)

examples/Basic/ios/Basic.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@
874874
);
875875
runOnlyForDeploymentPostprocessing = 0;
876876
shellPath = /bin/sh;
877-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
877+
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
878878
};
879879
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
880880
isa = PBXShellScriptBuildPhase;
@@ -888,7 +888,7 @@
888888
);
889889
runOnlyForDeploymentPostprocessing = 0;
890890
shellPath = /bin/sh;
891-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
891+
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
892892
};
893893
/* End PBXShellScriptBuildPhase section */
894894

examples/Basic/ios/BasicTests/BasicTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
3737

3838
- (void)testRendersWelcomeScreen
3939
{
40-
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
40+
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
4141
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
4242
BOOL foundElement = NO;
4343

examples/Basic/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"start": "node node_modules/react-native/local-cli/cli.js start"
77
},
88
"dependencies": {
9-
"react": "^15.4.0",
10-
"react-native": "^0.41.2",
9+
"react": "16.0.0-alpha.12",
10+
"react-native": "0.46.3",
1111
"react-native-sortable-list": "../.."
1212
}
1313
}

0 commit comments

Comments
 (0)