diff --git a/.changeset/weak-planes-joke.md b/.changeset/weak-planes-joke.md new file mode 100644 index 0000000..b242903 --- /dev/null +++ b/.changeset/weak-planes-joke.md @@ -0,0 +1,5 @@ +--- +'@journeyapps/react-native-quick-sqlite': minor +--- + +Upgrade minSdkVersion to 24 for Expo 52 diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index eb4db43..fa87281 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -50,23 +50,37 @@ set_target_properties( find_package(ReactAndroid REQUIRED CONFIG) find_package(fbjni REQUIRED CONFIG) find_package(powersync_sqlite_core REQUIRED CONFIG) -find_library(LOG_LIB log) - -if(${USE_HERMES}) - set(JSEXECUTOR_LIB ReactAndroid::hermes_executor) -else() - set(JSEXECUTOR_LIB ReactAndroid::jscexecutor) -endif() +find_library(LOG_LIB log) target_link_libraries( ${PACKAGE_NAME} ${LOG_LIB} fbjni::fbjni ReactAndroid::jsi - ReactAndroid::turbomodulejsijni - ReactAndroid::react_nativemodule_core - ${JSEXECUTOR_LIB} android powersync_sqlite_core::powersync ) + +# This if-then-else can be removed once this library does not support react-native versions below 0.76 +# Ideally we would just depend on `REACTNATIVE_MERGED_SO` +# See https://github.com/react-native-community/discussions-and-proposals/discussions/816 +if(REACTNATIVE_MERGED_SO OR ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) + target_link_libraries( + ${PACKAGE_NAME} + ReactAndroid::reactnative + ) +else() + if(${USE_HERMES}) + set(JSEXECUTOR_LIB ReactAndroid::hermes_executor) + else() + set(JSEXECUTOR_LIB ReactAndroid::jscexecutor) + endif() + + target_link_libraries( + ${PACKAGE_NAME} + ReactAndroid::turbomodulejsijni + ReactAndroid::react_nativemodule_core + ${JSEXECUTOR_LIB} + ) +endif() diff --git a/android/build.gradle b/android/build.gradle index 214dd17..02ebf75 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -47,6 +47,7 @@ repositories { android { + namespace "com.reactnativequicksqlite" compileSdkVersion safeExtGet("compileSdkVersion", 28) // Used to override the NDK path/version on internal CI or by allowing @@ -67,7 +68,7 @@ android { } defaultConfig { - minSdkVersion 23 + minSdkVersion 24 targetSdkVersion safeExtGet('targetSdkVersion', 28) versionCode 1 versionName "1.0" @@ -90,7 +91,10 @@ android { "META-INF/**", "**/libjsi.so", "**/libreact_nativemodule_core.so", - "**/libturbomodulejsijni.so" + "**/libturbomodulejsijni.so", + "**/libreactnative.so", + "**/libc++_shared.so", + "**/libfbjni.so" ] } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index b4a1974..0a0938a 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,4 +1,3 @@ - + diff --git a/package.json b/package.json index efb1f3c..d2a468d 100644 --- a/package.json +++ b/package.json @@ -50,10 +50,10 @@ "devDependencies": { "@changesets/cli": "^2.26.2", "prettier": "^3.3.3", - "react": "18.2.0", - "react-native": "0.74.5", + "react": "18.3.1", + "react-native": "0.76.2", "react-native-builder-bob": "^0.30.1", - "typescript": "^4.8.4" + "typescript": "^5.3.3" }, "peerDependencies": { "react": "*", diff --git a/tests/.gitignore b/tests/.gitignore index 05647d5..050e711 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -33,3 +33,8 @@ yarn-error.* # typescript *.tsbuildinfo + +# Expo +.expo +dist/ +web-build/ \ No newline at end of file diff --git a/tests/android/.gitignore b/tests/android/.gitignore index 877b87e..8a6be07 100644 --- a/tests/android/.gitignore +++ b/tests/android/.gitignore @@ -10,6 +10,7 @@ build/ local.properties *.iml *.hprof +.cxx/ # Bundle artifacts *.jsbundle diff --git a/tests/android/app/build.gradle b/tests/android/app/build.gradle index 876f613..b42ffb4 100644 --- a/tests/android/app/build.gradle +++ b/tests/android/app/build.gradle @@ -20,12 +20,12 @@ react { bundleCommand = "export:embed" /* Folders */ - // The root of your project, i.e. where "package.json" lives. Default is '..' - // root = file("../") - // The folder where the react-native NPM package is. Default is ../node_modules/react-native - // reactNativeDir = file("../node_modules/react-native") - // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen - // codegenDir = file("../node_modules/@react-native/codegen") + // The root of your project, i.e. where "package.json" lives. Default is '../..' + // root = file("../../") + // The folder where the react-native NPM package is. Default is ../../node_modules/react-native + // reactNativeDir = file("../../node_modules/react-native") + // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen + // codegenDir = file("../../node_modules/@react-native/codegen") /* Variants */ // The list of variants to that are debuggable. For those we're going to @@ -57,6 +57,9 @@ react { // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] + + /* Autolinking */ + autolinkLibrariesWithApp() } /** @@ -90,8 +93,6 @@ android { targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0.0" - - buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString()) } signingConfigs { debug { @@ -112,6 +113,7 @@ android { shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false) minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true) } } packagingOptions { @@ -119,6 +121,9 @@ android { useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false) } } + androidResources { + ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~' + } } // Apply static values from `gradle.properties` to the `android.packagingOptions` @@ -163,14 +168,9 @@ dependencies { } } - implementation("com.facebook.react:flipper-integration") - if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } - -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"); -applyNativeModulesAppBuildGradle(project) diff --git a/tests/android/app/src/main/AndroidManifest.xml b/tests/android/app/src/main/AndroidManifest.xml index e670341..a6f7958 100644 --- a/tests/android/app/src/main/AndroidManifest.xml +++ b/tests/android/app/src/main/AndroidManifest.xml @@ -11,9 +11,8 @@ - + - @@ -28,6 +27,5 @@ - \ No newline at end of file diff --git a/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainActivity.kt b/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainActivity.kt index fa5802a..04880c1 100644 --- a/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainActivity.kt +++ b/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainActivity.kt @@ -1,4 +1,5 @@ package com.reactnativequicksqlite.tests +import expo.modules.splashscreen.SplashScreenManager import android.os.Build import android.os.Bundle @@ -15,7 +16,10 @@ class MainActivity : ReactActivity() { // Set the theme to AppTheme BEFORE onCreate to support // coloring the background, status bar, and navigation bar. // This is required for expo-splash-screen. - setTheme(R.style.AppTheme); + // setTheme(R.style.AppTheme); + // @generated begin expo-splashscreen - expo prebuild (DO NOT MODIFY) sync-f3ff59a738c56c9a6119210cb55f0b613eb8b6af + SplashScreenManager.registerOnActivity(this) + // @generated end expo-splashscreen super.onCreate(null) } diff --git a/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainApplication.kt b/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainApplication.kt index 56e81dd..ade3368 100644 --- a/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainApplication.kt +++ b/tests/android/app/src/main/java/com/reactnativequicksqlite/tests/MainApplication.kt @@ -2,18 +2,15 @@ package com.reactnativequicksqlite.tests import android.app.Application import android.content.res.Configuration -import androidx.annotation.NonNull import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactNativeHost import com.facebook.react.ReactPackage import com.facebook.react.ReactHost -import com.facebook.react.config.ReactFeatureFlags import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load -import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost -import com.facebook.react.flipper.ReactNativeFlipper +import com.facebook.react.soloader.OpenSourceMergedSoMapping import com.facebook.soloader.SoLoader import expo.modules.ApplicationLifecycleDispatcher @@ -25,9 +22,10 @@ class MainApplication : Application(), ReactApplication { this, object : DefaultReactNativeHost(this) { override fun getPackages(): List { + val packages = PackageList(this).packages // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); - return PackageList(this).packages + return packages } override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry" @@ -40,21 +38,15 @@ class MainApplication : Application(), ReactApplication { ) override val reactHost: ReactHost - get() = getDefaultReactHost(this.applicationContext, reactNativeHost) + get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost) override fun onCreate() { super.onCreate() - SoLoader.init(this, false) - if (!BuildConfig.REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS) { - ReactFeatureFlags.unstable_useRuntimeSchedulerAlways = false - } + SoLoader.init(this, OpenSourceMergedSoMapping) if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app. load() } - if (BuildConfig.DEBUG) { - ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager) - } ApplicationLifecycleDispatcher.onApplicationCreate(this) } diff --git a/tests/android/app/src/main/res/drawable-hdpi/splashscreen_image.png b/tests/android/app/src/main/res/drawable-hdpi/splashscreen_image.png deleted file mode 100644 index c52c2c6..0000000 Binary files a/tests/android/app/src/main/res/drawable-hdpi/splashscreen_image.png and /dev/null differ diff --git a/tests/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png b/tests/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png new file mode 100644 index 0000000..0908137 Binary files /dev/null and b/tests/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png differ diff --git a/tests/android/app/src/main/res/drawable-mdpi/splashscreen_image.png b/tests/android/app/src/main/res/drawable-mdpi/splashscreen_image.png deleted file mode 100644 index c52c2c6..0000000 Binary files a/tests/android/app/src/main/res/drawable-mdpi/splashscreen_image.png and /dev/null differ diff --git a/tests/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png b/tests/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png new file mode 100644 index 0000000..ac8a5bb Binary files /dev/null and b/tests/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png differ diff --git a/tests/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png b/tests/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png deleted file mode 100644 index c52c2c6..0000000 Binary files a/tests/android/app/src/main/res/drawable-xhdpi/splashscreen_image.png and /dev/null differ diff --git a/tests/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png b/tests/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png new file mode 100644 index 0000000..cec3361 Binary files /dev/null and b/tests/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png differ diff --git a/tests/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png b/tests/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png deleted file mode 100644 index c52c2c6..0000000 Binary files a/tests/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.png and /dev/null differ diff --git a/tests/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png b/tests/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png new file mode 100644 index 0000000..6c08a11 Binary files /dev/null and b/tests/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png differ diff --git a/tests/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png b/tests/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png deleted file mode 100644 index c52c2c6..0000000 Binary files a/tests/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.png and /dev/null differ diff --git a/tests/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png b/tests/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png new file mode 100644 index 0000000..fbe261e Binary files /dev/null and b/tests/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png differ diff --git a/tests/android/app/src/main/res/drawable/splashscreen.xml b/tests/android/app/src/main/res/drawable/ic_launcher_background.xml similarity index 59% rename from tests/android/app/src/main/res/drawable/splashscreen.xml rename to tests/android/app/src/main/res/drawable/ic_launcher_background.xml index c8568e1..883b2a0 100644 --- a/tests/android/app/src/main/res/drawable/splashscreen.xml +++ b/tests/android/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,3 +1,6 @@ + + + \ No newline at end of file diff --git a/tests/android/app/src/main/res/drawable/rn_edit_text_material.xml b/tests/android/app/src/main/res/drawable/rn_edit_text_material.xml index 73b37e4..5c25e72 100644 --- a/tests/android/app/src/main/res/drawable/rn_edit_text_material.xml +++ b/tests/android/app/src/main/res/drawable/rn_edit_text_material.xml @@ -17,7 +17,8 @@ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material" android:insetRight="@dimen/abc_edit_text_inset_horizontal_material" android:insetTop="@dimen/abc_edit_text_inset_top_material" - android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"> + android:insetBottom="@dimen/abc_edit_text_inset_bottom_material" + >