mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add patch for `RCTBaseTextInput` fixing `selectTextOnFocus` prop (#4533)

* create patch

* remove js fix in `SearchScreen`

authored by hailey.at and committed by

GitHub 89be5a44 10c6035f

+44 -17
+36 -10
patches/react-native+0.74.1.patch
··· 1 + diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm 2 + index b0d71dc..9974932 100644 3 + --- a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm 4 + +++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm 5 + @@ -377,10 +377,6 @@ - (void)textInputDidBeginEditing 6 + self.backedTextInputView.attributedText = [NSAttributedString new]; 7 + } 8 + 9 + - if (_selectTextOnFocus) { 10 + - [self.backedTextInputView selectAll:nil]; 11 + - } 12 + - 13 + [_eventDispatcher sendTextEventWithType:RCTTextEventTypeFocus 14 + reactTag:self.reactTag 15 + text:[self.backedTextInputView.attributedText.string copy] 16 + @@ -611,6 +607,10 @@ - (UIView *)reactAccessibilityElement 17 + - (void)reactFocus 18 + { 19 + [self.backedTextInputView reactFocus]; 20 + + 21 + + if (_selectTextOnFocus) { 22 + + [self.backedTextInputView selectAll:nil]; 23 + + } 24 + } 25 + 26 + - (void)reactBlur 1 27 diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h 2 28 index e9b330f..1ecdf0a 100644 3 29 --- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h ··· 5 31 @@ -16,4 +16,6 @@ 6 32 @property (nonatomic, copy) RCTDirectEventBlock onRefresh; 7 33 @property (nonatomic, weak) UIScrollView *scrollView; 8 - 34 + 9 35 +- (void)forwarderBeginRefreshing; 10 36 + 11 37 @end ··· 16 42 @@ -198,9 +198,53 @@ - (void)refreshControlValueChanged 17 43 [self setCurrentRefreshingState:super.refreshing]; 18 44 _refreshingProgrammatically = NO; 19 - 45 + 20 46 + if (@available(iOS 17.4, *)) { 21 47 + if (_currentRefreshingState) { 22 48 + UIImpactFeedbackGenerator *feedbackGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight]; ··· 29 55 _onRefresh(nil); 30 56 } 31 57 } 32 - 58 + 33 59 +/* 34 60 + This method is used by Bluesky's ExpoScrollForwarder. This allows other React Native 35 61 + libraries to perform a refresh of a scrollview and access the refresh control's onRefresh ··· 38 64 +- (void)forwarderBeginRefreshing 39 65 +{ 40 66 + _refreshingProgrammatically = NO; 41 - + 67 + + 42 68 + [self sizeToFit]; 43 - + 69 + + 44 70 + if (!self.scrollView) { 45 71 + return; 46 72 + } 47 - + 73 + + 48 74 + UIScrollView *scrollView = (UIScrollView *)self.scrollView; 49 - + 75 + + 50 76 + [UIView animateWithDuration:0.3 51 77 + delay:0 52 78 + options:UIViewAnimationOptionBeginFromCurrentState ··· 58 84 + completion:^(__unused BOOL finished) { 59 85 + [super beginRefreshing]; 60 86 + [self setCurrentRefreshingState:super.refreshing]; 61 - + 87 + + 62 88 + if (self->_onRefresh) { 63 89 + self->_onRefresh(nil); 64 90 + } ··· 73 99 +++ b/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java 74 100 @@ -99,8 +99,9 @@ public class JavaTimerManager { 75 101 } 76 - 102 + 77 103 // If the JS thread is busy for multiple frames we cancel any other pending runnable. 78 104 - if (mCurrentIdleCallbackRunnable != null) { 79 105 - mCurrentIdleCallbackRunnable.cancel(); ··· 81 107 + if (currentRunnable != null) { 82 108 + currentRunnable.cancel(); 83 109 } 84 - 110 + 85 111 mCurrentIdleCallbackRunnable = new IdleCallbackRunnable(frameTimeNanos);
+7
patches/react-native+0.74.1.patch.md
··· 11 11 Patching `RCTRefreshControl.m` and `RCTRefreshControl.h` to add a new `forwarderBeginRefreshing` method to the class. 12 12 This method is used by `ExpoScrollForwarder` to initiate a refresh of the underlying `UIScrollView` from inside that 13 13 module. 14 + 15 + 16 + ## TextInput Patch - `selectTextOnFocus` fix 17 + 18 + Patching `RCTBaseTextInputView.m` to fix an issue where `selectTextOnFocus` does not work as expected on iOS 17. This 19 + patch _only_ fixes the Paper version of `TextInput`. If we migrate to Fabric and the fix has not been made upstream, 20 + we can apply the same fix. See https://github.com/facebook/react-native/pull/44307.
+1 -7
src/view/screens/Search/Search.tsx
··· 30 30 import {NavigationProp} from '#/lib/routes/types' 31 31 import {augmentSearchQuery} from '#/lib/strings/helpers' 32 32 import {logger} from '#/logger' 33 - import {isIOS, isNative, isWeb} from '#/platform/detection' 33 + import {isNative, isWeb} from '#/platform/detection' 34 34 import {listenSoftReset} from '#/state/events' 35 35 import {useModerationOpts} from '#/state/preferences/moderation-opts' 36 36 import {useActorAutocompleteQuery} from '#/state/queries/actor-autocomplete' ··· 802 802 }) 803 803 } else { 804 804 setShowAutocomplete(true) 805 - if (isIOS) { 806 - // We rely on selectTextOnFocus, but it's broken on iOS: 807 - // https://github.com/facebook/react-native/issues/41988 808 - textInput.current?.setSelection(0, searchText.length) 809 - // We still rely on selectTextOnFocus for it to be instant on Android. 810 - } 811 805 } 812 806 }} 813 807 onChangeText={onChangeText}