Skip to content

Commit 4548a06

Browse files
committed
refactor(example): upgrade to react native 0.75.4
1 parent 6cc4edf commit 4548a06

24 files changed

+4450
-3936
lines changed

examples/default/android/app/build.gradle

Lines changed: 14 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
45

5-
import com.android.build.OutputFile
6-
76
/**
87
* This is the configuration block to customize your React Native Android app.
98
* By default you don't need to apply any configuration, just uncomment the lines you need.
109
*/
1110
react {
1211
/* Folders */
13-
// The root of your project, i.e. where "package.json" lives. Default is '..'
14-
// root = file("../")
15-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
16-
// reactNativeDir = file("../node_modules/react-native")
17-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
18-
// codegenDir = file("../node_modules/react-native-codegen")
19-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
20-
// cliFile = file("../node_modules/react-native/cli.js")
12+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
13+
// root = file("../../")
14+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
15+
// reactNativeDir = file("../../node_modules/react-native")
16+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
17+
// codegenDir = file("../../node_modules/@react-native/codegen")
18+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
19+
// cliFile = file("../../node_modules/react-native/cli.js")
2120

2221
/* Variants */
2322
// The list of variants to that are debuggable. For those we're going to
@@ -51,6 +50,9 @@ react {
5150
//
5251
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5352
// hermesFlags = ["-O", "-output-source-map"]
53+
54+
/* Autolinking */
55+
autolinkLibrariesWithApp()
5456
}
5557

5658
project.ext.vectoricons = [
@@ -59,14 +61,6 @@ project.ext.vectoricons = [
5961

6062
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
6163

62-
/**
63-
* Set this to true to create four separate APKs instead of one,
64-
* one for each native architecture. This is useful if you don't
65-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
66-
* and want to have separate APKs to upload to the Play Store.
67-
*/
68-
def enableSeparateBuildPerCPUArchitecture = false
69-
7064
/**
7165
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
7266
*/
@@ -85,20 +79,10 @@ def enableProguardInReleaseBuilds = false
8579
*/
8680
def jscFlavor = 'org.webkit:android-jsc:+'
8781

88-
/**
89-
* Private function to get the list of Native Architectures you want to build.
90-
* This reads the value from reactNativeArchitectures in your gradle.properties
91-
* file and works together with the --active-arch-only flag of react-native run-android.
92-
*/
93-
def reactNativeArchitectures() {
94-
def value = project.getProperties().get("reactNativeArchitectures")
95-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
96-
}
97-
9882
android {
9983
ndkVersion rootProject.ext.ndkVersion
100-
101-
compileSdkVersion rootProject.ext.compileSdkVersion
84+
buildToolsVersion rootProject.ext.buildToolsVersion
85+
compileSdk rootProject.ext.compileSdkVersion
10286

10387
namespace "com.instabug.react.example"
10488
defaultConfig {
@@ -111,15 +95,6 @@ android {
11195
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
11296
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
11397
}
114-
115-
splits {
116-
abi {
117-
reset()
118-
enable enableSeparateBuildPerCPUArchitecture
119-
universalApk false // If true, also generate a universal APK
120-
include (*reactNativeArchitectures())
121-
}
122-
}
12398
signingConfigs {
12499
debug {
125100
storeFile file('debug.keystore')
@@ -128,9 +103,6 @@ android {
128103
keyPassword 'android'
129104
}
130105
}
131-
buildFeatures {
132-
buildConfig true
133-
}
134106
buildTypes {
135107
debug {
136108
signingConfig signingConfigs.debug
@@ -144,22 +116,6 @@ android {
144116
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
145117
}
146118
}
147-
148-
// applicationVariants are e.g. debug, release
149-
applicationVariants.all { variant ->
150-
variant.outputs.each { output ->
151-
// For each separate APK per architecture, set a unique version code as described here:
152-
// https://developer.android.com/studio/build/configure-apk-splits.html
153-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
154-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
155-
def abi = output.getFilter(OutputFile.ABI)
156-
if (abi != null) { // null for the universal-debug, universal-release variants
157-
output.versionCodeOverride =
158-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
159-
}
160-
161-
}
162-
}
163119
externalNativeBuild {
164120
cmake {
165121
path file('src/main/cpp/CMakeLists.txt')
@@ -184,5 +140,3 @@ dependencies {
184140
androidTestImplementation('com.wix:detox:+') { transitive = true }
185141
androidTestImplementation 'junit:junit:4.12'
186142
}
187-
188-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

examples/default/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@
77
<application
88
android:usesCleartextTraffic="true"
99
tools:targetApi="28"
10-
tools:ignore="GoogleAppIndexingWarning">
11-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12-
</application>
10+
tools:ignore="GoogleAppIndexingWarning"/>
1311
</manifest>

examples/default/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
1111
android:theme="@style/AppTheme"
12+
android:supportsRtl="true"
1213
android:networkSecurityConfig="@xml/network_security_config">
1314
<activity
1415
android:name=".MainActivity"

examples/default/android/app/src/main/java/com/instabug/react/example/MainActivity.java

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.instabug.react.example
2+
3+
import com.facebook.react.ReactActivity
4+
import com.facebook.react.ReactActivityDelegate
5+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6+
import com.facebook.react.defaults.DefaultReactActivityDelegate
7+
8+
class MainActivity : ReactActivity() {
9+
10+
/**
11+
* Returns the name of the main component registered from JavaScript. This is used to schedule
12+
* rendering of the component.
13+
*/
14+
override fun getMainComponentName(): String = "InstabugExample"
15+
16+
/**
17+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19+
*/
20+
override fun createReactActivityDelegate(): ReactActivityDelegate =
21+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22+
}

examples/default/android/app/src/main/java/com/instabug/react/example/MainApplication.java

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.instabug.react.example
2+
3+
import android.app.Application
4+
import com.facebook.react.PackageList
5+
import com.facebook.react.ReactApplication
6+
import com.facebook.react.ReactHost
7+
import com.facebook.react.ReactNativeHost
8+
import com.facebook.react.ReactPackage
9+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11+
import com.facebook.react.defaults.DefaultReactNativeHost
12+
import com.facebook.soloader.SoLoader
13+
14+
class MainApplication : Application(), ReactApplication {
15+
16+
override val reactNativeHost: ReactNativeHost =
17+
object : DefaultReactNativeHost(this) {
18+
override fun getPackages(): List<ReactPackage> =
19+
PackageList(this).packages.apply {
20+
// Packages that cannot be autolinked yet can be added manually here, for example:
21+
add(RNInstabugExampleReactnativePackage())
22+
}
23+
24+
override fun getJSMainModuleName(): String = "index"
25+
26+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
27+
28+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
29+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
30+
}
31+
32+
override val reactHost: ReactHost
33+
get() = getDefaultReactHost(applicationContext, reactNativeHost)
34+
35+
override fun onCreate() {
36+
super.onCreate()
37+
SoLoader.init(this, false)
38+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
39+
// If you opted-in for the New Architecture, we load the native entry point for this app.
40+
load()
41+
}
42+
}
43+
}

examples/default/android/build.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "33.0.0"
6-
minSdkVersion = 21
5+
buildToolsVersion = "34.0.0"
6+
minSdkVersion = 23
77
compileSdkVersion = 34
8-
targetSdkVersion = 33
9-
kotlinVersion = "1.7.10"
10-
11-
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
12-
ndkVersion = "23.1.7779620"
8+
targetSdkVersion = 34
9+
ndkVersion = "26.1.10909125"
10+
kotlinVersion = "1.9.24"
1311
}
1412
repositories {
1513
google()

examples/default/android/gradle.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
2121
# Android operating system, and which are packaged with your app's APK
2222
# https://developer.android.com/topic/libraries/support-library/androidx-rn
2323
android.useAndroidX=true
24-
# Automatically convert third-party libraries to use AndroidX
25-
android.enableJetifier=true
2624

2725
# Use this property to specify which architecture you want to build.
2826
# You can also override it from the CLI using
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
33
networkTimeout=10000
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)