Skip to content

Commit 2e53643

Browse files
committed
- Migrating to RN61
1 parent 9030015 commit 2e53643

Some content is hidden

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

49 files changed

+714
-1367
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: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
; Ignore "BUCK" generated dirs
66
<PROJECT_ROOT>/\.buckd/
77

8-
; Ignore unexpected extra "@providesModule"
9-
.*/node_modules/.*/node_modules/fbjs/.*
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
1010

11-
; Ignore duplicate module providers
12-
; For RN Apps installed via npm, "Libraries" folder is inside
13-
; "node_modules/react-native" but in the source repo it is in the root
14-
.*/Libraries/react-native/React.js
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
1514

16-
; Ignore polyfills
17-
.*/Libraries/polyfills/.*
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
1817

19-
; Ignore metro
20-
.*/node_modules/metro/.*
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
2120

2221
[include]
2322

@@ -31,39 +30,46 @@ emoji=true
3130
esproposal.optional_chaining=enable
3231
esproposal.nullish_coalescing=enable
3332

34-
module.system=haste
35-
module.system.haste.use_name_reducers=true
36-
# get basename
37-
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
38-
# strip .js or .js.flow suffix
39-
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
40-
# strip .ios suffix
41-
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
42-
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
43-
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
44-
module.system.haste.paths.blacklist=.*/__tests__/.*
45-
module.system.haste.paths.blacklist=.*/__mocks__/.*
46-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
47-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
4836

4937
munge_underscores=true
5038

51-
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'
52-
53-
module.file_ext=.js
54-
module.file_ext=.jsx
55-
module.file_ext=.json
56-
module.file_ext=.native.js
39+
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
40+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
41+
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\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
5742

5843
suppress_type=$FlowIssue
5944
suppress_type=$FlowFixMe
6045
suppress_type=$FlowFixMeProps
6146
suppress_type=$FlowFixMeState
6247

63-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
64-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
65-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
6650
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
6751

52+
[lints]
53+
sketchy-null-number=warn
54+
sketchy-null-mixed=warn
55+
sketchy-number=warn
56+
untyped-type-import=warn
57+
nonstrict-import=warn
58+
deprecated-type=warn
59+
unsafe-getters-setters=warn
60+
inexact-spread=warn
61+
unnecessary-invariant=warn
62+
signature-verification-failure=warn
63+
deprecated-utility=error
64+
65+
[strict]
66+
deprecated-type
67+
nonstrict-import
68+
sketchy-null
69+
unclear-type
70+
unsafe-getters-setters
71+
untyped-import
72+
untyped-type-import
73+
6874
[version]
69-
^0.92.0
75+
^0.105.0

Example/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ yarn-error.log
4040
buck-out/
4141
\.buckd/
4242
*.keystore
43+
!debug.keystore
4344

4445
# fastlane
4546
#
@@ -54,3 +55,6 @@ buck-out/
5455

5556
# Bundle artifact
5657
*.jsbundle
58+
59+
# CocoaPods
60+
/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: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ import {
1616
import { RNNotificationBanner } from "react-native-notification-banner";
1717
import Icon from "react-native-vector-icons/FontAwesome";
1818

19+
Icon.loadFont('AntDesign.ttf')
20+
Icon.loadFont('Entypo.ttf')
21+
Icon.loadFont('EvilIcons.ttf')
22+
Icon.loadFont('Feather.ttf')
23+
Icon.loadFont('FontAwesome.ttf')
24+
Icon.loadFont('FontAwesome5_Brands.ttf')
25+
Icon.loadFont('FontAwesome5_Regular.ttf')
26+
Icon.loadFont('FontAwesome5_Solid.ttf')
27+
Icon.loadFont('Foundation.ttf')
28+
Icon.loadFont('Ionicons.ttf')
29+
Icon.loadFont('MaterialIcons.ttf')
30+
Icon.loadFont('MaterialCommunityIcons.ttf')
31+
Icon.loadFont('SimpleLineIcons.ttf')
32+
Icon.loadFont('Octicons.ttf')
33+
Icon.loadFont('Zocial.ttf')
34+
1935
type Props = {};
2036
export default class App extends Component<Props> {
2137
render() {
@@ -73,4 +89,4 @@ const styles = StyleSheet.create({
7389
alignItems: 'center',
7490
backgroundColor: '#F5FCFF',
7591
}
76-
});
92+
});

Example/android/app/build.gradle

Lines changed: 55 additions & 6 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,10 +76,12 @@ 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"
84+
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
8085

8186
/**
8287
* Set this to true to create two separate APKs instead of one:
@@ -93,6 +98,28 @@ def enableSeparateBuildPerCPUArchitecture = false
9398
*/
9499
def enableProguardInReleaseBuilds = false
95100

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

@@ -116,8 +143,22 @@ android {
116143
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
117144
}
118145
}
146+
signingConfigs {
147+
debug {
148+
storeFile file('debug.keystore')
149+
storePassword 'android'
150+
keyAlias 'androiddebugkey'
151+
keyPassword 'android'
152+
}
153+
}
119154
buildTypes {
155+
debug {
156+
signingConfig signingConfigs.debug
157+
}
120158
release {
159+
// Caution! In production, you need to generate your own keystore file.
160+
// see https://facebook.github.io/react-native/docs/signed-apk-android.
161+
signingConfig signingConfigs.debug
121162
minifyEnabled enableProguardInReleaseBuilds
122163
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
123164
}
@@ -126,23 +167,29 @@ android {
126167
applicationVariants.all { variant ->
127168
variant.outputs.each { output ->
128169
// For each separate APK per architecture, set a unique version code as described here:
129-
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
130-
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
170+
// https://developer.android.com/studio/build/configure-apk-splits.html
171+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
131172
def abi = output.getFilter(OutputFile.ABI)
132173
if (abi != null) { // null for the universal-debug, universal-release variants
133174
output.versionCodeOverride =
134175
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
135176
}
177+
136178
}
137179
}
138180
}
139181

140182
dependencies {
141-
implementation project(':react-native-vector-icons')
142-
implementation project(':react-native-notification-banner')
143183
implementation fileTree(dir: "libs", include: ["*.jar"])
144-
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
145184
implementation "com.facebook.react:react-native:+" // From node_modules
185+
186+
if (enableHermes) {
187+
def hermesPath = "../../node_modules/hermes-engine/android/";
188+
debugImplementation files(hermesPath + "hermes-debug.aar")
189+
releaseImplementation files(hermesPath + "hermes-release.aar")
190+
} else {
191+
implementation jscFlavor
192+
}
146193
}
147194

148195
// Run this once to be able to run the application with BUCK
@@ -151,3 +198,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
151198
from configurations.compile
152199
into 'libs'
153200
}
201+
202+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Example/android/app/debug.keystore

2.2 KB
Binary file not shown.

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-
#}
-64 KB
Binary file not shown.
-13.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)