Skip to content

Commit 091cd46

Browse files
authored
Merge pull request #4 from markmadlangbayan/master
Upgraded to RN 0.60.5
2 parents f9d55ea + 60b5d74 commit 091cd46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+7435
-923
lines changed

example/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

example/.flowconfig

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,37 @@
1111
; Ignore duplicate module providers
1212
; For RN Apps installed via npm, "Libraries" folder is inside
1313
; "node_modules/react-native" but in the source repo it is in the root
14-
.*/Libraries/react-native/React.js
14+
node_modules/react-native/Libraries/react-native/React.js
1515

1616
; Ignore polyfills
17-
.*/Libraries/polyfills/.*
17+
node_modules/react-native/Libraries/polyfills/.*
1818

19-
; Ignore metro
20-
.*/node_modules/metro/.*
19+
; These should not be required directly
20+
; require from fbjs/lib instead: require('fbjs/lib/warning')
21+
node_modules/warning/.*
22+
23+
; Flow doesn't support platforms
24+
.*/Libraries/Utilities/HMRLoadingView.js
25+
26+
[untyped]
27+
.*/node_modules/@react-native-community/cli/.*/.*
2128

2229
[include]
2330

2431
[libs]
2532
node_modules/react-native/Libraries/react-native/react-native-interface.js
2633
node_modules/react-native/flow/
27-
node_modules/react-native/flow-github/
2834

2935
[options]
3036
emoji=true
3137

3238
esproposal.optional_chaining=enable
3339
esproposal.nullish_coalescing=enable
3440

41+
module.file_ext=.js
42+
module.file_ext=.json
43+
module.file_ext=.ios.js
44+
3545
module.system=haste
3646
module.system.haste.use_name_reducers=true
3747
# get basename
@@ -44,27 +54,46 @@ module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
4454
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
4555
module.system.haste.paths.blacklist=.*/__tests__/.*
4656
module.system.haste.paths.blacklist=.*/__mocks__/.*
47-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
4857
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
58+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
59+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
60+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
4962

5063
munge_underscores=true
5164

5265
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
5366

54-
module.file_ext=.js
55-
module.file_ext=.jsx
56-
module.file_ext=.json
57-
module.file_ext=.native.js
58-
5967
suppress_type=$FlowIssue
6068
suppress_type=$FlowFixMe
6169
suppress_type=$FlowFixMeProps
6270
suppress_type=$FlowFixMeState
6371

64-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
65-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
66-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
72+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
73+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
6774
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
6875

76+
[lints]
77+
sketchy-null-number=warn
78+
sketchy-null-mixed=warn
79+
sketchy-number=warn
80+
untyped-type-import=warn
81+
nonstrict-import=warn
82+
deprecated-type=warn
83+
unsafe-getters-setters=warn
84+
inexact-spread=warn
85+
unnecessary-invariant=warn
86+
signature-verification-failure=warn
87+
deprecated-utility=error
88+
89+
[strict]
90+
deprecated-type
91+
nonstrict-import
92+
sketchy-null
93+
unclear-type
94+
unsafe-getters-setters
95+
untyped-import
96+
untyped-type-import
97+
6998
[version]
70-
^0.78.0
99+
^0.98.0

example/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ buck-out/
5454

5555
# Bundle artifact
5656
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/

example/.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};

example/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default class Example extends Component {
4949
data={this.data}
5050
label={'name'}
5151
value={'value'}
52-
onValueChange={(value) => alert(value + ' selected')} />
52+
onValueChange={(value) => console.log(value + ' selected')} />
5353

5454
<View style={styles.subContainer}>
5555
<Button
@@ -68,11 +68,11 @@ export default class Example extends Component {
6868
data={this.data}
6969
label={'name'}
7070
value={'value'}
71-
onValueChange={(value) => alert(value + ' selected')}
71+
onValueChange={(value) => console.log(value + ' selected')}
7272
renderRow={(rowData) => <Text style={styles.rowStyle}>{rowData.name}</Text>} />
7373
<View style={styles.subContainer}>
7474
<Button
75-
title={'Open Cutome Row Picker'}
75+
title={'Open Cutomer Row Picker'}
7676
onPress={() => this.customRowPicker.setModalVisible(true)} />
7777
</View>
7878
</View>
@@ -87,7 +87,7 @@ export default class Example extends Component {
8787
data={this.data}
8888
label={'name'}
8989
value={'value'}
90-
onValueChange={(value, selectedIndex) => this.setState({selectedIndex})} />
90+
onValueChange={(_, selectedIndex) => this.setState({selectedIndex})} />
9191
<View style={styles.subContainer}>
9292
<TouchableOpacity style={styles.dropDownContainer} onPress={() => this.dropDownPicker.setModalVisible(true)}>
9393
<Text style={styles.dropDownText}>{this.data[this.state.selectedIndex].name}</Text>

example/__tests__/App-test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

example/android/app/BUCK

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@
88
# - `buck install -r android/app` - compile, install and run application
99
#
1010

11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
1113
lib_deps = []
1214

13-
for jarfile in glob(['libs/*.jar']):
14-
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15-
lib_deps.append(':' + name)
16-
prebuilt_jar(
17-
name = name,
18-
binary_jar = jarfile,
19-
)
15+
create_aar_targets(glob(["libs/*.aar"]))
2016

21-
for aarfile in glob(['libs/*.aar']):
22-
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23-
lib_deps.append(':' + name)
24-
android_prebuilt_aar(
25-
name = name,
26-
aar = aarfile,
27-
)
17+
create_jar_targets(glob(["libs/*.jar"]))
2818

2919
android_library(
3020
name = "all-libs",

example/android/app/build.gradle

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import com.android.build.OutputFile
1818
* // the entry file for bundle generation
1919
* entryFile: "index.android.js",
2020
*
21+
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22+
* bundleCommand: "ram-bundle",
23+
*
2124
* // whether to bundle JS and assets in debug mode
2225
* bundleInDebug: false,
2326
*
@@ -73,7 +76,8 @@ import com.android.build.OutputFile
7376
*/
7477

7578
project.ext.react = [
76-
entryFile: "index.js"
79+
entryFile: "index.js",
80+
enableHermes: false, // clean and rebuild if changing
7781
]
7882

7983
apply from: "../../node_modules/react-native/react.gradle"
@@ -93,30 +97,67 @@ def enableSeparateBuildPerCPUArchitecture = false
9397
*/
9498
def enableProguardInReleaseBuilds = false
9599

100+
/**
101+
* The preferred build flavor of JavaScriptCore.
102+
*
103+
* For example, to use the international variant, you can use:
104+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105+
*
106+
* The international variant includes ICU i18n library and necessary data
107+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108+
* give correct results when using with locales other than en-US. Note that
109+
* this variant is about 6MiB larger per architecture than default.
110+
*/
111+
def jscFlavor = 'org.webkit:android-jsc:+'
112+
113+
/**
114+
* Whether to enable the Hermes VM.
115+
*
116+
* This should be set on project.ext.react and mirrored here. If it is not set
117+
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118+
* and the benefits of using Hermes will therefore be sharply reduced.
119+
*/
120+
def enableHermes = project.ext.react.get("enableHermes", false);
121+
96122
android {
97123
compileSdkVersion rootProject.ext.compileSdkVersion
98-
buildToolsVersion rootProject.ext.buildToolsVersion
124+
125+
compileOptions {
126+
sourceCompatibility JavaVersion.VERSION_1_8
127+
targetCompatibility JavaVersion.VERSION_1_8
128+
}
99129

100130
defaultConfig {
101131
applicationId "com.example"
102132
minSdkVersion rootProject.ext.minSdkVersion
103133
targetSdkVersion rootProject.ext.targetSdkVersion
104134
versionCode 1
105135
versionName "1.0"
106-
ndk {
107-
abiFilters "armeabi-v7a", "x86"
108-
}
109136
}
110137
splits {
111138
abi {
112139
reset()
113140
enable enableSeparateBuildPerCPUArchitecture
114141
universalApk false // If true, also generate a universal APK
115-
include "armeabi-v7a", "x86"
142+
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143+
}
144+
}
145+
signingConfigs {
146+
debug {
147+
storeFile file('debug.keystore')
148+
storePassword 'android'
149+
keyAlias 'androiddebugkey'
150+
keyPassword 'android'
116151
}
117152
}
118153
buildTypes {
154+
debug {
155+
signingConfig signingConfigs.debug
156+
}
119157
release {
158+
// Caution! In production, you need to generate your own keystore file.
159+
// see https://facebook.github.io/react-native/docs/signed-apk-android.
160+
signingConfig signingConfigs.debug
120161
minifyEnabled enableProguardInReleaseBuilds
121162
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
122163
}
@@ -125,21 +166,38 @@ android {
125166
applicationVariants.all { variant ->
126167
variant.outputs.each { output ->
127168
// For each separate APK per architecture, set a unique version code as described here:
128-
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
129-
def versionCodes = ["armeabi-v7a":1, "x86":2]
169+
// https://developer.android.com/studio/build/configure-apk-splits.html
170+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
130171
def abi = output.getFilter(OutputFile.ABI)
131172
if (abi != null) { // null for the universal-debug, universal-release variants
132173
output.versionCodeOverride =
133174
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
134175
}
176+
135177
}
136178
}
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+
}
137188
}
138189

139190
dependencies {
140191
implementation fileTree(dir: "libs", include: ["*.jar"])
141-
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
142192
implementation "com.facebook.react:react-native:+" // From node_modules
193+
194+
if (enableHermes) {
195+
def hermesPath = "../../node_modules/hermesvm/android/";
196+
debugImplementation files(hermesPath + "hermes-debug.aar")
197+
releaseImplementation files(hermesPath + "hermes-release.aar")
198+
} else {
199+
implementation jscFlavor
200+
}
143201
}
144202

145203
// Run this once to be able to run the application with BUCK
@@ -148,3 +206,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
148206
from configurations.compile
149207
into 'libs'
150208
}
209+
210+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

example/android/app/build_defs.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Helper definitions to glob .aar and .jar targets"""
2+
3+
def create_aar_targets(aarfiles):
4+
for aarfile in aarfiles:
5+
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6+
lib_deps.append(":" + name)
7+
android_prebuilt_aar(
8+
name = name,
9+
aar = aarfile,
10+
)
11+
12+
def create_jar_targets(jarfiles):
13+
for jarfile in jarfiles:
14+
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15+
lib_deps.append(":" + name)
16+
prebuilt_jar(
17+
name = name,
18+
binary_jar = jarfile,
19+
)

example/android/app/proguard-rules.pro

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,3 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11-
12-
# If your project uses WebView with JS, uncomment the following
13-
# and specify the fully qualified class name to the JavaScript interface
14-
# class:
15-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16-
# public *;
17-
#}

0 commit comments

Comments
 (0)