From 872fcd1d20e2e3981eca77190b3eaa380b9aca76 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 7 Apr 2025 20:29:41 -0500 Subject: Update patches (#8151) * Update patches after #8133 * Bump deps * Revert @react-native-picker/picker downgrade * Migrate RN patch --- patches/@sentry+react-native+6.10.0.patch | 13 + patches/@sentry+react-native+6.9.1.patch | 13 - patches/expo-haptics+14.0.0.patch | 13 - patches/expo-haptics+14.0.1.patch | 13 + patches/expo-image-manipulator+13.0.5.patch | 101 -------- patches/expo-image-manipulator+13.0.6.patch | 101 ++++++++ patches/expo-media-library+17.0.3.patch | 19 -- patches/expo-media-library+17.0.6.patch | 19 ++ patches/expo-modules-core+2.1.2.patch | 15 -- patches/expo-modules-core+2.2.3.patch | 15 ++ patches/expo-notifications+0.29.11.patch | 169 ------------- patches/expo-notifications+0.29.14.patch | 169 +++++++++++++ patches/expo-updates+0.26.10.patch | 26 -- patches/expo-updates+0.27.4.patch | 26 ++ patches/react-native+0.76.6.patch | 366 ---------------------------- patches/react-native+0.76.9.patch | 366 ++++++++++++++++++++++++++++ patches/react-native-svg+15.8.0.patch | 57 +++++ patches/react-native-svg+15.9.0.patch | 57 ----- 18 files changed, 779 insertions(+), 779 deletions(-) create mode 100644 patches/@sentry+react-native+6.10.0.patch delete mode 100644 patches/@sentry+react-native+6.9.1.patch delete mode 100644 patches/expo-haptics+14.0.0.patch create mode 100644 patches/expo-haptics+14.0.1.patch delete mode 100644 patches/expo-image-manipulator+13.0.5.patch create mode 100644 patches/expo-image-manipulator+13.0.6.patch delete mode 100644 patches/expo-media-library+17.0.3.patch create mode 100644 patches/expo-media-library+17.0.6.patch delete mode 100644 patches/expo-modules-core+2.1.2.patch create mode 100644 patches/expo-modules-core+2.2.3.patch delete mode 100644 patches/expo-notifications+0.29.11.patch create mode 100644 patches/expo-notifications+0.29.14.patch delete mode 100644 patches/expo-updates+0.26.10.patch create mode 100644 patches/expo-updates+0.27.4.patch delete mode 100644 patches/react-native+0.76.6.patch create mode 100644 patches/react-native+0.76.9.patch create mode 100644 patches/react-native-svg+15.8.0.patch delete mode 100644 patches/react-native-svg+15.9.0.patch (limited to 'patches') diff --git a/patches/@sentry+react-native+6.10.0.patch b/patches/@sentry+react-native+6.10.0.patch new file mode 100644 index 000000000..2291c598c --- /dev/null +++ b/patches/@sentry+react-native+6.10.0.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js b/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js +index c282ade..8777755 100755 +--- a/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js ++++ b/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js +@@ -215,7 +215,7 @@ for (const [assetGroupName, assets] of Object.entries(groupedAssets)) { + + const isHermes = assets.find(asset => asset.endsWith('.hbc')); + const windowsCallback = process.platform === "win32" ? 'node ' : ''; +- execSync(`${windowsCallback}${sentryCliBin} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')}`, { ++ execSync(`${windowsCallback}${sentryCliBin} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')} --dist ${process.env.SENTRY_DIST}`, { + env: { + ...process.env, + [SENTRY_PROJECT]: sentryProject, diff --git a/patches/@sentry+react-native+6.9.1.patch b/patches/@sentry+react-native+6.9.1.patch deleted file mode 100644 index 2291c598c..000000000 --- a/patches/@sentry+react-native+6.9.1.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js b/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js -index c282ade..8777755 100755 ---- a/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js -+++ b/node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps.js -@@ -215,7 +215,7 @@ for (const [assetGroupName, assets] of Object.entries(groupedAssets)) { - - const isHermes = assets.find(asset => asset.endsWith('.hbc')); - const windowsCallback = process.platform === "win32" ? 'node ' : ''; -- execSync(`${windowsCallback}${sentryCliBin} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')}`, { -+ execSync(`${windowsCallback}${sentryCliBin} sourcemaps upload ${isHermes ? '--debug-id-reference' : ''} ${assets.join(' ')} --dist ${process.env.SENTRY_DIST}`, { - env: { - ...process.env, - [SENTRY_PROJECT]: sentryProject, diff --git a/patches/expo-haptics+14.0.0.patch b/patches/expo-haptics+14.0.0.patch deleted file mode 100644 index 9c7b9a666..000000000 --- a/patches/expo-haptics+14.0.0.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt b/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt -index 1520465..6ea988a 100644 ---- a/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt -+++ b/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt -@@ -42,7 +42,7 @@ class HapticsModule : Module() { - - private fun vibrate(type: HapticsVibrationType) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { -- vibrator.vibrate(VibrationEffect.createWaveform(type.timings, type.amplitudes, -1)) -+ vibrator.vibrate(VibrationEffect.createWaveform(type.oldSDKPattern, intArrayOf(0, 100), -1)) - } else { - @Suppress("DEPRECATION") - vibrator.vibrate(type.oldSDKPattern, -1) diff --git a/patches/expo-haptics+14.0.1.patch b/patches/expo-haptics+14.0.1.patch new file mode 100644 index 000000000..9c7b9a666 --- /dev/null +++ b/patches/expo-haptics+14.0.1.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt b/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt +index 1520465..6ea988a 100644 +--- a/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt ++++ b/node_modules/expo-haptics/android/src/main/java/expo/modules/haptics/HapticsModule.kt +@@ -42,7 +42,7 @@ class HapticsModule : Module() { + + private fun vibrate(type: HapticsVibrationType) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { +- vibrator.vibrate(VibrationEffect.createWaveform(type.timings, type.amplitudes, -1)) ++ vibrator.vibrate(VibrationEffect.createWaveform(type.oldSDKPattern, intArrayOf(0, 100), -1)) + } else { + @Suppress("DEPRECATION") + vibrator.vibrate(type.oldSDKPattern, -1) diff --git a/patches/expo-image-manipulator+13.0.5.patch b/patches/expo-image-manipulator+13.0.5.patch deleted file mode 100644 index 02d4d5fb9..000000000 --- a/patches/expo-image-manipulator+13.0.5.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff --git a/node_modules/expo-image-manipulator/src/ImageManipulator.web.ts b/node_modules/expo-image-manipulator/src/ImageManipulator.web.ts -new file mode 100644 -index 0000000..babbb3b ---- /dev/null -+++ b/node_modules/expo-image-manipulator/src/ImageManipulator.web.ts -@@ -0,0 +1,60 @@ -+import { useReleasingSharedObject } from 'expo-modules-core'; -+import { SharedRef } from 'expo-modules-core/types'; -+ -+import { Action, ImageResult, SaveFormat, SaveOptions } from './ImageManipulator.types'; -+import { ImageManipulatorContext } from './ImageManipulatorContext'; -+import ExpoImageManipulator from './NativeImageManipulatorModule'; -+import { validateArguments } from './validators'; -+ -+// @needsAudit -+/** -+ * Manipulate the image provided via `uri`. Available modifications are rotating, flipping (mirroring), -+ * resizing and cropping. Each invocation results in a new file. With one invocation you can provide -+ * a set of actions to perform over the image. Overwriting the source file would not have an effect -+ * in displaying the result as images are cached. -+ * @param uri URI of the file to manipulate. Should be on the local file system or a base64 data URI. -+ * @param actions An array of objects representing manipulation options. Each object should have -+ * __only one__ of the keys that corresponds to specific transformation. -+ * @param saveOptions A map defining how modified image should be saved. -+ * @return Promise which fulfils with [`ImageResult`](#imageresult) object. -+ * @deprecated It has been replaced by the new, contextual and object-oriented API. -+ * Use [`ImageManipulator.manipulate`](#manipulateuri) or [`useImageManipulator`](#useimagemanipulatoruri) instead. -+ */ -+export async function manipulateAsync( -+ uri: string, -+ actions: Action[] = [], -+ saveOptions: SaveOptions = {} -+): Promise { -+ validateArguments(uri, actions, saveOptions); -+ -+ const { format = SaveFormat.JPEG, ...rest } = saveOptions; -+ const context = ExpoImageManipulator.manipulate(uri); -+ -+ for (const action of actions) { -+ if ('resize' in action) { -+ context.resize(action.resize); -+ } else if ('rotate' in action) { -+ context.rotate(action.rotate); -+ } else if ('flip' in action) { -+ context.flip(action.flip); -+ } else if ('crop' in action) { -+ context.crop(action.crop); -+ } else if ('extent' in action && context.extent) { -+ context.extent(action.extent); -+ } -+ } -+ const image = await context.renderAsync(saveOptions.compress); -+ const result = await image.saveAsync({ format, ...rest }); -+ -+ // These shared objects will not be used anymore, so free up some memory. -+ context.release(); -+ image.release(); -+ -+ return result; -+} -+ -+export function useImageManipulator(source: string | SharedRef<'image'>): ImageManipulatorContext { -+ return useReleasingSharedObject(() => ExpoImageManipulator.manipulate(source), [source]); -+} -+ -+export { ExpoImageManipulator as ImageManipulator }; -diff --git a/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts b/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts -index 120d8d3..f8aa49c 100644 ---- a/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts -+++ b/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts -@@ -52,7 +52,7 @@ export declare class ImageManipulatorContext extends SharedObject { - /** - * Awaits for all manipulation tasks to finish and resolves with a reference to the resulted native image. - */ -- renderAsync(): Promise; -+ renderAsync(compress?: number): Promise; - } - - export default ExpoImageManipulator.Context as typeof ImageManipulatorContext; -diff --git a/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts b/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts -index 428848c..363a57a 100644 ---- a/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts -+++ b/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts -@@ -41,7 +41,7 @@ export default class ImageManipulatorContext extends SharedObject { - return this; - } - -- async renderAsync(): Promise { -+ async renderAsync(compress?: number): Promise { - const canvas = await this.currentTask; - - return new Promise((resolve) => { -@@ -49,7 +49,7 @@ export default class ImageManipulatorContext extends SharedObject { - const url = blob ? URL.createObjectURL(blob) : canvas.toDataURL(); - - resolve(new ImageManipulatorImageRef(url, canvas.width, canvas.height)); -- }); -+ }, typeof compress === 'number' ? 'image/jpeg' : undefined, compress); - }); - } - diff --git a/patches/expo-image-manipulator+13.0.6.patch b/patches/expo-image-manipulator+13.0.6.patch new file mode 100644 index 000000000..02d4d5fb9 --- /dev/null +++ b/patches/expo-image-manipulator+13.0.6.patch @@ -0,0 +1,101 @@ +diff --git a/node_modules/expo-image-manipulator/src/ImageManipulator.web.ts b/node_modules/expo-image-manipulator/src/ImageManipulator.web.ts +new file mode 100644 +index 0000000..babbb3b +--- /dev/null ++++ b/node_modules/expo-image-manipulator/src/ImageManipulator.web.ts +@@ -0,0 +1,60 @@ ++import { useReleasingSharedObject } from 'expo-modules-core'; ++import { SharedRef } from 'expo-modules-core/types'; ++ ++import { Action, ImageResult, SaveFormat, SaveOptions } from './ImageManipulator.types'; ++import { ImageManipulatorContext } from './ImageManipulatorContext'; ++import ExpoImageManipulator from './NativeImageManipulatorModule'; ++import { validateArguments } from './validators'; ++ ++// @needsAudit ++/** ++ * Manipulate the image provided via `uri`. Available modifications are rotating, flipping (mirroring), ++ * resizing and cropping. Each invocation results in a new file. With one invocation you can provide ++ * a set of actions to perform over the image. Overwriting the source file would not have an effect ++ * in displaying the result as images are cached. ++ * @param uri URI of the file to manipulate. Should be on the local file system or a base64 data URI. ++ * @param actions An array of objects representing manipulation options. Each object should have ++ * __only one__ of the keys that corresponds to specific transformation. ++ * @param saveOptions A map defining how modified image should be saved. ++ * @return Promise which fulfils with [`ImageResult`](#imageresult) object. ++ * @deprecated It has been replaced by the new, contextual and object-oriented API. ++ * Use [`ImageManipulator.manipulate`](#manipulateuri) or [`useImageManipulator`](#useimagemanipulatoruri) instead. ++ */ ++export async function manipulateAsync( ++ uri: string, ++ actions: Action[] = [], ++ saveOptions: SaveOptions = {} ++): Promise { ++ validateArguments(uri, actions, saveOptions); ++ ++ const { format = SaveFormat.JPEG, ...rest } = saveOptions; ++ const context = ExpoImageManipulator.manipulate(uri); ++ ++ for (const action of actions) { ++ if ('resize' in action) { ++ context.resize(action.resize); ++ } else if ('rotate' in action) { ++ context.rotate(action.rotate); ++ } else if ('flip' in action) { ++ context.flip(action.flip); ++ } else if ('crop' in action) { ++ context.crop(action.crop); ++ } else if ('extent' in action && context.extent) { ++ context.extent(action.extent); ++ } ++ } ++ const image = await context.renderAsync(saveOptions.compress); ++ const result = await image.saveAsync({ format, ...rest }); ++ ++ // These shared objects will not be used anymore, so free up some memory. ++ context.release(); ++ image.release(); ++ ++ return result; ++} ++ ++export function useImageManipulator(source: string | SharedRef<'image'>): ImageManipulatorContext { ++ return useReleasingSharedObject(() => ExpoImageManipulator.manipulate(source), [source]); ++} ++ ++export { ExpoImageManipulator as ImageManipulator }; +diff --git a/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts b/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts +index 120d8d3..f8aa49c 100644 +--- a/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts ++++ b/node_modules/expo-image-manipulator/src/ImageManipulatorContext.ts +@@ -52,7 +52,7 @@ export declare class ImageManipulatorContext extends SharedObject { + /** + * Awaits for all manipulation tasks to finish and resolves with a reference to the resulted native image. + */ +- renderAsync(): Promise; ++ renderAsync(compress?: number): Promise; + } + + export default ExpoImageManipulator.Context as typeof ImageManipulatorContext; +diff --git a/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts b/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts +index 428848c..363a57a 100644 +--- a/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts ++++ b/node_modules/expo-image-manipulator/src/web/ImageManipulatorContext.web.ts +@@ -41,7 +41,7 @@ export default class ImageManipulatorContext extends SharedObject { + return this; + } + +- async renderAsync(): Promise { ++ async renderAsync(compress?: number): Promise { + const canvas = await this.currentTask; + + return new Promise((resolve) => { +@@ -49,7 +49,7 @@ export default class ImageManipulatorContext extends SharedObject { + const url = blob ? URL.createObjectURL(blob) : canvas.toDataURL(); + + resolve(new ImageManipulatorImageRef(url, canvas.width, canvas.height)); +- }); ++ }, typeof compress === 'number' ? 'image/jpeg' : undefined, compress); + }); + } + diff --git a/patches/expo-media-library+17.0.3.patch b/patches/expo-media-library+17.0.3.patch deleted file mode 100644 index c7bb6b000..000000000 --- a/patches/expo-media-library+17.0.3.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt b/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt -index b928b8f..7175cf6 100644 ---- a/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt -+++ b/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt -@@ -99,12 +99,12 @@ class MediaLibraryModule : Module() { - } - - AsyncFunction("createAssetAsync") { localUri: String, promise: Promise -> -- throwUnlessPermissionsGranted { -+ //throwUnlessPermissionsGranted { - withModuleScope(promise) { - CreateAsset(context, localUri, promise) - .execute() - } -- } -+ //} - } - - AsyncFunction("addAssetsToAlbumAsync") { assetsId: List, albumId: String, copyToAlbum: Boolean, promise: Promise -> diff --git a/patches/expo-media-library+17.0.6.patch b/patches/expo-media-library+17.0.6.patch new file mode 100644 index 000000000..7ef57f768 --- /dev/null +++ b/patches/expo-media-library+17.0.6.patch @@ -0,0 +1,19 @@ +diff --git a/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt b/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt +index 64e6efe..e61485e 100644 +--- a/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt ++++ b/node_modules/expo-media-library/android/src/main/java/expo/modules/medialibrary/MediaLibraryModule.kt +@@ -111,12 +111,12 @@ class MediaLibraryModule : Module() { + } + + AsyncFunction("createAssetAsync") { localUri: String, promise: Promise -> +- throwUnlessPermissionsGranted { ++ //throwUnlessPermissionsGranted { + withModuleScope(promise) { + CreateAsset(context, localUri, promise) + .execute() + } +- } ++ //} + } + + AsyncFunction("addAssetsToAlbumAsync") { assetsId: List, albumId: String, copyToAlbum: Boolean, promise: Promise -> diff --git a/patches/expo-modules-core+2.1.2.patch b/patches/expo-modules-core+2.1.2.patch deleted file mode 100644 index f3d9bfd14..000000000 --- a/patches/expo-modules-core+2.1.2.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt -index 47c4d15..afe138d 100644 ---- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt -+++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt -@@ -125,6 +125,10 @@ internal fun peekResponseBody( - } - - internal fun shouldParseBody(response: Response): Boolean { -+ if (response.request.url.encodedPath == "/bitdrift_public.protobuf.client.v1.ApiService/Mux") { -+ return false -+ } -+ - // Check for Content-Type - val skipContentTypes = listOf( - "text/event-stream", // Server Sent Events diff --git a/patches/expo-modules-core+2.2.3.patch b/patches/expo-modules-core+2.2.3.patch new file mode 100644 index 000000000..f3d9bfd14 --- /dev/null +++ b/patches/expo-modules-core+2.2.3.patch @@ -0,0 +1,15 @@ +diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt +index 47c4d15..afe138d 100644 +--- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt ++++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt +@@ -125,6 +125,10 @@ internal fun peekResponseBody( + } + + internal fun shouldParseBody(response: Response): Boolean { ++ if (response.request.url.encodedPath == "/bitdrift_public.protobuf.client.v1.ApiService/Mux") { ++ return false ++ } ++ + // Check for Content-Type + val skipContentTypes = listOf( + "text/event-stream", // Server Sent Events diff --git a/patches/expo-notifications+0.29.11.patch b/patches/expo-notifications+0.29.11.patch deleted file mode 100644 index a781d5f1a..000000000 --- a/patches/expo-notifications+0.29.11.patch +++ /dev/null @@ -1,169 +0,0 @@ -diff --git a/node_modules/expo-notifications/android/build.gradle b/node_modules/expo-notifications/android/build.gradle -index 5dd0c61..bf536dd 100644 ---- a/node_modules/expo-notifications/android/build.gradle -+++ b/node_modules/expo-notifications/android/build.gradle -@@ -46,6 +46,7 @@ dependencies { - implementation 'com.google.firebase:firebase-messaging:24.0.1' - - implementation 'me.leolin:ShortcutBadger:1.1.22@aar' -+ implementation project(':expo-background-notification-handler') - - if (project.findProject(':expo-modules-test-core')) { - testImplementation project(':expo-modules-test-core') -diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt -index 7b99e6c..45a450d 100644 ---- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt -+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt -@@ -15,6 +15,7 @@ import org.json.JSONObject - * This interface exists to provide a common API for both classes. - * */ - interface INotificationContent : Parcelable { -+ val channelId: String? - val title: String? - val text: String? - val subText: String? -diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java -index 191b64e..fe8b3c5 100644 ---- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java -+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java -@@ -35,6 +35,7 @@ import kotlin.coroutines.Continuation; - * Refactoring this class may require a migration strategy for the data stored in SharedPreferences. - */ - public class NotificationContent implements Parcelable, Serializable, INotificationContent { -+ private String mChannelId; - private String mTitle; - private String mText; - private String mSubtitle; -@@ -65,6 +66,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat - } - }; - -+ @Nullable -+ public String getChannelId() { -+ return mChannelId; -+ } -+ - @Nullable - public String getTitle() { - return mTitle; -@@ -158,6 +164,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat - } - - protected NotificationContent(Parcel in) { -+ mChannelId = in.readString(); - mTitle = in.readString(); - mText = in.readString(); - mSubtitle = in.readString(); -@@ -183,6 +190,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat - - @Override - public void writeToParcel(Parcel dest, int flags) { -+ dest.writeString(mChannelId); - dest.writeString(mTitle); - dest.writeString(mText); - dest.writeString(mSubtitle); -@@ -203,6 +211,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat - private static final long serialVersionUID = 397666843266836802L; - - private void writeObject(java.io.ObjectOutputStream out) throws IOException { -+ out.writeObject(mChannelId); - out.writeObject(mTitle); - out.writeObject(mText); - out.writeObject(mSubtitle); -@@ -285,6 +294,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat - useDefaultVibrationPattern(); - } - -+ public Builder setChannelId(String channelId) { -+ content.mChannelId = channelId; -+ return this; -+ } -+ - public Builder setTitle(String title) { - content.mTitle = title; - return this; -diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt -index 39b5aad..e50797d 100644 ---- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt -+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt -@@ -11,6 +11,9 @@ import org.json.JSONObject - * */ - @JvmInline - value class NotificationData(private val data: Map) { -+ val channelId: String? -+ get() = data["channelId"] -+ - val title: String? - get() = data["title"] - -diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt -index d2cc6cf..6a48ff2 100644 ---- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt -+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt -@@ -31,6 +31,8 @@ class RemoteNotificationContent(private val remoteMessage: RemoteMessage) : INot - return remoteMessage.notification?.imageUrl != null - } - -+ override val channelId = remoteMessage.notification?.channelId ?: notificationData.channelId -+ - override val title = remoteMessage.notification?.title ?: notificationData.title - - override val text = remoteMessage.notification?.body ?: notificationData.message -diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt -index 8ca6ec5..57c3599 100644 ---- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt -+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt -@@ -101,6 +101,9 @@ open class ExpoNotificationBuilder( - builder.setOngoing(content.isSticky) - - // see "Notification anatomy" https://developer.android.com/develop/ui/views/notifications#Templates -+ content.channelId?.let { -+ builder.setChannelId(it) -+ } - builder.setContentTitle(content.title) - builder.setContentText(content.text) - builder.setSubText(content.subText) -diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt -index 9f22441..5f92f80 100644 ---- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt -+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt -@@ -2,6 +2,9 @@ package expo.modules.notifications.service.delegates - - import android.content.Context - import com.google.firebase.messaging.RemoteMessage -+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandler -+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandlerInterface -+import expo.modules.backgroundnotificationhandler.ExpoBackgroundNotificationHandlerModule - import expo.modules.interfaces.taskManager.TaskServiceProviderHelper - import expo.modules.notifications.notifications.RemoteMessageSerializer - import expo.modules.notifications.notifications.background.BackgroundRemoteNotificationTaskConsumer -@@ -17,7 +20,8 @@ import expo.modules.notifications.tokens.interfaces.FirebaseTokenListener - import java.lang.ref.WeakReference - import java.util.* - --open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate { -+open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate, -+ BackgroundNotificationHandlerInterface { - companion object { - // Unfortunately we cannot save state between instances of a service other way - // than by static properties. Fortunately, using weak references we can -@@ -94,8 +98,17 @@ open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseM - DebugLogging.logRemoteMessage("FirebaseMessagingDelegate.onMessageReceived: message", remoteMessage) - val notification = createNotification(remoteMessage) - DebugLogging.logNotification("FirebaseMessagingDelegate.onMessageReceived: notification", notification) -- NotificationsService.receive(context, notification) -- runTaskManagerTasks(remoteMessage) -+ -+ if (!ExpoBackgroundNotificationHandlerModule.isForegrounded) { -+ BackgroundNotificationHandler(context, this).handleMessage(remoteMessage) -+ } else { -+ showMessage(remoteMessage) -+ runTaskManagerTasks(remoteMessage) -+ } -+ } -+ -+ override fun showMessage(remoteMessage: RemoteMessage) { -+ NotificationsService.receive(context, createNotification(remoteMessage)) - } - - private fun runTaskManagerTasks(remoteMessage: RemoteMessage) { diff --git a/patches/expo-notifications+0.29.14.patch b/patches/expo-notifications+0.29.14.patch new file mode 100644 index 000000000..dd70cc781 --- /dev/null +++ b/patches/expo-notifications+0.29.14.patch @@ -0,0 +1,169 @@ +diff --git a/node_modules/expo-notifications/android/build.gradle b/node_modules/expo-notifications/android/build.gradle +index 13bffbb..5ebbede 100644 +--- a/node_modules/expo-notifications/android/build.gradle ++++ b/node_modules/expo-notifications/android/build.gradle +@@ -46,6 +46,7 @@ dependencies { + implementation 'com.google.firebase:firebase-messaging:24.0.1' + + implementation 'me.leolin:ShortcutBadger:1.1.22@aar' ++ implementation project(':expo-background-notification-handler') + + if (project.findProject(':expo-modules-test-core')) { + testImplementation project(':expo-modules-test-core') +diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt +index 7b99e6c..45a450d 100644 +--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt ++++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt +@@ -15,6 +15,7 @@ import org.json.JSONObject + * This interface exists to provide a common API for both classes. + * */ + interface INotificationContent : Parcelable { ++ val channelId: String? + val title: String? + val text: String? + val subText: String? +diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java +index 191b64e..fe8b3c5 100644 +--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java ++++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java +@@ -35,6 +35,7 @@ import kotlin.coroutines.Continuation; + * Refactoring this class may require a migration strategy for the data stored in SharedPreferences. + */ + public class NotificationContent implements Parcelable, Serializable, INotificationContent { ++ private String mChannelId; + private String mTitle; + private String mText; + private String mSubtitle; +@@ -65,6 +66,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat + } + }; + ++ @Nullable ++ public String getChannelId() { ++ return mChannelId; ++ } ++ + @Nullable + public String getTitle() { + return mTitle; +@@ -158,6 +164,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat + } + + protected NotificationContent(Parcel in) { ++ mChannelId = in.readString(); + mTitle = in.readString(); + mText = in.readString(); + mSubtitle = in.readString(); +@@ -183,6 +190,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat + + @Override + public void writeToParcel(Parcel dest, int flags) { ++ dest.writeString(mChannelId); + dest.writeString(mTitle); + dest.writeString(mText); + dest.writeString(mSubtitle); +@@ -203,6 +211,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat + private static final long serialVersionUID = 397666843266836802L; + + private void writeObject(java.io.ObjectOutputStream out) throws IOException { ++ out.writeObject(mChannelId); + out.writeObject(mTitle); + out.writeObject(mText); + out.writeObject(mSubtitle); +@@ -285,6 +294,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat + useDefaultVibrationPattern(); + } + ++ public Builder setChannelId(String channelId) { ++ content.mChannelId = channelId; ++ return this; ++ } ++ + public Builder setTitle(String title) { + content.mTitle = title; + return this; +diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt +index 39b5aad..e50797d 100644 +--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt ++++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt +@@ -11,6 +11,9 @@ import org.json.JSONObject + * */ + @JvmInline + value class NotificationData(private val data: Map) { ++ val channelId: String? ++ get() = data["channelId"] ++ + val title: String? + get() = data["title"] + +diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt +index d2cc6cf..6a48ff2 100644 +--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt ++++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt +@@ -31,6 +31,8 @@ class RemoteNotificationContent(private val remoteMessage: RemoteMessage) : INot + return remoteMessage.notification?.imageUrl != null + } + ++ override val channelId = remoteMessage.notification?.channelId ?: notificationData.channelId ++ + override val title = remoteMessage.notification?.title ?: notificationData.title + + override val text = remoteMessage.notification?.body ?: notificationData.message +diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt +index 8ca6ec5..57c3599 100644 +--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt ++++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt +@@ -101,6 +101,9 @@ open class ExpoNotificationBuilder( + builder.setOngoing(content.isSticky) + + // see "Notification anatomy" https://developer.android.com/develop/ui/views/notifications#Templates ++ content.channelId?.let { ++ builder.setChannelId(it) ++ } + builder.setContentTitle(content.title) + builder.setContentText(content.text) + builder.setSubText(content.subText) +diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt +index 9f22441..5f92f80 100644 +--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt ++++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt +@@ -2,6 +2,9 @@ package expo.modules.notifications.service.delegates + + import android.content.Context + import com.google.firebase.messaging.RemoteMessage ++import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandler ++import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandlerInterface ++import expo.modules.backgroundnotificationhandler.ExpoBackgroundNotificationHandlerModule + import expo.modules.interfaces.taskManager.TaskServiceProviderHelper + import expo.modules.notifications.notifications.RemoteMessageSerializer + import expo.modules.notifications.notifications.background.BackgroundRemoteNotificationTaskConsumer +@@ -17,7 +20,8 @@ import expo.modules.notifications.tokens.interfaces.FirebaseTokenListener + import java.lang.ref.WeakReference + import java.util.* + +-open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate { ++open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate, ++ BackgroundNotificationHandlerInterface { + companion object { + // Unfortunately we cannot save state between instances of a service other way + // than by static properties. Fortunately, using weak references we can +@@ -94,8 +98,17 @@ open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseM + DebugLogging.logRemoteMessage("FirebaseMessagingDelegate.onMessageReceived: message", remoteMessage) + val notification = createNotification(remoteMessage) + DebugLogging.logNotification("FirebaseMessagingDelegate.onMessageReceived: notification", notification) +- NotificationsService.receive(context, notification) +- runTaskManagerTasks(remoteMessage) ++ ++ if (!ExpoBackgroundNotificationHandlerModule.isForegrounded) { ++ BackgroundNotificationHandler(context, this).handleMessage(remoteMessage) ++ } else { ++ showMessage(remoteMessage) ++ runTaskManagerTasks(remoteMessage) ++ } ++ } ++ ++ override fun showMessage(remoteMessage: RemoteMessage) { ++ NotificationsService.receive(context, createNotification(remoteMessage)) + } + + private fun runTaskManagerTasks(remoteMessage: RemoteMessage) { diff --git a/patches/expo-updates+0.26.10.patch b/patches/expo-updates+0.26.10.patch deleted file mode 100644 index 6fc4fc5fc..000000000 --- a/patches/expo-updates+0.26.10.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift b/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift -index b85291e..546709d 100644 ---- a/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift -+++ b/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift -@@ -78,13 +78,20 @@ public final class ExpoUpdatesUpdate: Update { - status = UpdateStatus.StatusPending - } - -+ // Instead of relying on various hacks to get the correct format for the specific -+ // platform on the backend, we can just add this little patch.. -+ let dateFormatter = DateFormatter() -+ dateFormatter.locale = Locale(identifier: "en_US_POSIX") -+ dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" -+ let date = dateFormatter.date(from:commitTime) ?? RCTConvert.nsDate(commitTime)! -+ - return Update( - manifest: manifest, - config: config, - database: database, - updateId: uuid, - scopeKey: config.scopeKey, -- commitTime: RCTConvert.nsDate(commitTime), -+ commitTime: date, - runtimeVersion: runtimeVersion, - keep: true, - status: status, diff --git a/patches/expo-updates+0.27.4.patch b/patches/expo-updates+0.27.4.patch new file mode 100644 index 000000000..6fc4fc5fc --- /dev/null +++ b/patches/expo-updates+0.27.4.patch @@ -0,0 +1,26 @@ +diff --git a/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift b/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift +index b85291e..546709d 100644 +--- a/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift ++++ b/node_modules/expo-updates/ios/EXUpdates/Update/ExpoUpdatesUpdate.swift +@@ -78,13 +78,20 @@ public final class ExpoUpdatesUpdate: Update { + status = UpdateStatus.StatusPending + } + ++ // Instead of relying on various hacks to get the correct format for the specific ++ // platform on the backend, we can just add this little patch.. ++ let dateFormatter = DateFormatter() ++ dateFormatter.locale = Locale(identifier: "en_US_POSIX") ++ dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" ++ let date = dateFormatter.date(from:commitTime) ?? RCTConvert.nsDate(commitTime)! ++ + return Update( + manifest: manifest, + config: config, + database: database, + updateId: uuid, + scopeKey: config.scopeKey, +- commitTime: RCTConvert.nsDate(commitTime), ++ commitTime: date, + runtimeVersion: runtimeVersion, + keep: true, + status: status, diff --git a/patches/react-native+0.76.6.patch b/patches/react-native+0.76.6.patch deleted file mode 100644 index 5af24a372..000000000 --- a/patches/react-native+0.76.6.patch +++ /dev/null @@ -1,366 +0,0 @@ -diff --git a/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts b/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts -index 62f52a7..ca30165 100644 ---- a/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts -+++ b/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts -@@ -426,9 +426,10 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { - */ - pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined; - isolation?: 'auto' | 'isolate' | undefined; -- cursor?: CursorValue | undefined; -+ cursor?: CursorValue | string | undefined; - boxShadow?: ReadonlyArray | string | undefined; - filter?: ReadonlyArray | string | undefined; -+ transformOrigin?: string | (string | number)[] | undefined; - } - - export type FontVariant = -@@ -536,7 +537,11 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { - textShadowOffset?: {width: number; height: number} | undefined; - textShadowRadius?: number | undefined; - textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase' | undefined; -- userSelect?: 'auto' | 'none' | 'text' | 'contain' | 'all' | undefined; -+ userSelect?: 'auto' | 'none' | 'text' | 'contain' | 'all' | string | undefined; -+ cursor?: CursorValue | string | undefined; -+ boxShadow?: ReadonlyArray | string | undefined; -+ filter?: ReadonlyArray | string | undefined; -+ transformOrigin?: string | (string | number)[] | undefined; - } - - /** -@@ -558,5 +563,8 @@ export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { - tintColor?: ColorValue | undefined; - opacity?: AnimatableNumericValue | undefined; - objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | undefined; -- cursor?: CursorValue | undefined; -+ cursor?: CursorValue | string | undefined; -+ boxShadow?: ReadonlyArray | string | undefined; -+ filter?: ReadonlyArray | string | undefined; -+ transformOrigin?: string | (string | number)[] | undefined; - } -diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm -index 93af874..106f8ec 100644 ---- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm -+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm -@@ -66,28 +66,51 @@ - (void)preserveContentOffsetWithBlock:(void (^)())block - * ScrollView, we force it to be centered, but when you zoom or the content otherwise - * becomes larger than the ScrollView, there is no padding around the content but it - * can still fill the whole view. -+ * This implementation is based on https://petersteinberger.com/blog/2013/how-to-center-uiscrollview/. - */ --- (void)setContentOffset:(CGPoint)contentOffset -+-(void)centerContentIfNeeded - { -- if (_isSetContentOffsetDisabled) { -+ if (!_centerContent) { - return; - } - -- if (_centerContent && !CGSizeEqualToSize(self.contentSize, CGSizeZero)) { -- CGSize scrollViewSize = self.bounds.size; -- if (self.contentSize.width <= scrollViewSize.width) { -- contentOffset.x = -(scrollViewSize.width - self.contentSize.width) / 2.0; -- } -- if (self.contentSize.height <= scrollViewSize.height) { -- contentOffset.y = -(scrollViewSize.height - self.contentSize.height) / 2.0; -- } -+ CGSize contentSize = self.contentSize; -+ CGSize boundsSize = self.bounds.size; -+ if (CGSizeEqualToSize(contentSize, CGSizeZero) || -+ CGSizeEqualToSize(boundsSize, CGSizeZero)) { -+ return; - } - -+ CGFloat top = 0, left = 0; -+ if (contentSize.width < boundsSize.width) { -+ left = (boundsSize.width - contentSize.width) * 0.5f; -+ } -+ if (contentSize.height < boundsSize.height) { -+ top = (boundsSize.height - contentSize.height) * 0.5f; -+ } -+ self.contentInset = UIEdgeInsetsMake(top, left, top, left); -+} -+ -+- (void)setContentOffset:(CGPoint)contentOffset -+{ -+ if (_isSetContentOffsetDisabled) { -+ return; -+ } - super.contentOffset = CGPointMake( - RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), - RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); - } - -+- (void)setFrame:(CGRect)frame { -+ [super setFrame:frame]; -+ [self centerContentIfNeeded]; -+} -+ -+- (void)didAddSubview:(UIView *)subview { -+ [super didAddSubview:subview]; -+ [self centerContentIfNeeded]; -+} -+ - - (BOOL)touchesShouldCancelInContentView:(UIView *)view - { - if ([_overridingDelegate respondsToSelector:@selector(touchesShouldCancelInContentView:)]) { -@@ -257,6 +280,10 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView - } - } - -+- (void)scrollViewDidZoom:(__unused UIScrollView *)scrollView { -+ [self centerContentIfNeeded]; -+} -+ - #pragma mark - - - - (BOOL)isHorizontal:(UIScrollView *)scrollView -diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h -index e9b330f..ec5f58c 100644 ---- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h -+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h -@@ -15,5 +15,8 @@ - @property (nonatomic, copy) NSString *title; - @property (nonatomic, copy) RCTDirectEventBlock onRefresh; - @property (nonatomic, weak) UIScrollView *scrollView; -+@property (nonatomic, copy) UIColor *customTintColor; -+ -+- (void)forwarderBeginRefreshing; - - @end -diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m -index 53bfd04..ff1b1ed 100644 ---- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m -+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m -@@ -23,6 +23,7 @@ @implementation RCTRefreshControl { - UIColor *_titleColor; - CGFloat _progressViewOffset; - BOOL _hasMovedToWindow; -+ UIColor *_customTintColor; - } - - - (instancetype)init -@@ -58,6 +59,12 @@ - (void)layoutSubviews - _isInitialRender = false; - } - -+- (void)didMoveToSuperview -+{ -+ [super didMoveToSuperview]; -+ [self setTintColor:_customTintColor]; -+} -+ - - (void)didMoveToWindow - { - [super didMoveToWindow]; -@@ -221,4 +228,50 @@ - (void)refreshControlValueChanged - } - } - -+// Fix for https://github.com/facebook/react-native/issues/43388 -+// A bug in iOS 17.4 causes the haptic to not play when refreshing if the tintColor -+// is set before the refresh control gets added to the scrollview. We'll call this -+// function whenever the superview changes. We'll also call it if the value of customTintColor -+// changes. -+- (void)setTintColor:(UIColor *)tintColor -+{ -+ if ([self.superview isKindOfClass:[UIScrollView class]] && self.tintColor != tintColor) { -+ [super setTintColor:tintColor]; -+ } -+} -+ -+// This method is used by Bluesky's ExpoScrollForwarder. This allows other React Native -+// libraries to perform a refresh of a scrollview and access the refresh control's onRefresh -+// function. -+- (void)forwarderBeginRefreshing -+{ -+ _refreshingProgrammatically = NO; -+ -+ [self sizeToFit]; -+ -+ if (!self.scrollView) { -+ return; -+ } -+ -+ UIScrollView *scrollView = (UIScrollView *)self.scrollView; -+ -+ [UIView animateWithDuration:0.3 -+ delay:0 -+ options:UIViewAnimationOptionBeginFromCurrentState -+ animations:^(void) { -+ // Whenever we call this method, the scrollview will always be at a position of -+ // -130 or less. Scrolling back to -65 simulates the default behavior of RCTRefreshControl -+ [scrollView setContentOffset:CGPointMake(0, -65)]; -+ } -+ completion:^(__unused BOOL finished) { -+ [super beginRefreshing]; -+ [self setCurrentRefreshingState:super.refreshing]; -+ -+ if (self->_onRefresh) { -+ self->_onRefresh(nil); -+ } -+ } -+ ]; -+} -+ - @end -diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m -index 40aaf9c..1c60164 100644 ---- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m -+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m -@@ -22,11 +22,12 @@ - (UIView *)view - - RCT_EXPORT_VIEW_PROPERTY(onRefresh, RCTDirectEventBlock) - RCT_EXPORT_VIEW_PROPERTY(refreshing, BOOL) --RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) - RCT_EXPORT_VIEW_PROPERTY(title, NSString) - RCT_EXPORT_VIEW_PROPERTY(titleColor, UIColor) - RCT_EXPORT_VIEW_PROPERTY(progressViewOffset, CGFloat) - -+RCT_REMAP_VIEW_PROPERTY(tintColor, customTintColor, UIColor) -+ - RCT_EXPORT_METHOD(setNativeRefreshing : (nonnull NSNumber *)viewTag toRefreshing : (BOOL)refreshing) - { - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { -diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m -index e9ce48c..84a6fca 100644 ---- a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m -+++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m -@@ -159,26 +159,8 @@ - (BOOL)touchesShouldCancelInContentView:(__unused UIView *)view - return !shouldDisableScrollInteraction; - } - --/* -- * Automatically centers the content such that if the content is smaller than the -- * ScrollView, we force it to be centered, but when you zoom or the content otherwise -- * becomes larger than the ScrollView, there is no padding around the content but it -- * can still fill the whole view. -- */ - - (void)setContentOffset:(CGPoint)contentOffset - { -- UIView *contentView = [self contentView]; -- if (contentView && _centerContent && !CGSizeEqualToSize(contentView.frame.size, CGSizeZero)) { -- CGSize subviewSize = contentView.frame.size; -- CGSize scrollViewSize = self.bounds.size; -- if (subviewSize.width <= scrollViewSize.width) { -- contentOffset.x = -(scrollViewSize.width - subviewSize.width) / 2.0; -- } -- if (subviewSize.height <= scrollViewSize.height) { -- contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0; -- } -- } -- - super.contentOffset = CGPointMake( - RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), - RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); -@@ -427,6 +409,11 @@ - (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews - // Does nothing - } - -+- (void)setFrame:(CGRect)frame { -+ [super setFrame:frame]; -+ [self centerContentIfNeeded]; -+} -+ - - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex - { - [super insertReactSubview:view atIndex:atIndex]; -@@ -443,6 +430,8 @@ - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex - _contentView = view; - RCTApplyTransformationAccordingLayoutDirection(_contentView, self.reactLayoutDirection); - [_scrollView addSubview:view]; -+ -+ [self centerContentIfNeeded]; - } - } - -@@ -652,9 +641,46 @@ -(void)delegateMethod : (UIScrollView *)scrollView \ - } - - RCT_SCROLL_EVENT_HANDLER(scrollViewWillBeginDecelerating, onMomentumScrollBegin) --RCT_SCROLL_EVENT_HANDLER(scrollViewDidZoom, onScroll) - RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop) - -+-(void)scrollViewDidZoom : (UIScrollView *)scrollView -+{ -+ [self centerContentIfNeeded]; -+ -+ RCT_SEND_SCROLL_EVENT(onScroll, nil); -+ RCT_FORWARD_SCROLL_EVENT(scrollViewDidZoom : scrollView); -+} -+ -+/* -+ * Automatically centers the content such that if the content is smaller than the -+ * ScrollView, we force it to be centered, but when you zoom or the content otherwise -+ * becomes larger than the ScrollView, there is no padding around the content but it -+ * can still fill the whole view. -+ * This implementation is based on https://petersteinberger.com/blog/2013/how-to-center-uiscrollview/. -+ */ -+-(void)centerContentIfNeeded -+{ -+ if (!_scrollView.centerContent) { -+ return; -+ } -+ -+ CGSize contentSize = self.contentSize; -+ CGSize boundsSize = self.bounds.size; -+ if (CGSizeEqualToSize(contentSize, CGSizeZero) || -+ CGSizeEqualToSize(boundsSize, CGSizeZero)) { -+ return; -+ } -+ -+ CGFloat top = 0, left = 0; -+ if (contentSize.width < boundsSize.width) { -+ left = (boundsSize.width - contentSize.width) * 0.5f; -+ } -+ if (contentSize.height < boundsSize.height) { -+ top = (boundsSize.height - contentSize.height) * 0.5f; -+ } -+ _scrollView.contentInset = UIEdgeInsetsMake(top, left, top, left); -+} -+ - - (void)addScrollListener:(NSObject *)scrollListener - { - [_scrollListeners addObject:scrollListener]; -@@ -933,6 +959,7 @@ - (void)updateContentSizeIfNeeded - CGSize contentSize = self.contentSize; - if (!CGSizeEqualToSize(_scrollView.contentSize, contentSize)) { - _scrollView.contentSize = contentSize; -+ [self centerContentIfNeeded]; - } - } - -@@ -1055,6 +1082,22 @@ -(type)getter \ - RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL) - RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); - -+- (void)setScrollIndicatorInsets:(UIEdgeInsets)value -+{ -+ [_scrollView setScrollIndicatorInsets:value]; -+} -+ -+- (UIEdgeInsets)scrollIndicatorInsets -+{ -+ UIEdgeInsets verticalScrollIndicatorInsets = [_scrollView verticalScrollIndicatorInsets]; -+ UIEdgeInsets horizontalScrollIndicatorInsets = [_scrollView horizontalScrollIndicatorInsets]; -+ return UIEdgeInsetsMake( -+ verticalScrollIndicatorInsets.top, -+ horizontalScrollIndicatorInsets.left, -+ verticalScrollIndicatorInsets.bottom, -+ horizontalScrollIndicatorInsets.right); -+} -+ - - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts API_AVAILABLE(ios(13.0)) - { - // `automaticallyAdjustsScrollIndicatorInsets` is available since iOS 13. -diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m -index cd1e7eb..c1d0172 100644 ---- a/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m -+++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m -@@ -83,6 +83,7 @@ - (UIView *)view - RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval) - RCT_EXPORT_VIEW_PROPERTY(zoomScale, CGFloat) - RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets) -+RCT_EXPORT_VIEW_PROPERTY(scrollIndicatorInsets, UIEdgeInsets) - RCT_EXPORT_VIEW_PROPERTY(verticalScrollIndicatorInsets, UIEdgeInsets) - RCT_EXPORT_VIEW_PROPERTY(scrollToOverflowEnabled, BOOL) - RCT_EXPORT_VIEW_PROPERTY(snapToInterval, int) diff --git a/patches/react-native+0.76.9.patch b/patches/react-native+0.76.9.patch new file mode 100644 index 000000000..7e96d875c --- /dev/null +++ b/patches/react-native+0.76.9.patch @@ -0,0 +1,366 @@ +diff --git a/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts b/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts +index 62f52a7..ca30165 100644 +--- a/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts ++++ b/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts +@@ -426,9 +426,10 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { + */ + pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined; + isolation?: 'auto' | 'isolate' | undefined; +- cursor?: CursorValue | undefined; ++ cursor?: CursorValue | string | undefined; + boxShadow?: ReadonlyArray | string | undefined; + filter?: ReadonlyArray | string | undefined; ++ transformOrigin?: string | (string | number)[] | undefined; + } + + export type FontVariant = +@@ -536,7 +537,11 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { + textShadowOffset?: {width: number; height: number} | undefined; + textShadowRadius?: number | undefined; + textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase' | undefined; +- userSelect?: 'auto' | 'none' | 'text' | 'contain' | 'all' | undefined; ++ userSelect?: 'auto' | 'none' | 'text' | 'contain' | 'all' | string | undefined; ++ cursor?: CursorValue | string | undefined; ++ boxShadow?: ReadonlyArray | string | undefined; ++ filter?: ReadonlyArray | string | undefined; ++ transformOrigin?: string | (string | number)[] | undefined; + } + + /** +@@ -558,5 +563,8 @@ export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { + tintColor?: ColorValue | undefined; + opacity?: AnimatableNumericValue | undefined; + objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | undefined; +- cursor?: CursorValue | undefined; ++ cursor?: CursorValue | string | undefined; ++ boxShadow?: ReadonlyArray | string | undefined; ++ filter?: ReadonlyArray | string | undefined; ++ transformOrigin?: string | (string | number)[] | undefined; + } +diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +index 93af874..106f8ec 100644 +--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm ++++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +@@ -66,28 +66,51 @@ + * ScrollView, we force it to be centered, but when you zoom or the content otherwise + * becomes larger than the ScrollView, there is no padding around the content but it + * can still fill the whole view. ++ * This implementation is based on https://petersteinberger.com/blog/2013/how-to-center-uiscrollview/. + */ +-- (void)setContentOffset:(CGPoint)contentOffset ++-(void)centerContentIfNeeded + { +- if (_isSetContentOffsetDisabled) { ++ if (!_centerContent) { + return; + } + +- if (_centerContent && !CGSizeEqualToSize(self.contentSize, CGSizeZero)) { +- CGSize scrollViewSize = self.bounds.size; +- if (self.contentSize.width <= scrollViewSize.width) { +- contentOffset.x = -(scrollViewSize.width - self.contentSize.width) / 2.0; +- } +- if (self.contentSize.height <= scrollViewSize.height) { +- contentOffset.y = -(scrollViewSize.height - self.contentSize.height) / 2.0; +- } ++ CGSize contentSize = self.contentSize; ++ CGSize boundsSize = self.bounds.size; ++ if (CGSizeEqualToSize(contentSize, CGSizeZero) || ++ CGSizeEqualToSize(boundsSize, CGSizeZero)) { ++ return; + } + ++ CGFloat top = 0, left = 0; ++ if (contentSize.width < boundsSize.width) { ++ left = (boundsSize.width - contentSize.width) * 0.5f; ++ } ++ if (contentSize.height < boundsSize.height) { ++ top = (boundsSize.height - contentSize.height) * 0.5f; ++ } ++ self.contentInset = UIEdgeInsetsMake(top, left, top, left); ++} ++ ++- (void)setContentOffset:(CGPoint)contentOffset ++{ ++ if (_isSetContentOffsetDisabled) { ++ return; ++ } + super.contentOffset = CGPointMake( + RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), + RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); + } + ++- (void)setFrame:(CGRect)frame { ++ [super setFrame:frame]; ++ [self centerContentIfNeeded]; ++} ++ ++- (void)didAddSubview:(UIView *)subview { ++ [super didAddSubview:subview]; ++ [self centerContentIfNeeded]; ++} ++ + - (BOOL)touchesShouldCancelInContentView:(UIView *)view + { + if ([_overridingDelegate respondsToSelector:@selector(touchesShouldCancelInContentView:)]) { +@@ -257,6 +280,10 @@ + } + } + ++- (void)scrollViewDidZoom:(__unused UIScrollView *)scrollView { ++ [self centerContentIfNeeded]; ++} ++ + #pragma mark - + + - (BOOL)isHorizontal:(UIScrollView *)scrollView +diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h +index e9b330f..ec5f58c 100644 +--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h ++++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h +@@ -15,5 +15,8 @@ + @property (nonatomic, copy) NSString *title; + @property (nonatomic, copy) RCTDirectEventBlock onRefresh; + @property (nonatomic, weak) UIScrollView *scrollView; ++@property (nonatomic, copy) UIColor *customTintColor; ++ ++- (void)forwarderBeginRefreshing; + + @end +diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m +index 53bfd04..ff1b1ed 100644 +--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m ++++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m +@@ -23,6 +23,7 @@ + UIColor *_titleColor; + CGFloat _progressViewOffset; + BOOL _hasMovedToWindow; ++ UIColor *_customTintColor; + } + + - (instancetype)init +@@ -58,6 +59,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) + _isInitialRender = false; + } + ++- (void)didMoveToSuperview ++{ ++ [super didMoveToSuperview]; ++ [self setTintColor:_customTintColor]; ++} ++ + - (void)didMoveToWindow + { + [super didMoveToWindow]; +@@ -221,4 +228,50 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) + } + } + ++// Fix for https://github.com/facebook/react-native/issues/43388 ++// A bug in iOS 17.4 causes the haptic to not play when refreshing if the tintColor ++// is set before the refresh control gets added to the scrollview. We'll call this ++// function whenever the superview changes. We'll also call it if the value of customTintColor ++// changes. ++- (void)setTintColor:(UIColor *)tintColor ++{ ++ if ([self.superview isKindOfClass:[UIScrollView class]] && self.tintColor != tintColor) { ++ [super setTintColor:tintColor]; ++ } ++} ++ ++// This method is used by Bluesky's ExpoScrollForwarder. This allows other React Native ++// libraries to perform a refresh of a scrollview and access the refresh control's onRefresh ++// function. ++- (void)forwarderBeginRefreshing ++{ ++ _refreshingProgrammatically = NO; ++ ++ [self sizeToFit]; ++ ++ if (!self.scrollView) { ++ return; ++ } ++ ++ UIScrollView *scrollView = (UIScrollView *)self.scrollView; ++ ++ [UIView animateWithDuration:0.3 ++ delay:0 ++ options:UIViewAnimationOptionBeginFromCurrentState ++ animations:^(void) { ++ // Whenever we call this method, the scrollview will always be at a position of ++ // -130 or less. Scrolling back to -65 simulates the default behavior of RCTRefreshControl ++ [scrollView setContentOffset:CGPointMake(0, -65)]; ++ } ++ completion:^(__unused BOOL finished) { ++ [super beginRefreshing]; ++ [self setCurrentRefreshingState:super.refreshing]; ++ ++ if (self->_onRefresh) { ++ self->_onRefresh(nil); ++ } ++ } ++ ]; ++} ++ + @end +diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m +index 40aaf9c..1c60164 100644 +--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m ++++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m +@@ -22,11 +22,12 @@ RCT_EXPORT_MODULE() + + RCT_EXPORT_VIEW_PROPERTY(onRefresh, RCTDirectEventBlock) + RCT_EXPORT_VIEW_PROPERTY(refreshing, BOOL) +-RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) + RCT_EXPORT_VIEW_PROPERTY(title, NSString) + RCT_EXPORT_VIEW_PROPERTY(titleColor, UIColor) + RCT_EXPORT_VIEW_PROPERTY(progressViewOffset, CGFloat) + ++RCT_REMAP_VIEW_PROPERTY(tintColor, customTintColor, UIColor) ++ + RCT_EXPORT_METHOD(setNativeRefreshing : (nonnull NSNumber *)viewTag toRefreshing : (BOOL)refreshing) + { + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { +diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m +index 6f41b5c..9b4f77f 100644 +--- a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m ++++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m +@@ -159,26 +159,8 @@ + return !shouldDisableScrollInteraction; + } + +-/* +- * Automatically centers the content such that if the content is smaller than the +- * ScrollView, we force it to be centered, but when you zoom or the content otherwise +- * becomes larger than the ScrollView, there is no padding around the content but it +- * can still fill the whole view. +- */ + - (void)setContentOffset:(CGPoint)contentOffset + { +- UIView *contentView = [self contentView]; +- if (contentView && _centerContent && !CGSizeEqualToSize(contentView.frame.size, CGSizeZero)) { +- CGSize subviewSize = contentView.frame.size; +- CGSize scrollViewSize = self.bounds.size; +- if (subviewSize.width <= scrollViewSize.width) { +- contentOffset.x = -(scrollViewSize.width - subviewSize.width) / 2.0; +- } +- if (subviewSize.height <= scrollViewSize.height) { +- contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0; +- } +- } +- + super.contentOffset = CGPointMake( + RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), + RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); +@@ -433,6 +415,11 @@ static inline void RCTApplyTransformationAccordingLayoutDirection( + // Does nothing + } + ++- (void)setFrame:(CGRect)frame { ++ [super setFrame:frame]; ++ [self centerContentIfNeeded]; ++} ++ + - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex + { + [super insertReactSubview:view atIndex:atIndex]; +@@ -449,6 +436,8 @@ static inline void RCTApplyTransformationAccordingLayoutDirection( + _contentView = view; + RCTApplyTransformationAccordingLayoutDirection(_contentView, self.reactLayoutDirection); + [_scrollView addSubview:view]; ++ ++ [self centerContentIfNeeded]; + } + } + +@@ -658,9 +647,46 @@ static inline void RCTApplyTransformationAccordingLayoutDirection( + } + + RCT_SCROLL_EVENT_HANDLER(scrollViewWillBeginDecelerating, onMomentumScrollBegin) +-RCT_SCROLL_EVENT_HANDLER(scrollViewDidZoom, onScroll) + RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop) + ++-(void)scrollViewDidZoom : (UIScrollView *)scrollView ++{ ++ [self centerContentIfNeeded]; ++ ++ RCT_SEND_SCROLL_EVENT(onScroll, nil); ++ RCT_FORWARD_SCROLL_EVENT(scrollViewDidZoom : scrollView); ++} ++ ++/* ++ * Automatically centers the content such that if the content is smaller than the ++ * ScrollView, we force it to be centered, but when you zoom or the content otherwise ++ * becomes larger than the ScrollView, there is no padding around the content but it ++ * can still fill the whole view. ++ * This implementation is based on https://petersteinberger.com/blog/2013/how-to-center-uiscrollview/. ++ */ ++-(void)centerContentIfNeeded ++{ ++ if (!_scrollView.centerContent) { ++ return; ++ } ++ ++ CGSize contentSize = self.contentSize; ++ CGSize boundsSize = self.bounds.size; ++ if (CGSizeEqualToSize(contentSize, CGSizeZero) || ++ CGSizeEqualToSize(boundsSize, CGSizeZero)) { ++ return; ++ } ++ ++ CGFloat top = 0, left = 0; ++ if (contentSize.width < boundsSize.width) { ++ left = (boundsSize.width - contentSize.width) * 0.5f; ++ } ++ if (contentSize.height < boundsSize.height) { ++ top = (boundsSize.height - contentSize.height) * 0.5f; ++ } ++ _scrollView.contentInset = UIEdgeInsetsMake(top, left, top, left); ++} ++ + - (void)addScrollListener:(NSObject *)scrollListener + { + [_scrollListeners addObject:scrollListener]; +@@ -939,6 +965,7 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop) + CGSize contentSize = self.contentSize; + if (!CGSizeEqualToSize(_scrollView.contentSize, contentSize)) { + _scrollView.contentSize = contentSize; ++ [self centerContentIfNeeded]; + } + } + +@@ -1061,6 +1088,22 @@ RCT_SET_AND_PRESERVE_OFFSET(setShowsHorizontalScrollIndicator, showsHorizontalSc + RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL) + RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); + ++- (void)setScrollIndicatorInsets:(UIEdgeInsets)value ++{ ++ [_scrollView setScrollIndicatorInsets:value]; ++} ++ ++- (UIEdgeInsets)scrollIndicatorInsets ++{ ++ UIEdgeInsets verticalScrollIndicatorInsets = [_scrollView verticalScrollIndicatorInsets]; ++ UIEdgeInsets horizontalScrollIndicatorInsets = [_scrollView horizontalScrollIndicatorInsets]; ++ return UIEdgeInsetsMake( ++ verticalScrollIndicatorInsets.top, ++ horizontalScrollIndicatorInsets.left, ++ verticalScrollIndicatorInsets.bottom, ++ horizontalScrollIndicatorInsets.right); ++} ++ + - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts API_AVAILABLE(ios(13.0)) + { + // `automaticallyAdjustsScrollIndicatorInsets` is available since iOS 13. +diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m +index cd1e7eb..c1d0172 100644 +--- a/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m ++++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m +@@ -83,6 +83,7 @@ RCT_EXPORT_VIEW_PROPERTY(showsVerticalScrollIndicator, BOOL) + RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval) + RCT_EXPORT_VIEW_PROPERTY(zoomScale, CGFloat) + RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets) ++RCT_EXPORT_VIEW_PROPERTY(scrollIndicatorInsets, UIEdgeInsets) + RCT_EXPORT_VIEW_PROPERTY(verticalScrollIndicatorInsets, UIEdgeInsets) + RCT_EXPORT_VIEW_PROPERTY(scrollToOverflowEnabled, BOOL) + RCT_EXPORT_VIEW_PROPERTY(snapToInterval, int) diff --git a/patches/react-native-svg+15.8.0.patch b/patches/react-native-svg+15.8.0.patch new file mode 100644 index 000000000..54540023f --- /dev/null +++ b/patches/react-native-svg+15.8.0.patch @@ -0,0 +1,57 @@ +diff --git a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java +index 06829bd..1b15818 100644 +--- a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java ++++ b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java +@@ -14,17 +14,33 @@ import android.graphics.Paint; + import android.graphics.Path; + import com.facebook.react.bridge.ReactContext; + ++import java.util.ArrayList; ++import java.util.HashMap; ++ ++class ParsedPath { ++ final Path path; ++ final ArrayList elements; ++ ++ ParsedPath(Path path, ArrayList elements) { ++ this.path = path; ++ this.elements = elements; ++ } ++} ++ + @SuppressLint("ViewConstructor") + class PathView extends RenderableView { + private Path mPath; + ++ // This grows forever but for our use case (static icons) it's ok. ++ private static final HashMap sPathCache = new HashMap<>(); ++ + public PathView(ReactContext reactContext) { + super(reactContext); + PathParser.mScale = mScale; + mPath = new Path(); + } + +- public void setD(String d) { ++ void setDByParsing(String d) { + mPath = PathParser.parse(d); + elements = PathParser.elements; + for (PathElement elem : elements) { +@@ -33,6 +49,17 @@ class PathView extends RenderableView { + point.y *= mScale; + } + } ++ } ++ ++ public void setD(String d) { ++ ParsedPath cached = sPathCache.get(d); ++ if (cached != null) { ++ mPath = cached.path; ++ elements = cached.elements; ++ } else { ++ setDByParsing(d); ++ sPathCache.put(d, new ParsedPath(mPath, elements)); ++ } + invalidate(); + } + diff --git a/patches/react-native-svg+15.9.0.patch b/patches/react-native-svg+15.9.0.patch deleted file mode 100644 index 54540023f..000000000 --- a/patches/react-native-svg+15.9.0.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java -index 06829bd..1b15818 100644 ---- a/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java -+++ b/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/PathView.java -@@ -14,17 +14,33 @@ import android.graphics.Paint; - import android.graphics.Path; - import com.facebook.react.bridge.ReactContext; - -+import java.util.ArrayList; -+import java.util.HashMap; -+ -+class ParsedPath { -+ final Path path; -+ final ArrayList elements; -+ -+ ParsedPath(Path path, ArrayList elements) { -+ this.path = path; -+ this.elements = elements; -+ } -+} -+ - @SuppressLint("ViewConstructor") - class PathView extends RenderableView { - private Path mPath; - -+ // This grows forever but for our use case (static icons) it's ok. -+ private static final HashMap sPathCache = new HashMap<>(); -+ - public PathView(ReactContext reactContext) { - super(reactContext); - PathParser.mScale = mScale; - mPath = new Path(); - } - -- public void setD(String d) { -+ void setDByParsing(String d) { - mPath = PathParser.parse(d); - elements = PathParser.elements; - for (PathElement elem : elements) { -@@ -33,6 +49,17 @@ class PathView extends RenderableView { - point.y *= mScale; - } - } -+ } -+ -+ public void setD(String d) { -+ ParsedPath cached = sPathCache.get(d); -+ if (cached != null) { -+ mPath = cached.path; -+ elements = cached.elements; -+ } else { -+ setDByParsing(d); -+ sPathCache.put(d, new ParsedPath(mPath, elements)); -+ } - invalidate(); - } - -- cgit 1.4.1