Skip to content

Commit 215f3bc

Browse files
committed
Update Sample project
1 parent 1de4b87 commit 215f3bc

Some content is hidden

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

46 files changed

+5039
-5083
lines changed

Sample/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Windows files
2+
[*.bat]
3+
end_of_line = crlf

Sample/.flowconfig

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
; Ignore polyfills
99
node_modules/react-native/Libraries/polyfills/.*
1010

11-
; These should not be required directly
12-
; require from fbjs/lib instead: require('fbjs/lib/warning')
13-
node_modules/warning/.*
14-
1511
; Flow doesn't support platforms
1612
.*/Libraries/Utilities/LoadingView.js
1713

@@ -27,8 +23,9 @@ node_modules/react-native/flow/
2723
[options]
2824
emoji=true
2925

30-
esproposal.optional_chaining=enable
31-
esproposal.nullish_coalescing=enable
26+
exact_by_default=true
27+
28+
format.bracket_spacing=false
3229

3330
module.file_ext=.js
3431
module.file_ext=.json
@@ -44,10 +41,6 @@ suppress_type=$FlowFixMe
4441
suppress_type=$FlowFixMeProps
4542
suppress_type=$FlowFixMeState
4643

47-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
48-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
49-
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
50-
5144
[lints]
5245
sketchy-null-number=warn
5346
sketchy-null-mixed=warn
@@ -56,10 +49,8 @@ untyped-type-import=warn
5649
nonstrict-import=warn
5750
deprecated-type=warn
5851
unsafe-getters-setters=warn
59-
inexact-spread=warn
6052
unnecessary-invariant=warn
6153
signature-verification-failure=warn
62-
deprecated-utility=error
6354

6455
[strict]
6556
deprecated-type
@@ -71,4 +62,4 @@ untyped-import
7162
untyped-type-import
7263

7364
[version]
74-
^0.113.0
65+
^0.158.0

Sample/.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
*.pbxproj -text
1+
# Windows files should use crlf line endings
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
*.bat text eol=crlf

Sample/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ build/
2929
.gradle
3030
local.properties
3131
*.iml
32+
*.hprof
3233

3334
# node.js
3435
#

Sample/.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ module.exports = {
33
jsxBracketSameLine: true,
44
singleQuote: true,
55
trailingComma: 'all',
6+
arrowParens: 'avoid',
67
};

Sample/__tests__/App-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import 'react-native';
66
import React from 'react';
7-
import App from '../App';
7+
import App from '../src/App';
88

99
// Note: test renderer must be required after react-native.
1010
import renderer from 'react-test-renderer';

Sample/android/app/BUCK renamed to Sample/android/app/_BUCK

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ android_library(
3535

3636
android_build_config(
3737
name = "build_config",
38-
package = "com.samplesimpledialogs",
38+
package = "com.sample",
3939
)
4040

4141
android_resource(
4242
name = "res",
43-
package = "com.samplesimpledialogs",
43+
package = "com.sample",
4444
res = "src/main/res",
4545
)
4646

Sample/android/app/build.gradle

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import com.android.build.OutputFile
2020
* // default. Can be overridden with ENTRY_FILE environment variable.
2121
* entryFile: "index.android.js",
2222
*
23-
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
23+
* // https://reactnative.dev/docs/performance#enable-the-ram-format
2424
* bundleCommand: "ram-bundle",
2525
*
2626
* // whether to bundle JS and assets in debug mode
@@ -120,16 +120,18 @@ def jscFlavor = 'org.webkit:android-jsc:+'
120120
*/
121121
def enableHermes = project.ext.react.get("enableHermes", false);
122122

123+
/**
124+
* Architectures to build native code for in debug.
125+
*/
126+
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
127+
123128
android {
124-
compileSdkVersion rootProject.ext.compileSdkVersion
129+
ndkVersion rootProject.ext.ndkVersion
125130

126-
compileOptions {
127-
sourceCompatibility JavaVersion.VERSION_1_8
128-
targetCompatibility JavaVersion.VERSION_1_8
129-
}
131+
compileSdkVersion rootProject.ext.compileSdkVersion
130132

131133
defaultConfig {
132-
applicationId "com.samplesimpledialogs"
134+
applicationId "com.sample"
133135
minSdkVersion rootProject.ext.minSdkVersion
134136
targetSdkVersion rootProject.ext.targetSdkVersion
135137
versionCode 1
@@ -154,33 +156,32 @@ android {
154156
buildTypes {
155157
debug {
156158
signingConfig signingConfigs.debug
159+
if (nativeArchitectures) {
160+
ndk {
161+
abiFilters nativeArchitectures.split(',')
162+
}
163+
}
157164
}
158165
release {
159166
// Caution! In production, you need to generate your own keystore file.
160-
// see https://facebook.github.io/react-native/docs/signed-apk-android.
167+
// see https://reactnative.dev/docs/signed-apk-android.
161168
signingConfig signingConfigs.debug
162169
minifyEnabled enableProguardInReleaseBuilds
163170
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
164171
}
165172
}
166173

167-
packagingOptions {
168-
pickFirst "lib/armeabi-v7a/libc++_shared.so"
169-
pickFirst "lib/arm64-v8a/libc++_shared.so"
170-
pickFirst "lib/x86/libc++_shared.so"
171-
pickFirst "lib/x86_64/libc++_shared.so"
172-
}
173-
174174
// applicationVariants are e.g. debug, release
175175
applicationVariants.all { variant ->
176176
variant.outputs.each { output ->
177177
// For each separate APK per architecture, set a unique version code as described here:
178178
// https://developer.android.com/studio/build/configure-apk-splits.html
179+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
179180
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
180181
def abi = output.getFilter(OutputFile.ABI)
181182
if (abi != null) { // null for the universal-debug, universal-release variants
182183
output.versionCodeOverride =
183-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
184+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
184185
}
185186

186187
}
@@ -195,11 +196,12 @@ dependencies {
195196
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
196197

197198
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
198-
exclude group:'com.facebook.fbjni'
199+
exclude group:'com.facebook.fbjni'
199200
}
200201

201202
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
202203
exclude group:'com.facebook.flipper'
204+
exclude group:'com.squareup.okhttp3', module:'okhttp'
203205
}
204206

205207
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
@@ -218,7 +220,7 @@ dependencies {
218220
// Run this once to be able to run the application with BUCK
219221
// puts all compile dependencies into folder libs for BUCK to use
220222
task copyDownloadableDepsToLibs(type: Copy) {
221-
from configurations.compile
223+
from configurations.implementation
222224
into 'libs'
223225
}
224226

Sample/android/app/src/debug/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application
8+
android:usesCleartextTraffic="true"
9+
tools:targetApi="28"
10+
tools:ignore="GoogleAppIndexingWarning">
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
12+
</application>
813
</manifest>

Sample/android/app/src/debug/java/com/samplesimpledialogs/ReactNativeFlipper.java renamed to Sample/android/app/src/debug/java/com/sample/ReactNativeFlipper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
55
* directory of this source tree.
66
*/
7-
package com.samplesimpledialogs;
7+
package com.sample;
88

99
import android.content.Context;
1010
import com.facebook.flipper.android.AndroidFlipperClient;

0 commit comments

Comments
 (0)