Skip to content

Commit c0e76e2

Browse files
committed
chore: update example react-native version
1 parent 80ab171 commit c0e76e2

31 files changed

+2288
-2954
lines changed

.gitattributes

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

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ project.xcworkspace
3838
.project
3939
.settings
4040
local.properties
41-
android.iml
41+
*.iml
42+
*.hprof
4243

4344
# Cocoapods
4445
#

android/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
PolarBle_kotlinVersion=1.6.10
2-
PolarBle_compileSdkVersion=29
3-
PolarBle_targetSdkVersion=29
2+
PolarBle_compileSdkVersion=30
3+
PolarBle_targetSdkVersion=30
44
android.useAndroidX=true

example/.bundle/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

example/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.4

example/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '2.7.4'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

example/android/app/build.gradle

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import com.android.build.OutputFile
1515
* // the name of the generated asset file containing your JS bundle
1616
* bundleAssetName: "index.android.bundle",
1717
*
18-
* // the entry file for bundle generation
18+
* // the entry file for bundle generation. If none specified and
19+
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
20+
* // default. Can be overridden with ENTRY_FILE environment variable.
1921
* entryFile: "index.android.js",
2022
*
2123
* // https://reactnative.dev/docs/performance#enable-the-ram-format
@@ -37,7 +39,7 @@ import com.android.build.OutputFile
3739
* // bundleInBeta: true,
3840
*
3941
* // whether to disable dev mode in custom build variants (by default only disabled in release)
40-
* // for PolarBleExample: to disable dev mode in the staging build type (if configured)
42+
* // for example: to disable dev mode in the staging build type (if configured)
4143
* devDisabledInStaging: true,
4244
* // The configuration property can be in the following formats
4345
* // 'devDisabledIn${productFlavor}${buildType}'
@@ -64,7 +66,7 @@ import com.android.build.OutputFile
6466
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
6567
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
6668
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
67-
* // for PolarBleExample, you might want to remove it from here.
69+
* // for example, you might want to remove it from here.
6870
* inputExcludes: ["android/**", "ios/**"],
6971
*
7072
* // override which node gets called and with what additional arguments
@@ -77,7 +79,6 @@ import com.android.build.OutputFile
7779

7880
project.ext.react = [
7981
enableHermes: false, // clean and rebuild if changing
80-
entryFile: "index.tsx",
8182
]
8283

8384
apply from: "../../node_modules/react-native/react.gradle"
@@ -100,7 +101,7 @@ def enableProguardInReleaseBuilds = false
100101
/**
101102
* The preferred build flavor of JavaScriptCore.
102103
*
103-
* For PolarBleExample, to use the international variant, you can use:
104+
* For example, to use the international variant, you can use:
104105
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105106
*
106107
* The international variant includes ICU i18n library and necessary data
@@ -113,19 +114,21 @@ def jscFlavor = 'org.webkit:android-jsc:+'
113114
/**
114115
* Whether to enable the Hermes VM.
115116
*
116-
* This should be set on project.ext.react and mirrored here. If it is not set
117+
* This should be set on project.ext.react and that value will be read here. If it is not set
117118
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118119
* and the benefits of using Hermes will therefore be sharply reduced.
119120
*/
120121
def enableHermes = project.ext.react.get("enableHermes", false);
121122

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

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

130133
defaultConfig {
131134
applicationId "com.example.reactnativepolarble"
@@ -153,6 +156,11 @@ android {
153156
buildTypes {
154157
debug {
155158
signingConfig signingConfigs.debug
159+
if (nativeArchitectures) {
160+
ndk {
161+
abiFilters nativeArchitectures.split(',')
162+
}
163+
}
156164
}
157165
release {
158166
// Caution! In production, you need to generate your own keystore file.
@@ -162,16 +170,18 @@ android {
162170
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
163171
}
164172
}
173+
165174
// applicationVariants are e.g. debug, release
166175
applicationVariants.all { variant ->
167176
variant.outputs.each { output ->
168177
// For each separate APK per architecture, set a unique version code as described here:
169178
// https://developer.android.com/studio/build/configure-apk-splits.html
179+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
170180
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
171181
def abi = output.getFilter(OutputFile.ABI)
172182
if (abi != null) { // null for the universal-debug, universal-release variants
173183
output.versionCodeOverride =
174-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
184+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
175185
}
176186

177187
}
@@ -183,15 +193,17 @@ dependencies {
183193
//noinspection GradleDynamicVersion
184194
implementation "com.facebook.react:react-native:+" // From node_modules
185195

186-
187196
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
197+
188198
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
189-
exclude group:'com.facebook.fbjni'
199+
exclude group:'com.facebook.fbjni'
190200
}
201+
191202
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
192203
exclude group:'com.facebook.flipper'
193204
exclude group:'com.squareup.okhttp3', module:'okhttp'
194205
}
206+
195207
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
196208
exclude group:'com.facebook.flipper'
197209
}
@@ -210,7 +222,7 @@ dependencies {
210222
// Run this once to be able to run the application with BUCK
211223
// puts all compile dependencies into folder libs for BUCK to use
212224
task copyDownloadableDepsToLibs(type: Copy) {
213-
from configurations.compile
225+
from configurations.implementation
214226
into 'libs'
215227
}
216228

example/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>

example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@
2121
<category android:name="android.intent.category.LAUNCHER" />
2222
</intent-filter>
2323
</activity>
24-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2524
</application>
26-
2725
</manifest>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2014 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<inset xmlns:android="http://schemas.android.com/apk/res/android"
17+
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18+
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19+
android:insetTop="@dimen/abc_edit_text_inset_top_material"
20+
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
21+
22+
<selector>
23+
<!--
24+
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
25+
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
26+
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
27+
28+
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
29+
30+
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
31+
-->
32+
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
33+
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
34+
</selector>
35+
36+
</inset>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
55
<!-- Customize your theme here. -->
6-
<item name="android:textColor">#000000</item>
6+
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
77
</style>
88

99
</resources>

example/android/build.gradle

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,25 @@
22

33
buildscript {
44
ext {
5-
minSdkVersion = 16
6-
compileSdkVersion = 29
7-
targetSdkVersion = 29
5+
buildToolsVersion = "30.0.2"
6+
minSdkVersion = 21
7+
compileSdkVersion = 30
8+
targetSdkVersion = 30
9+
ndkVersion = "21.4.7075529"
810
}
911
repositories {
1012
google()
1113
mavenCentral()
12-
jcenter()
1314
}
1415
dependencies {
15-
classpath("com.android.tools.build:gradle:3.5.3")
16-
16+
classpath("com.android.tools.build:gradle:4.2.2")
1717
// NOTE: Do not place your application dependencies here; they belong
1818
// in the individual module build.gradle files
1919
}
2020
}
2121

2222
allprojects {
2323
repositories {
24-
mavenLocal()
2524
maven {
2625
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
2726
url("$rootDir/../node_modules/react-native/android")
@@ -30,10 +29,14 @@ allprojects {
3029
// Android JSC is installed from npm
3130
url("$rootDir/../node_modules/jsc-android/dist")
3231
}
33-
32+
mavenCentral {
33+
// We don't want to fetch react-native from Maven Central as there are
34+
// older versions over there.
35+
content {
36+
excludeGroup "com.facebook.react"
37+
}
38+
}
3439
google()
35-
mavenCentral()
36-
jcenter()
3740
maven { url 'https://www.jitpack.io' }
3841
}
3942
}

example/android/gradle.properties

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@
99

1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
12-
# Default value: -Xmx10248m -XX:MaxPermSize=256m
12+
# Default value: -Xmx1024m -XX:MaxPermSize=256m
1313
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
1414

1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
1919

20+
# AndroidX package structure to make it clearer which packages are bundled with the
21+
# Android operating system, and which are packaged with your app's APK
22+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
2023
android.useAndroidX=true
24+
# Automatically convert third-party libraries to use AndroidX
2125
android.enableJetifier=true
22-
FLIPPER_VERSION=0.54.0
26+
27+
# Version of flipper SDK to use with React Native
28+
FLIPPER_VERSION=0.99.0
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)