diff options
Diffstat (limited to 'patches')
-rw-r--r-- | patches/expo-image-picker+14.7.1.patch | 62 | ||||
-rw-r--r-- | patches/react-native+0.73.2.patch | 103 | ||||
-rw-r--r-- | patches/react-native+0.73.2.patch.md | 8 |
3 files changed, 74 insertions, 99 deletions
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/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 |