Skip to content

Commit

Permalink
Support React Native 0.75 (#6185)
Browse files Browse the repository at this point in the history
## Summary

This PR adds support for React Native 0.75 (currently: **0.75.0-rc.6**).

https://swmansion.slack.com/archives/C048Z2NNEBY/p1719603649642539

## Test plan

---------

Co-authored-by: szydlovsky <9szydlowski9@gmail.com>
  • Loading branch information
tomekzaw and szydlovsky authored Aug 2, 2024
1 parent f26aebb commit 7df5fd5
Show file tree
Hide file tree
Showing 48 changed files with 3,024 additions and 911 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:

- name: Install Pods
working-directory: ${{ env.WORKING_DIRECTORY }}/macos
run: pod install
run: bundle install && bundle exec pod install

- name: Restore build artifacts from cache
uses: actions/cache@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/react-native-slider.podspec b/react-native-slider.podspec
index 54d77bd5e64ac01af46a8c177452b8fb6c889afa..e1903fbdcb4af2a4f89ee94f0e67d59461a98eea 100644
--- a/react-native-slider.podspec
+++ b/react-native-slider.podspec
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|

s.authors = package['author']
s.homepage = package['homepage']
- s.platforms = { :ios => "9.0", :visionos => "1.0" }
+ s.platforms = { :ios => "10.0", :visionos => "1.0" }

s.source = { :git => "https://github.com/callstack/react-native-slider.git", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm}"
52 changes: 52 additions & 0 deletions .yarn/patches/react-native-pager-view-npm-6.3.3-7b62f58674.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/android/src/fabric/java/com/reactnativepagerview/PagerViewViewManager.kt b/android/src/fabric/java/com/reactnativepagerview/PagerViewViewManager.kt
index aa974a6bad63f5015a75834f9740abacd0771e0d..c8e2f8583a5fbd89216b982d6115c34375f009e5 100644
--- a/android/src/fabric/java/com/reactnativepagerview/PagerViewViewManager.kt
+++ b/android/src/fabric/java/com/reactnativepagerview/PagerViewViewManager.kt
@@ -88,7 +88,7 @@ class PagerViewViewManager : ViewGroupManager<NestedScrollableHost>(), RNCViewPa
return host
}

- override fun addView(host: NestedScrollableHost, child: View?, index: Int) {
+ fun addView(host: NestedScrollableHost, child: View?, index: Int) {
PagerViewViewManagerImpl.addView(host, child, index)
}

diff --git a/android/src/paper/java/com/reactnativepagerview/PagerViewViewManager.kt b/android/src/paper/java/com/reactnativepagerview/PagerViewViewManager.kt
index 4d0adffe6a658de709319e0700b35f726783dca2..d3d99a2f2b8ce7f91e4056d07664d4fb6efc8115 100644
--- a/android/src/paper/java/com/reactnativepagerview/PagerViewViewManager.kt
+++ b/android/src/paper/java/com/reactnativepagerview/PagerViewViewManager.kt
@@ -69,7 +69,7 @@ class PagerViewViewManager : ViewGroupManager<NestedScrollableHost>() {
return host
}

- override fun addView(host: NestedScrollableHost, child: View?, index: Int) {
+ fun addView(host: NestedScrollableHost, child: View?, index: Int) {
PagerViewViewManagerImpl.addView(host, child, index)
}

diff --git a/lib/typescript/PagerView.d.ts b/lib/typescript/PagerView.d.ts
index f800118e8a8132a760cd7e21c712cf9c55ace7df..003900a2bef8fc81d04d5d059e445bbe18c7b022 100644
--- a/lib/typescript/PagerView.d.ts
+++ b/lib/typescript/PagerView.d.ts
@@ -69,7 +69,7 @@ declare class PagerViewInternal extends React.Component<NativeProps> {
render(): JSX.Element;
}
export declare const PagerView: React.ForwardRefExoticComponent<Omit<NativeProps, "useLegacy"> & {
- useNext: boolean;
+ useNext?: boolean;
} & React.RefAttributes<PagerViewInternal>>;
export type PagerView = PagerViewInternal & typeof PagerView;
export {};
diff --git a/src/PagerView.tsx b/src/PagerView.tsx
index 62faa7490cebb6ec8fcbaca16a35a6f4bfbad00d..79e36d5020b534db7aa869c7ddc7cb6f401125e0 100644
--- a/src/PagerView.tsx
+++ b/src/PagerView.tsx
@@ -225,7 +225,7 @@ class PagerViewInternal extends React.Component<NativeProps> {
}

// Temporary solution. It should be removed once all things get fixed
-type PagerViewProps = Omit<NativeProps, 'useLegacy'> & { useNext: boolean };
+type PagerViewProps = Omit<NativeProps, 'useLegacy'> & { useNext?: boolean };

export const PagerView = React.forwardRef<PagerViewInternal, PagerViewProps>(
(props, ref) => {
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewShadowNode.kt b/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewShadowNode.kt
index c1103ac1c3d124bf5856262015653bfe05ddd9af..a57fa38c8ed84eb7560b8c326c7a1d7de36a28c9 100644
--- a/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewShadowNode.kt
+++ b/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewShadowNode.kt
@@ -143,7 +143,7 @@ class SafeAreaViewShadowNode : LayoutShadowNode() {
override fun setPaddings(index: Int, padding: Dynamic) {
val spacingType = ViewProps.PADDING_MARGIN_SPACING_TYPES[index]
mPaddings[spacingType] =
- if (padding.getType() == ReadableType.Number) padding.asDouble().toFloat() else Float.NaN
+ if (padding.type == ReadableType.Number) padding.asDouble().toFloat() else Float.NaN
super.setPaddings(index, padding)
mNeedsUpdate = true
}
@@ -163,7 +163,7 @@ class SafeAreaViewShadowNode : LayoutShadowNode() {
override fun setMargins(index: Int, margin: Dynamic) {
val spacingType = ViewProps.PADDING_MARGIN_SPACING_TYPES[index]
mMargins[spacingType] =
- if (margin.getType() == ReadableType.Number) margin.asDouble().toFloat() else Float.NaN
+ if (margin.type == ReadableType.Number) margin.asDouble().toFloat() else Float.NaN
super.setMargins(index, margin)
mNeedsUpdate = true
}
18 changes: 9 additions & 9 deletions apps/common-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"@react-native-async-storage/async-storage": "^1.22.3",
"@react-native-community/slider": "^4.5.0",
"@react-native-community/slider": "patch:@react-native-community/slider@npm%3A4.5.2#~/.yarn/patches/@react-native-community-slider-npm-4.5.2-a70d91fe5a.patch",
"@react-native-masked-view/masked-view": "^0.3.1",
"@react-native-picker/picker": "^2.5.1",
"@react-navigation/bottom-tabs": "^6.5.20",
Expand All @@ -49,15 +49,15 @@
"eslint-plugin-reanimated": "workspace:*",
"patch-package": "^8.0.0",
"prettier": "2.8.8",
"react": "18.2.0",
"react-native": "0.74.0",
"react-native-gesture-handler": "^2.16.0",
"react-native-pager-view": "6.3.0",
"react": "18.3.1",
"react-native": "0.75.0-rc.6",
"react-native-gesture-handler": "2.18.0",
"react-native-pager-view": "patch:react-native-pager-view@npm%3A6.3.3#~/.yarn/patches/react-native-pager-view-npm-6.3.3-7b62f58674.patch",
"react-native-reanimated": "workspace:*",
"react-native-safe-area-context": "4.10.0-rc.1",
"react-native-screens": "3.31.0-rc.1",
"react-native-svg": "^15.2.0-rc.0",
"react-strict-dom": "^0.0.17",
"react-native-safe-area-context": "patch:react-native-safe-area-context@npm%3A4.10.8#~/.yarn/patches/react-native-safe-area-context-npm-4.10.8-bcca33ef13.patch",
"react-native-screens": "3.33.0",
"react-native-svg": "15.4.0",
"react-strict-dom": "0.0.18",
"typescript": "~5.3.0"
}
}
7 changes: 3 additions & 4 deletions apps/fabric-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'
4 changes: 2 additions & 2 deletions apps/fabric-example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.5, < 7.1.0)
cocoapods (>= 1.13, < 1.15)
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)

RUBY VERSION
ruby 3.2.2p53
Expand Down
16 changes: 9 additions & 7 deletions apps/fabric-example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ apply plugin: "com.facebook.react"
*/
react {
/* 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
// 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
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
codegenDir = file("../../../../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
cliFile = file("../../../../node_modules/react-native/cli.js")

/* Variants */
Expand Down Expand Up @@ -49,9 +49,13 @@ 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()
}

project.ext["isReanimatedExampleApp"] = true

/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
Expand Down Expand Up @@ -117,5 +121,3 @@ dependencies {

implementation("androidx.core:core-splashscreen:1.0.1")
}

apply from: file("../../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
3 changes: 2 additions & 1 deletion apps/fabric-example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/Theme.App.Starting">
android:theme="@style/AppTheme"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
2 changes: 1 addition & 1 deletion apps/fabric-example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 apps/fabric-example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
# 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
2 changes: 1 addition & 1 deletion apps/fabric-example/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
14 changes: 12 additions & 2 deletions apps/fabric-example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
pluginManagement { includeBuild("../../../node_modules/react-native/node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'FabricExample'
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')
includeBuild('../../../node_modules/react-native/node_modules/@react-native/gradle-plugin')
// includeBuild('../../../node_modules/react-native') {
// dependencySubstitution {
// substitute(module("com.facebook.react:react-android")).using(project(":packages:react-native:ReactAndroid"))
// substitute(module("com.facebook.react:react-native")).using(project(":packages:react-native:ReactAndroid"))
// substitute(module("com.facebook.react:hermes-android")).using(project(":packages:react-native:ReactAndroid:hermes-engine"))
// substitute(module("com.facebook.react:hermes-engine")).using(project(":packages:react-native:ReactAndroid:hermes-engine"))
// }
// }
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,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 7df5fd5

Please sign in to comment.