Skip to content

Commit

Permalink
feat: Upgrade to react-native 0.75 (#729)
Browse files Browse the repository at this point in the history
* feat: Upgrade to react-native 0.75

* Update podfile

* Update .eslintrc.js

* fix: Fix lockfiles

* Update README.md
  • Loading branch information
mrousavy committed Aug 29, 2024
1 parent 430c2f5 commit 69e7240
Show file tree
Hide file tree
Showing 19 changed files with 3,261 additions and 3,566 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,10 @@
## react-native-mmkv V3

> [!IMPORTANT]
> react-native-mmkv V3 is now a pure C++ TurboModule, and **requires the new architecture to be enabled**.
> react-native-mmkv V3 is now a pure C++ TurboModule, and **requires the new architecture to be enabled**. (react-native 0.75+)
> - If you want to use react-native-mmkv 3.x.x, you need to enable the new architecture in your app (see ["Enable the New Architecture for Apps"](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md))
> - If you cannot use the new architecture yet, downgrade to react-native-mmkv 2.x.x for now.
## Sponsors

<div align="right">
<a href="https://getstream.io/chat/react-native-chat/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_ReactNative&utm_term=react-native-mmkv">
<img align="right" src="https://theme.zdassets.com/theme_assets/9442057/efc3820e436f9150bc8cf34267fff4df052a1f9c.png" height="40" />
</a>
</div>

react-native-mmkv is sponsored by **getstream.io**. <br/>
[Try the React Native Chat tutorial 💬](https://getstream.io/chat/react-native-chat/tutorial/?utm_source=Github&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Github_Jan2022_ReactNative&utm_term=react-native-mmkv)

## Benchmark

[StorageBenchmark](https://github.com/mrousavy/StorageBenchmark) compares popular storage libraries against each other by reading a value from storage for 1000 times:
Expand Down
1 change: 1 addition & 0 deletions package/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
root: true,
extends: ['@react-native', 'plugin:prettier/recommended'],
plugins: ['prettier'],
ignorePatterns: ['scripts', 'lib'],
rules: {
'prettier/prettier': ['warn'],
Expand Down
19 changes: 1 addition & 18 deletions package/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,11 @@ def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Mmkv_" + name]).toInteger()
}

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
return (major == 7 && minor >= 3) || major >= 8
}

logger.warn("[react-native-mmkv] Thank you for using react-native-mmkv ❤️")
logger.warn("[react-native-mmkv] If you enjoy using react-native-mmkv, please consider sponsoring this project: https://github.com/sponsors/mrousavy")

android {
if (supportsNamespace()) {
namespace "com.mrousavy.mmkv"

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
namespace "com.mrousavy.mmkv"

ndkVersion getExtOrDefault("ndkVersion")
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
Expand Down
10 changes: 5 additions & 5 deletions package/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Mmkv_kotlinVersion=1.7.0
Mmkv_minSdkVersion=21
Mmkv_targetSdkVersion=31
Mmkv_compileSdkVersion=31
Mmkv_ndkversion=21.4.7075529
Mmkv_kotlinVersion=1.9.24
Mmkv_minSdkVersion=23
Mmkv_targetSdkVersion=34
Mmkv_compileSdkVersion=34
Mmkv_ndkversion=26.1.10909125
3 changes: 1 addition & 2 deletions package/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mrousavy.mmkv">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
2 changes: 0 additions & 2 deletions package/android/src/main/AndroidManifestNew.xml

This file was deleted.

7 changes: 3 additions & 4 deletions package/example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
# bound in the template on Cocoapods with next React Native release.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
5 changes: 3 additions & 2 deletions package/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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()
}

/**
Expand Down Expand Up @@ -114,5 +117,3 @@ dependencies {
implementation jscFlavor
}
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
3 changes: 2 additions & 1 deletion package/example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
android:exported="true"
android:supportsRtl="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
2 changes: 1 addition & 1 deletion package/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
kotlinVersion = "1.9.24"
}
repositories {
google()
Expand Down
2 changes: 0 additions & 2 deletions package/example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ org.gradle.jvmargs=-Xmx4096m -Xms512M -XX:MaxMetaspaceSize=1g
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 5 additions & 1 deletion package/example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

rootProject.name = 'MmkvExample'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
1 change: 1 addition & 0 deletions package/example/ios/MmkvExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
USE_HERMES = true;
};
name = Debug;
Expand Down
Loading

0 comments on commit 69e7240

Please sign in to comment.