Skip to content

Commit 1245e82

Browse files
authored
Merge pull request #59 from powersync-ja/chore/update-android-minsdkversion
React native 0.76 compatibility
2 parents a05dae6 + 2804695 commit 1245e82

File tree

68 files changed

+4532
-4422
lines changed

Some content is hidden

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

68 files changed

+4532
-4422
lines changed

.changeset/weak-planes-joke.md

Lines changed: 5 additions & 0 deletions

android/CMakeLists.txt

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,37 @@ set_target_properties(
5050
find_package(ReactAndroid REQUIRED CONFIG)
5151
find_package(fbjni REQUIRED CONFIG)
5252
find_package(powersync_sqlite_core REQUIRED CONFIG)
53-
find_library(LOG_LIB log)
54-
55-
if(${USE_HERMES})
56-
set(JSEXECUTOR_LIB ReactAndroid::hermes_executor)
57-
else()
58-
set(JSEXECUTOR_LIB ReactAndroid::jscexecutor)
59-
endif()
6053

54+
find_library(LOG_LIB log)
6155

6256
target_link_libraries(
6357
${PACKAGE_NAME}
6458
${LOG_LIB}
6559
fbjni::fbjni
6660
ReactAndroid::jsi
67-
ReactAndroid::turbomodulejsijni
68-
ReactAndroid::react_nativemodule_core
69-
${JSEXECUTOR_LIB}
7061
android
7162
powersync_sqlite_core::powersync
7263
)
64+
65+
# This if-then-else can be removed once this library does not support react-native versions below 0.76
66+
# Ideally we would just depend on `REACTNATIVE_MERGED_SO`
67+
# See https://github.com/react-native-community/discussions-and-proposals/discussions/816
68+
if(REACTNATIVE_MERGED_SO OR ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
69+
target_link_libraries(
70+
${PACKAGE_NAME}
71+
ReactAndroid::reactnative
72+
)
73+
else()
74+
if(${USE_HERMES})
75+
set(JSEXECUTOR_LIB ReactAndroid::hermes_executor)
76+
else()
77+
set(JSEXECUTOR_LIB ReactAndroid::jscexecutor)
78+
endif()
79+
80+
target_link_libraries(
81+
${PACKAGE_NAME}
82+
ReactAndroid::turbomodulejsijni
83+
ReactAndroid::react_nativemodule_core
84+
${JSEXECUTOR_LIB}
85+
)
86+
endif()

android/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ repositories {
4747

4848
android {
4949

50+
namespace "com.reactnativequicksqlite"
5051
compileSdkVersion safeExtGet("compileSdkVersion", 28)
5152

5253
// Used to override the NDK path/version on internal CI or by allowing
@@ -67,7 +68,7 @@ android {
6768
}
6869

6970
defaultConfig {
70-
minSdkVersion 23
71+
minSdkVersion 24
7172
targetSdkVersion safeExtGet('targetSdkVersion', 28)
7273
versionCode 1
7374
versionName "1.0"
@@ -90,7 +91,10 @@ android {
9091
"META-INF/**",
9192
"**/libjsi.so",
9293
"**/libreact_nativemodule_core.so",
93-
"**/libturbomodulejsijni.so"
94+
"**/libturbomodulejsijni.so",
95+
"**/libreactnative.so",
96+
"**/libc++_shared.so",
97+
"**/libfbjni.so"
9498
]
9599
}
96100

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.reactnativequicksqlite">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
</manifest>

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
"devDependencies": {
5151
"@changesets/cli": "^2.26.2",
5252
"prettier": "^3.3.3",
53-
"react": "18.2.0",
54-
"react-native": "0.74.5",
53+
"react": "18.3.1",
54+
"react-native": "0.76.2",
5555
"react-native-builder-bob": "^0.30.1",
56-
"typescript": "^4.8.4"
56+
"typescript": "^5.3.3"
5757
},
5858
"peerDependencies": {
5959
"react": "*",

tests/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ yarn-error.*
3333

3434
# typescript
3535
*.tsbuildinfo
36+
37+
# Expo
38+
.expo
39+
dist/
40+
web-build/

tests/android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build/
1010
local.properties
1111
*.iml
1212
*.hprof
13+
.cxx/
1314

1415
# Bundle artifacts
1516
*.jsbundle

tests/android/app/build.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ react {
2020
bundleCommand = "export:embed"
2121

2222
/* Folders */
23-
// The root of your project, i.e. where "package.json" lives. Default is '..'
24-
// root = file("../")
25-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
26-
// reactNativeDir = file("../node_modules/react-native")
27-
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
28-
// codegenDir = file("../node_modules/@react-native/codegen")
23+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
24+
// root = file("../../")
25+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
26+
// reactNativeDir = file("../../node_modules/react-native")
27+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
28+
// codegenDir = file("../../node_modules/@react-native/codegen")
2929

3030
/* Variants */
3131
// The list of variants to that are debuggable. For those we're going to
@@ -57,6 +57,9 @@ react {
5757
//
5858
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5959
// hermesFlags = ["-O", "-output-source-map"]
60+
61+
/* Autolinking */
62+
autolinkLibrariesWithApp()
6063
}
6164

6265
/**
@@ -90,8 +93,6 @@ android {
9093
targetSdkVersion rootProject.ext.targetSdkVersion
9194
versionCode 1
9295
versionName "1.0.0"
93-
94-
buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
9596
}
9697
signingConfigs {
9798
debug {
@@ -112,13 +113,17 @@ android {
112113
shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
113114
minifyEnabled enableProguardInReleaseBuilds
114115
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
116+
crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true)
115117
}
116118
}
117119
packagingOptions {
118120
jniLibs {
119121
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
120122
}
121123
}
124+
androidResources {
125+
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
126+
}
122127
}
123128

124129
// Apply static values from `gradle.properties` to the `android.packagingOptions`
@@ -163,14 +168,9 @@ dependencies {
163168
}
164169
}
165170

166-
implementation("com.facebook.react:flipper-integration")
167-
168171
if (hermesEnabled.toBoolean()) {
169172
implementation("com.facebook.react:hermes-android")
170173
} else {
171174
implementation jscFlavor
172175
}
173176
}
174-
175-
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
176-
applyNativeModulesAppBuildGradle(project)

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
<data android:scheme="https"/>
1212
</intent>
1313
</queries>
14-
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
14+
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true">
1515
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
16-
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="50.0.0"/>
1716
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
1817
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
1918
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
@@ -28,6 +27,5 @@
2827
<data android:scheme="com.reactnativequicksqlite.tests"/>
2928
</intent-filter>
3029
</activity>
31-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
3230
</application>
3331
</manifest>

tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainActivity.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.reactnativequicksqlite.tests
2+
import expo.modules.splashscreen.SplashScreenManager
23

34
import android.os.Build
45
import android.os.Bundle
@@ -15,7 +16,10 @@ class MainActivity : ReactActivity() {
1516
// Set the theme to AppTheme BEFORE onCreate to support
1617
// coloring the background, status bar, and navigation bar.
1718
// This is required for expo-splash-screen.
18-
setTheme(R.style.AppTheme);
19+
// setTheme(R.style.AppTheme);
20+
// @generated begin expo-splashscreen - expo prebuild (DO NOT MODIFY) sync-f3ff59a738c56c9a6119210cb55f0b613eb8b6af
21+
SplashScreenManager.registerOnActivity(this)
22+
// @generated end expo-splashscreen
1923
super.onCreate(null)
2024
}
2125

0 commit comments

Comments
 (0)