about summary refs log tree commit diff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/@mattermost+react-native-paste-input+0.6.4.patch16
-rw-r--r--patches/@react-navigation+native+6.1.7.patch56
-rw-r--r--patches/@react-navigation+native+6.1.7.patch.md5
-rw-r--r--patches/expo-image-picker+14.7.1.patch62
-rw-r--r--patches/expo-updates+0.24.7.patch26
-rw-r--r--patches/expo-updates+0.24.7.patch.md7
-rw-r--r--patches/react-native+0.73.2.patch103
-rw-r--r--patches/react-native+0.73.2.patch.md8
8 files changed, 184 insertions, 99 deletions
diff --git a/patches/@mattermost+react-native-paste-input+0.6.4.patch b/patches/@mattermost+react-native-paste-input+0.6.4.patch
index 849cbaa85..08413846f 100644
--- a/patches/@mattermost+react-native-paste-input+0.6.4.patch
+++ b/patches/@mattermost+react-native-paste-input+0.6.4.patch
@@ -3594,3 +3594,19 @@ index 19b61ff..04a9951 100644
  PasteInput_compileSdkVersion=30
  PasteInput_buildToolsVersion=30.0.2
  PasteInput_targetSdkVersion=30
+diff --git a/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m b/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
+index e916023..0564d97 100644
+--- a/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
++++ b/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
+@@ -22,6 +22,11 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
+     _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+     _backedTextInputView.textInputDelegate = self;
+     
++    // Disable inline predictions to prevent jank in the composer
++    if (@available(iOS 17.0, *)) {
++      _backedTextInputView.inlinePredictionType = UITextInlinePredictionTypeNo;
++    }
++
+     [self addSubview:_backedTextInputView];
+   }
+ 
diff --git a/patches/@react-navigation+native+6.1.7.patch b/patches/@react-navigation+native+6.1.7.patch
new file mode 100644
index 000000000..b604e2c1a
--- /dev/null
+++ b/patches/@react-navigation+native+6.1.7.patch
@@ -0,0 +1,56 @@
+diff --git a/node_modules/@react-navigation/native/lib/commonjs/useLinking.js b/node_modules/@react-navigation/native/lib/commonjs/useLinking.js
+index ef4f368..2b0da35 100644
+--- a/node_modules/@react-navigation/native/lib/commonjs/useLinking.js
++++ b/node_modules/@react-navigation/native/lib/commonjs/useLinking.js
+@@ -273,8 +273,12 @@ function useLinking(ref, _ref) {
+           });
+           const currentIndex = history.index;
+           try {
+-            if (nextIndex !== -1 && nextIndex < currentIndex) {
+-              // An existing entry for this path exists and it's less than current index, go back to that
++            if (
++              nextIndex !== -1 &&
++              nextIndex < currentIndex &&
++              // We should only go back if the entry exists and it's less than current index
++              history.get(nextIndex - currentIndex)
++            ) {              // An existing entry for this path exists and it's less than current index, go back to that
+               await history.go(nextIndex - currentIndex);
+             } else {
+               // We couldn't find an existing entry to go back to, so we'll go back by the delta
+diff --git a/node_modules/@react-navigation/native/lib/module/useLinking.js b/node_modules/@react-navigation/native/lib/module/useLinking.js
+index 62a3b43..11a5a28 100644
+--- a/node_modules/@react-navigation/native/lib/module/useLinking.js
++++ b/node_modules/@react-navigation/native/lib/module/useLinking.js
+@@ -264,8 +264,12 @@ export default function useLinking(ref, _ref) {
+           });
+           const currentIndex = history.index;
+           try {
+-            if (nextIndex !== -1 && nextIndex < currentIndex) {
+-              // An existing entry for this path exists and it's less than current index, go back to that
++            if (
++              nextIndex !== -1 &&
++              nextIndex < currentIndex &&
++              // We should only go back if the entry exists and it's less than current index
++              history.get(nextIndex - currentIndex)
++            ) {              // An existing entry for this path exists and it's less than current index, go back to that
+               await history.go(nextIndex - currentIndex);
+             } else {
+               // We couldn't find an existing entry to go back to, so we'll go back by the delta
+diff --git a/node_modules/@react-navigation/native/src/useLinking.tsx b/node_modules/@react-navigation/native/src/useLinking.tsx
+index 3db40b7..9ba4ecd 100644
+--- a/node_modules/@react-navigation/native/src/useLinking.tsx
++++ b/node_modules/@react-navigation/native/src/useLinking.tsx
+@@ -381,7 +381,12 @@ export default function useLinking(
+           const currentIndex = history.index;
+ 
+           try {
+-            if (nextIndex !== -1 && nextIndex < currentIndex) {
++            if (
++              nextIndex !== -1 &&
++              nextIndex < currentIndex &&
++              // We should only go back if the entry exists and it's less than current index
++              history.get(nextIndex - currentIndex)
++            ) {
+               // An existing entry for this path exists and it's less than current index, go back to that
+               await history.go(nextIndex - currentIndex);
+             } else {
diff --git a/patches/@react-navigation+native+6.1.7.patch.md b/patches/@react-navigation+native+6.1.7.patch.md
new file mode 100644
index 000000000..60b0d4e14
--- /dev/null
+++ b/patches/@react-navigation+native+6.1.7.patch.md
@@ -0,0 +1,5 @@
+# React Navigation history bug patch
+
+This patches react-navigation to fix the issues in https://github.com/bluesky-social/social-app/issues/710.
+
+This is based on the PR found at https://github.com/react-navigation/react-navigation/pull/11833
diff --git a/patches/expo-image-picker+14.7.1.patch b/patches/expo-image-picker+14.7.1.patch
index 2d37a182a..046eb4f4f 100644
--- a/patches/expo-image-picker+14.7.1.patch
+++ b/patches/expo-image-picker+14.7.1.patch
@@ -1,8 +1,56 @@
+diff --git a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/ImagePickerModule.kt b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/ImagePickerModule.kt
+index 3f50f8c..ee47fa1 100644
+--- a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/ImagePickerModule.kt
++++ b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/ImagePickerModule.kt
+@@ -33,7 +33,9 @@ import kotlin.coroutines.resumeWithException
+ // TODO(@bbarthec): rename to ExpoImagePicker
+ private const val moduleName = "ExponentImagePicker"
+
++
+ class ImagePickerModule : Module() {
++  private var isPickerOpen = false
+
+   override fun definition() = ModuleDefinition {
+     Name(moduleName)
+@@ -129,6 +131,11 @@ class ImagePickerModule : Module() {
+     options: ImagePickerOptions
+   ): Any {
+     return try {
++      if(isPickerOpen) {
++        return ImagePickerResponse(canceled = true)
++      }
++
++      isPickerOpen = true
+       var result = launchPicker(pickerLauncher)
+       if (
+         !options.allowsMultipleSelection &&
+@@ -143,6 +150,8 @@ class ImagePickerModule : Module() {
+       mediaHandler.readExtras(result.data, options)
+     } catch (cause: OperationCanceledException) {
+       return ImagePickerResponse(canceled = true)
++    } finally {
++      isPickerOpen = false
+     }
+   }
+
 diff --git a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt
-index ff15c91..41aaf12 100644
+index ff15c91..9763012 100644
 --- a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt
 +++ b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/contracts/ImageLibraryContract.kt
-@@ -26,51 +26,26 @@ import java.io.Serializable
+@@ -5,12 +5,7 @@ import android.content.ContentResolver
+ import android.content.Context
+ import android.content.Intent
+ import android.net.Uri
+-import androidx.activity.result.PickVisualMediaRequest
+-import androidx.activity.result.contract.ActivityResultContracts.PickVisualMedia
+-import androidx.activity.result.contract.ActivityResultContracts.PickMultipleVisualMedia
+ import expo.modules.imagepicker.ImagePickerOptions
+-import expo.modules.imagepicker.MediaTypes
+-import expo.modules.imagepicker.UNLIMITED_SELECTION
+ import expo.modules.imagepicker.getAllDataUris
+ import expo.modules.imagepicker.toMediaType
+ import expo.modules.kotlin.activityresult.AppContextActivityResultContract
+@@ -26,51 +21,26 @@ import java.io.Serializable
   * @see [androidx.activity.result.contract.ActivityResultContracts.GetMultipleContents]
   */
  internal class ImageLibraryContract(
@@ -12,7 +60,7 @@ index ff15c91..41aaf12 100644
    private val contentResolver: ContentResolver
      get() = appContextProvider.appContext.reactContext?.contentResolver
        ?: throw Exceptions.ReactContextLost()
- 
+
    override fun createIntent(context: Context, input: ImageLibraryContractOptions): Intent {
 -    val request = PickVisualMediaRequest.Builder()
 -      .setMediaType(
@@ -34,7 +82,7 @@ index ff15c91..41aaf12 100644
 +    val intent = Intent(Intent.ACTION_GET_CONTENT)
 +            .addCategory(Intent.CATEGORY_OPENABLE)
 +            .setType("image/*")
- 
+
      if (input.options.allowsMultipleSelection) {
 -      val selectionLimit = input.options.selectionLimit
 -
@@ -45,7 +93,7 @@ index ff15c91..41aaf12 100644
 +      if(input.options.selectionLimit == 1) {
 +        return intent
        }
- 
+
 -      if (selectionLimit > 1) {
 -        return PickMultipleVisualMedia(selectionLimit).createIntent(context, request)
 -      }
@@ -56,9 +104,9 @@ index ff15c91..41aaf12 100644
 -      }
 +      intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
      }
- 
+
 -    return PickVisualMedia().createIntent(context, request)
 +    return intent
    }
- 
+
    override fun parseResult(input: ImageLibraryContractOptions, resultCode: Int, intent: Intent?) =
diff --git a/patches/expo-updates+0.24.7.patch b/patches/expo-updates+0.24.7.patch
new file mode 100644
index 000000000..603ae32ef
--- /dev/null
+++ b/patches/expo-updates+0.24.7.patch
@@ -0,0 +1,26 @@
+diff --git a/node_modules/expo-updates/ios/EXUpdates/Update/NewUpdate.swift b/node_modules/expo-updates/ios/EXUpdates/Update/NewUpdate.swift
+index 189a5f5..8d5b8e6 100644
+--- a/node_modules/expo-updates/ios/EXUpdates/Update/NewUpdate.swift
++++ b/node_modules/expo-updates/ios/EXUpdates/Update/NewUpdate.swift
+@@ -68,13 +68,20 @@ public final class NewUpdate: Update {
+       processedAssets.append(asset)
+     }
+
++    // 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: UpdateStatus.StatusPending,
diff --git a/patches/expo-updates+0.24.7.patch.md b/patches/expo-updates+0.24.7.patch.md
new file mode 100644
index 000000000..8a8848127
--- /dev/null
+++ b/patches/expo-updates+0.24.7.patch.md
@@ -0,0 +1,7 @@
+# Expo-Updates Patch
+
+This is a small patch to convert timestamp formats that are returned from the backend. Instead of relying on the
+backend to return the correct format for a specific format (the format required on Android is not the same as on iOS)
+we can just add this conversion in.
+
+Don't remove unless we make changes on the backend to support both platforms.
\ No newline at end of file
diff --git a/patches/react-native+0.73.2.patch b/patches/react-native+0.73.2.patch
index 8f100169e..8db23da0c 100644
--- a/patches/react-native+0.73.2.patch
+++ b/patches/react-native+0.73.2.patch
@@ -1,92 +1,19 @@
-diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.mm b/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.mm
-index 9dca6a5..090bda5 100644
---- a/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.mm
-+++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.mm
-@@ -266,11 +266,10 @@ - (void)textViewDidChange:(__unused UITextView *)textView
+diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
+index b09e653..d290dab 100644
+--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
++++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
+@@ -198,6 +198,14 @@ - (void)refreshControlValueChanged
+   [self setCurrentRefreshingState:super.refreshing];
+   _refreshingProgrammatically = NO;
 
- - (void)textViewDidChangeSelection:(__unused UITextView *)textView
- {
--  if (_lastStringStateWasUpdatedWith && ![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
-+  if (![_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
-     [self textViewDidChange:_backedTextInputView];
-     _ignoreNextTextInputCall = YES;
-   }
--  _lastStringStateWasUpdatedWith = _backedTextInputView.attributedText;
-   [self textViewProbablyDidChangeSelection];
- }
-
-diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputShadowView.mm b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputShadowView.mm
-index 1f06b79..ab458f3 100644
---- a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputShadowView.mm
-+++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputShadowView.mm
-@@ -87,7 +87,7 @@ - (void)invalidateContentSize
-     return;
-   }
-
--  CGSize maximumSize = self.layoutMetrics.frame.size;
-+  CGSize maximumSize = self.layoutMetrics.contentFrame.size;
-
-   if (_maximumNumberOfLines == 1) {
-     maximumSize.width = CGFLOAT_MAX;
-@@ -158,6 +158,8 @@ - (void)uiManagerWillPerformMounting
-     [attributedText insertAttributedString:propertyAttributedText atIndex:0];
-   }
-
-+  [self postprocessAttributedText:attributedText];
-+
-   NSAttributedString *newAttributedText;
-   if (![_previousAttributedText isEqualToAttributedString:attributedText]) {
-     // We have to follow `set prop` pattern:
-@@ -191,6 +193,52 @@ - (void)uiManagerWillPerformMounting
-   }];
- }
-
-+- (void)postprocessAttributedText:(NSMutableAttributedString *)attributedText
-+{
-+  __block CGFloat maximumLineHeight = 0;
-+
-+  [attributedText enumerateAttribute:NSParagraphStyleAttributeName
-+                             inRange:NSMakeRange(0, attributedText.length)
-+                             options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired
-+                          usingBlock:^(NSParagraphStyle *paragraphStyle, __unused NSRange range, __unused BOOL *stop) {
-+    if (!paragraphStyle) {
-+      return;
++  if (@available(iOS 17.4, *)) {
++    if (_currentRefreshingState) {
++      UIImpactFeedbackGenerator *feedbackGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight];
++      [feedbackGenerator prepare];
++      [feedbackGenerator impactOccurred];
 +    }
-+
-+    maximumLineHeight = MAX(paragraphStyle.maximumLineHeight, maximumLineHeight);
-+  }];
-+
-+  if (maximumLineHeight == 0) {
-+    // `lineHeight` was not specified, nothing to do.
-+    return;
 +  }
 +
-+  __block CGFloat maximumFontLineHeight = 0;
-+
-+  [attributedText enumerateAttribute:NSFontAttributeName
-+                             inRange:NSMakeRange(0, attributedText.length)
-+                             options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired
-+                          usingBlock:^(UIFont *font, NSRange range, __unused BOOL *stop) {
-+    if (!font) {
-+      return;
-+    }
-+
-+    if (maximumFontLineHeight <= font.lineHeight) {
-+      maximumFontLineHeight = font.lineHeight;
-+    }
-+  }];
-+
-+  if (maximumLineHeight < maximumFontLineHeight) {
-+    return;
-+  }
-+
-+  CGFloat baseLineOffset = maximumLineHeight / 2.0 - maximumFontLineHeight / 2.0;
-+
-+  [attributedText addAttribute:NSBaselineOffsetAttributeName
-+                         value:@(baseLineOffset)
-+                         range:NSMakeRange(0, attributedText.length)];
-+}
-+
- #pragma mark -
-
- - (NSAttributedString *)measurableAttributedText
+   if (_onRefresh) {
+     _onRefresh(nil);
+   }
\ No newline at end of file
diff --git a/patches/react-native+0.73.2.patch.md b/patches/react-native+0.73.2.patch.md
index 3d3275163..7f70baf2f 100644
--- a/patches/react-native+0.73.2.patch.md
+++ b/patches/react-native+0.73.2.patch.md
@@ -1,5 +1,5 @@
-# TextInput Patch
+# RefreshControl Patch
 
-Patching `RCTBaseTextShadowInput.mm` from https://github.com/facebook/react-native/pull/38359. This fixes some text
-getting cut off inside the composer. This was merged in December, so we should be able to remove this patch when RN
-ships the next release.
+Patching `RCTRefreshControl.mm` temporarily to play an impact haptic on refresh when using iOS 17.4 or higher. Since
+17.4, there has been a regression somewhere causing haptics to not play on iOS on refresh. Should monitor for an update
+in the RN repo: https://github.com/facebook/react-native/issues/43388
\ No newline at end of file