Skip to content

Commit be100c0

Browse files
authored
feat: react native 82 upgrade (#118)
* react native 82 upgrade changes, ios fixes still needed * react native 82 fixed in ios * package.json fix * removed unnecessary dependencies * another dependency removed * added eslint config dependency back * regenerate package-lock.json
1 parent b263e89 commit be100c0

File tree

28 files changed

+19976
-29620
lines changed

28 files changed

+19976
-29620
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ DerivedData
2727
*.hmap
2828
*.ipa
2929
*.xcuserstate
30+
**/.xcode.env.local
3031
project.xcworkspace
3132
example/ios/.xcode.env.local
3233

@@ -44,6 +45,7 @@ android.iml
4445
# Cocoapods
4546
#
4647
example/ios/Pods
48+
**/Pods/
4749

4850
# node.js
4951
#
@@ -64,3 +66,11 @@ android/keystores/debug.keystore
6466

6567
# generated by bob
6668
lib/
69+
70+
# Yarn
71+
.yarn/*
72+
!.yarn/patches
73+
!.yarn/plugins
74+
!.yarn/releases
75+
!.yarn/sdks
76+
!.yarn/versions

android/build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.3'
9+
classpath 'com.android.tools.build:gradle:8.8.0'
1010
}
1111
}
1212
}
@@ -19,10 +19,10 @@ def safeExtGet(prop, fallback) {
1919
}
2020

2121
android {
22-
compileSdkVersion safeExtGet('IdscanSdk_compileSdkVersion', 31)
22+
compileSdkVersion safeExtGet('IdscanSdk_compileSdkVersion', 36)
2323
defaultConfig {
24-
minSdkVersion safeExtGet('IdscanSdk_minSdkVersion', 19)
25-
targetSdkVersion safeExtGet('IdscanSdk_targetSdkVersion', 31)
24+
minSdkVersion safeExtGet('IdscanSdk_minSdkVersion', 24)
25+
targetSdkVersion safeExtGet('IdscanSdk_targetSdkVersion', 36)
2626
versionCode 1
2727
versionName "1.0"
2828
}
@@ -36,8 +36,8 @@ android {
3636
disable 'GradleCompatible'
3737
}
3838
compileOptions {
39-
sourceCompatibility JavaVersion.VERSION_1_8
40-
targetCompatibility JavaVersion.VERSION_1_8
39+
sourceCompatibility JavaVersion.VERSION_17
40+
targetCompatibility JavaVersion.VERSION_17
4141
}
4242
}
4343

@@ -54,9 +54,9 @@ repositories {
5454

5555
dependencies {
5656
//noinspection GradleDynamicVersion
57-
implementation "com.facebook.react:react-native:+" // From node_modules
58-
implementation "androidx.core:core-ktx:1.7.0"
59-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
57+
implementation "com.facebook.react:react-android" // From node_modules
58+
implementation "androidx.core:core-ktx:1.15.0"
59+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
6060

6161
// IDScan dependencies
6262
implementation 'net.idscan.components.android:dlparser-standard:1.30.0'

example/.prettierrc.js

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

example/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
88
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
99
gem 'xcodeproj', '< 1.26.0'
1010
gem 'concurrent-ruby', '< 1.3.4'
11-
11+
1212
# Ruby 3.4.0 has removed some libraries from the standard library.
1313
gem 'bigdecimal'
1414
gem 'logger'

example/android/app/build.gradle

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ apply plugin: "com.facebook.react"
88
*/
99
react {
1010
/* Folders */
11-
// The root of your project, i.e. where "package.json" lives. Default is '..'
12-
// root = file("../")
13-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
14-
// reactNativeDir = file("../node_modules/react-native")
15-
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16-
// codegenDir = file("../node_modules/@react-native/codegen")
17-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
18-
// cliFile = file("../node_modules/react-native/cli.js")
11+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
12+
// root = file("../../")
13+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14+
// reactNativeDir = file("../../node_modules/react-native")
15+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16+
// codegenDir = file("../../node_modules/@react-native/codegen")
17+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18+
// cliFile = file("../../node_modules/react-native/cli.js")
1919

2020
/* Variants */
2121
// The list of variants to that are debuggable. For those we're going to
@@ -49,6 +49,9 @@ react {
4949
//
5050
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5151
// hermesFlags = ["-O", "-output-source-map"]
52+
53+
/* Autolinking */
54+
autolinkLibrariesWithApp()
5255
}
5356

5457
/**
@@ -67,7 +70,7 @@ def enableProguardInReleaseBuilds = false
6770
* give correct results when using with locales other than en-US. Note that
6871
* this variant is about 6MiB larger per architecture than default.
6972
*/
70-
def jscFlavor = 'org.webkit:android-jsc:+'
73+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
7174

7275
android {
7376
ndkVersion rootProject.ext.ndkVersion
@@ -108,12 +111,9 @@ dependencies {
108111
// The version of react-native is set by the React Native Gradle Plugin
109112
implementation("com.facebook.react:react-android")
110113

111-
implementation("com.facebook.react:flipper-integration")
112114
if (hermesEnabled.toBoolean()) {
113115
implementation("com.facebook.react:hermes-android")
114116
} else {
115117
implementation jscFlavor
116118
}
117119
}
118-
119-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
android:roundIcon="@mipmap/ic_launcher_round"
1111
android:allowBackup="false"
1212
android:theme="@style/AppTheme"
13+
android:usesCleartextTraffic="${usesCleartextTraffic}"
14+
android:supportsRtl="true"
1315
tools:replace="android:allowBackup">
1416
<activity
1517
android:name=".MainActivity"

example/android/app/src/main/java/com/example/reactnativeidscansdk/MainApplication.kt

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,24 @@ import android.app.Application
44
import com.facebook.react.PackageList
55
import com.facebook.react.ReactApplication
66
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
7+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
108
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11-
import com.facebook.react.defaults.DefaultReactNativeHost
12-
import com.facebook.react.flipper.ReactNativeFlipper
13-
import com.facebook.soloader.SoLoader
149

1510
class MainApplication : Application(), ReactApplication {
1611

17-
override val reactNativeHost: ReactNativeHost =
18-
object : DefaultReactNativeHost(this) {
19-
override fun getPackages(): List<ReactPackage> {
12+
override val reactHost: ReactHost by lazy {
13+
getDefaultReactHost(
14+
context = applicationContext,
15+
packageList =
16+
PackageList(this).packages.apply {
2017
// Packages that cannot be autolinked yet can be added manually here, for example:
21-
// packages.add(new MyReactNativePackage());
22-
return PackageList(this).packages
23-
}
24-
override fun getJSMainModuleName(): String = "index"
25-
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
26-
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
27-
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
28-
}
29-
30-
override val reactHost: ReactHost
31-
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
18+
// add(MyReactNativePackage())
19+
},
20+
)
21+
}
3222

3323
override fun onCreate() {
3424
super.onCreate()
35-
SoLoader.init(this, false)
36-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
37-
// If you opted-in for the New Architecture, we load the native entry point for this app.
38-
load()
39-
}
40-
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
25+
loadReactNative(this)
4126
}
4227
}

example/android/build.gradle

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

33
buildscript {
44
ext {
5-
buildToolsVersion = "34.0.0"
6-
minSdkVersion = 21
7-
compileSdkVersion = 34
8-
targetSdkVersion = 34
9-
ndkVersion = "25.1.8937393"
10-
kotlinVersion = "1.8.0"
5+
buildToolsVersion = "36.0.0"
6+
minSdkVersion = 24
7+
compileSdkVersion = 36
8+
targetSdkVersion = 36
9+
ndkVersion = "27.1.12297006"
10+
kotlinVersion = "2.1.20"
1111
}
1212
repositories {
1313
google()

example/android/gradle.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
3434
# your application. You should enable this flag either if you want
3535
# to write custom TurboModules/Fabric components OR use libraries that
3636
# are providing them.
37-
newArchEnabled=false
37+
newArchEnabled=true
3838

3939
# Use this property to enable or disable the Hermes JS engine.
4040
# If set to false, you will be using JSC instead.
4141
hermesEnabled=true
42+
43+
# Use this property to enable edge-to-edge display support.
44+
# This allows your app to draw behind system bars for an immersive UI.
45+
# Note: Only works with ReactActivity and should not be used with custom Activity.
46+
edgeToEdgeEnabled=false

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)