From 5a680fafd9653a67288f6b21145fe586ed3dc86e Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 8 Jan 2025 13:37:10 +0100 Subject: [PATCH 1/3] add new patch to disable suggestion pop up --- ...0.76.3+031+disable-suggestion-pop-up.patch | 325 ++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 patches/react-native+0.76.3+031+disable-suggestion-pop-up.patch diff --git a/patches/react-native+0.76.3+031+disable-suggestion-pop-up.patch b/patches/react-native+0.76.3+031+disable-suggestion-pop-up.patch new file mode 100644 index 000000000000..790c283edc8b --- /dev/null +++ b/patches/react-native+0.76.3+031+disable-suggestion-pop-up.patch @@ -0,0 +1,325 @@ +diff --git a/node_modules/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js b/node_modules/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js +index 0973ae8..d5e6cee 100644 +--- a/node_modules/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js ++++ b/node_modules/react-native/Libraries/Components/TextInput/RCTTextInputViewConfig.js +@@ -169,6 +169,7 @@ const RCTTextInputViewConfig = { + onChangeSync: true, + onKeyPressSync: true, + }), ++ disableKeyboardShortcuts: true, + }, + }; + +diff --git a/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts b/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts +index 47cdcfc..22c42ae 100644 +--- a/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts ++++ b/node_modules/react-native/Libraries/Components/TextInput/TextInput.d.ts +@@ -136,6 +136,11 @@ export interface DocumentSelectionState extends EventEmitter { + * @see https://reactnative.dev/docs/textinput#props + */ + export interface TextInputIOSProps { ++ /** ++ * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. ++ */ ++ disableKeyboardShortcuts?: boolean | undefined; ++ + /** + * enum('never', 'while-editing', 'unless-editing', 'always') + * When the clear button should appear on the right side of the text view +diff --git a/node_modules/react-native/Libraries/Components/TextInput/TextInput.flow.js b/node_modules/react-native/Libraries/Components/TextInput/TextInput.flow.js +index 2f35731..a1455e7 100644 +--- a/node_modules/react-native/Libraries/Components/TextInput/TextInput.flow.js ++++ b/node_modules/react-native/Libraries/Components/TextInput/TextInput.flow.js +@@ -224,6 +224,12 @@ export type enterKeyHintType = + type PasswordRules = string; + + type IOSProps = $ReadOnly<{| ++ /** ++ * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. ++ * @platform ios ++ */ ++ disableKeyboardShortcuts?: ?boolean, ++ + /** + * When the clear button should appear on the right side of the text view. + * This property is supported only for single-line TextInput component. +diff --git a/node_modules/react-native/Libraries/Components/TextInput/TextInput.js b/node_modules/react-native/Libraries/Components/TextInput/TextInput.js +index 2ffb38b..40e732f 100644 +--- a/node_modules/react-native/Libraries/Components/TextInput/TextInput.js ++++ b/node_modules/react-native/Libraries/Components/TextInput/TextInput.js +@@ -267,6 +267,12 @@ export type enterKeyHintType = + type PasswordRules = string; + + type IOSProps = $ReadOnly<{| ++ /** ++ * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. ++ * @platform ios ++ */ ++ disableKeyboardShortcuts?: ?boolean, ++ + /** + * When the clear button should appear on the right side of the text view. + * This property is supported only for single-line TextInput component. +diff --git a/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.h b/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.h +index 205f994..3b528d2 100644 +--- a/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.h ++++ b/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.h +@@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN + + @property (nonatomic, strong, nullable) NSString *inputAccessoryViewID; + ++@property (nonatomic, assign) BOOL disableKeyboardShortcuts; ++ + @end + + NS_ASSUME_NONNULL_END +diff --git a/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm b/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +index 065a819..b521dd9 100644 +--- a/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm ++++ b/node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +@@ -22,6 +22,8 @@ @implementation RCTUITextView { + UITextView *_detachedTextView; + RCTBackedTextViewDelegateAdapter *_textInputDelegateAdapter; + NSDictionary *_defaultTextAttributes; ++ NSArray *_initialValueLeadingBarButtonGroups; ++ NSArray *_initialValueTrailingBarButtonGroups; + } + + static UIFont *defaultPlaceholderFont(void) +@@ -56,6 +58,8 @@ - (instancetype)initWithFrame:(CGRect)frame + self.textContainer.lineFragmentPadding = 0; + self.scrollsToTop = NO; + self.scrollEnabled = YES; ++ _initialValueLeadingBarButtonGroups = nil; ++ _initialValueTrailingBarButtonGroups = nil; + } + + return self; +@@ -136,6 +140,25 @@ - (void)textDidChange + [self _invalidatePlaceholderVisibility]; + } + ++- (void)setDisableKeyboardShortcuts:(BOOL)disableKeyboardShortcuts ++{ ++ // Initialize the initial values only once ++ if (_initialValueLeadingBarButtonGroups == nil) { ++ // Capture initial values of leading and trailing button groups ++ _initialValueLeadingBarButtonGroups = self.inputAssistantItem.leadingBarButtonGroups; ++ _initialValueTrailingBarButtonGroups = self.inputAssistantItem.trailingBarButtonGroups; ++ } ++ ++ if (disableKeyboardShortcuts) { ++ self.inputAssistantItem.leadingBarButtonGroups = @[]; ++ self.inputAssistantItem.trailingBarButtonGroups = @[]; ++ } else { ++ // Restore the initial values ++ self.inputAssistantItem.leadingBarButtonGroups = _initialValueLeadingBarButtonGroups; ++ self.inputAssistantItem.trailingBarButtonGroups = _initialValueTrailingBarButtonGroups; ++ } ++} ++ + #pragma mark - Overrides + + - (void)setFont:(UIFont *)font +diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h b/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +index cc51013..26a112f 100644 +--- a/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h ++++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +@@ -51,6 +51,8 @@ NS_ASSUME_NONNULL_BEGIN + // Use `attributedText.string` instead. + @property (nonatomic, copy, nullable) NSString *text NS_UNAVAILABLE; + ++@property (nonatomic, assign) BOOL disableKeyboardShortcuts; ++ + @end + + NS_ASSUME_NONNULL_END +diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm +index 6047486..5d1e97b 100644 +--- a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm ++++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm +@@ -30,6 +30,8 @@ @implementation RCTBaseTextInputView { + BOOL _hasInputAccessoryView; + NSString *_Nullable _predictedText; + BOOL _didMoveToWindow; ++ NSArray *_initialValueLeadingBarButtonGroups; ++ NSArray *_initialValueTrailingBarButtonGroups; + } + + - (void)reactUpdateResponderOffsetForScrollView:(RCTScrollView *)scrollView +@@ -64,6 +66,8 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge + _bridge = bridge; + _eventDispatcher = bridge.eventDispatcher; + [self initializeReturnKeyType]; ++ _initialValueLeadingBarButtonGroups = nil; ++ _initialValueTrailingBarButtonGroups = nil; + } + + return self; +@@ -374,6 +378,25 @@ - (void)setShowSoftInputOnFocus:(BOOL)showSoftInputOnFocus + } + } + ++- (void)setDisableKeyboardShortcuts:(BOOL)disableKeyboardShortcuts ++{ ++ // Initialize the initial values only once ++ if (_initialValueLeadingBarButtonGroups == nil) { ++ // Capture initial values of leading and trailing button groups ++ _initialValueLeadingBarButtonGroups = self.backedTextInputView.inputAssistantItem.leadingBarButtonGroups; ++ _initialValueTrailingBarButtonGroups = self.backedTextInputView.inputAssistantItem.trailingBarButtonGroups; ++ } ++ ++ if (disableKeyboardShortcuts) { ++ self.backedTextInputView.inputAssistantItem.leadingBarButtonGroups = @[]; ++ self.backedTextInputView.inputAssistantItem.trailingBarButtonGroups = @[]; ++ } else { ++ // Restore the initial values ++ self.backedTextInputView.inputAssistantItem.leadingBarButtonGroups = _initialValueLeadingBarButtonGroups; ++ self.backedTextInputView.inputAssistantItem.trailingBarButtonGroups = _initialValueTrailingBarButtonGroups; ++ } ++} ++ + #pragma mark - RCTBackedTextInputDelegate + + - (BOOL)textInputShouldBeginEditing +diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm +index e367394..08ec761 100644 +--- a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm ++++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm +@@ -70,6 +70,8 @@ @implementation RCTBaseTextInputViewManager { + + RCT_EXPORT_VIEW_PROPERTY(mostRecentEventCount, NSInteger) + ++RCT_EXPORT_VIEW_PROPERTY(disableKeyboardShortcuts, BOOL) ++ + RCT_EXPORT_SHADOW_PROPERTY(text, NSString) + RCT_EXPORT_SHADOW_PROPERTY(placeholder, NSString) + RCT_EXPORT_SHADOW_PROPERTY(onContentSizeChange, RCTDirectEventBlock) +diff --git a/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.h b/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.h +index 91f8eb0..fbf9f32 100644 +--- a/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.h ++++ b/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.h +@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN + @property (nonatomic, assign, readonly) CGFloat zoomScale; + @property (nonatomic, assign, readonly) CGPoint contentOffset; + @property (nonatomic, assign, readonly) UIEdgeInsets contentInset; ++@property (nonatomic, assign) BOOL disableKeyboardShortcuts; + + @end + +diff --git a/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm b/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +index 667e646..617f05f 100644 +--- a/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm ++++ b/node_modules/react-native/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +@@ -19,6 +19,8 @@ + @implementation RCTUITextField { + RCTBackedTextFieldDelegateAdapter *_textInputDelegateAdapter; + NSDictionary *_defaultTextAttributes; ++ NSArray *_initialValueLeadingBarButtonGroups; ++ NSArray *_initialValueTrailingBarButtonGroups; + } + + - (instancetype)initWithFrame:(CGRect)frame +@@ -31,6 +33,8 @@ - (instancetype)initWithFrame:(CGRect)frame + + _textInputDelegateAdapter = [[RCTBackedTextFieldDelegateAdapter alloc] initWithTextField:self]; + _scrollEnabled = YES; ++ _initialValueLeadingBarButtonGroups = nil; ++ _initialValueTrailingBarButtonGroups = nil; + } + + return self; +@@ -119,6 +123,25 @@ - (void)setSecureTextEntry:(BOOL)secureTextEntry + self.attributedText = originalText; + } + ++- (void)setDisableKeyboardShortcuts:(BOOL)disableKeyboardShortcuts ++{ ++ // Initialize the initial values only once ++ if (_initialValueLeadingBarButtonGroups == nil) { ++ // Capture initial values of leading and trailing button groups ++ _initialValueLeadingBarButtonGroups = self.inputAssistantItem.leadingBarButtonGroups; ++ _initialValueTrailingBarButtonGroups = self.inputAssistantItem.trailingBarButtonGroups; ++ } ++ ++ if (disableKeyboardShortcuts) { ++ self.inputAssistantItem.leadingBarButtonGroups = @[]; ++ self.inputAssistantItem.trailingBarButtonGroups = @[]; ++ } else { ++ // Restore the initial values ++ self.inputAssistantItem.leadingBarButtonGroups = _initialValueLeadingBarButtonGroups; ++ self.inputAssistantItem.trailingBarButtonGroups = _initialValueTrailingBarButtonGroups; ++ } ++} ++ + #pragma mark - Placeholder + + - (NSDictionary *)_placeholderTextAttributes +diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +index 2e7b1a1..abd91ef 100644 +--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm ++++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +@@ -278,6 +278,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & + if (newTextInputProps.inputAccessoryViewID != oldTextInputProps.inputAccessoryViewID) { + _backedTextInputView.inputAccessoryViewID = RCTNSStringFromString(newTextInputProps.inputAccessoryViewID); + } ++ ++ if (newTextInputProps.disableKeyboardShortcuts != oldTextInputProps.disableKeyboardShortcuts) { ++ _backedTextInputView.disableKeyboardShortcuts = newTextInputProps.disableKeyboardShortcuts; ++ } ++ + [super updateProps:props oldProps:oldProps]; + + [self setDefaultInputAccessoryView]; +diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +index 6345758..92c56b4 100644 +--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm ++++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +@@ -45,6 +45,7 @@ void RCTCopyBackedTextInput( + toTextInput.textContentType = fromTextInput.textContentType; + toTextInput.smartInsertDeleteType = fromTextInput.smartInsertDeleteType; + toTextInput.passwordRules = fromTextInput.passwordRules; ++ toTextInput.disableKeyboardShortcuts = fromTextInput.disableKeyboardShortcuts; + + [toTextInput setSelectedTextRange:fromTextInput.selectedTextRange notifyDelegate:NO]; + } +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp +index ec0f350..56c3b4f 100644 +--- a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.cpp +@@ -102,7 +102,13 @@ BaseTextInputProps::BaseTextInputProps( + rawProps, + "autoCapitalize", + sourceProps.autoCapitalize, +- {})) {} ++ {})), ++ disableKeyboardShortcuts(convertRawProp( ++ context, ++ rawProps, ++ "disableKeyboardShortcuts", ++ sourceProps.disableKeyboardShortcuts, ++ {false})) {} + + void BaseTextInputProps::setProp( + const PropsParserContext& context, +@@ -180,6 +186,7 @@ void BaseTextInputProps::setProp( + RAW_SET_PROP_SWITCH_CASE_BASIC(text); + RAW_SET_PROP_SWITCH_CASE_BASIC(mostRecentEventCount); + RAW_SET_PROP_SWITCH_CASE_BASIC(autoCapitalize); ++ RAW_SET_PROP_SWITCH_CASE_BASIC(disableKeyboardShortcuts); + } + } + +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h +index bff69fe..27782a1 100644 +--- a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/BaseTextInputProps.h +@@ -63,6 +63,8 @@ class BaseTextInputProps : public ViewProps, public BaseTextProps { + bool autoFocus{false}; + + std::string autoCapitalize{}; ++ ++ bool disableKeyboardShortcuts{false}; + }; + + } // namespace facebook::react From ba50dc92e45e25988b8111dc4e87284efd7d6fcf Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 8 Jan 2025 13:50:56 +0100 Subject: [PATCH 2/3] add option to disable keyboard shortcuts in AmountTextInput --- src/components/AmountTextInput.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/AmountTextInput.tsx b/src/components/AmountTextInput.tsx index 12189d22dba0..256d95ba8419 100644 --- a/src/components/AmountTextInput.tsx +++ b/src/components/AmountTextInput.tsx @@ -84,6 +84,7 @@ function AmountTextInput( // Setting both autoCorrect and spellCheck to false will hide the suggestion. autoCorrect={false} spellCheck={false} + disableKeyboardShortcuts // eslint-disable-next-line react/jsx-props-no-spreading {...rest} /> From 4c60c0f11f22a43b6ac3421c7214f7641be40eb4 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Thu, 16 Jan 2025 10:58:51 +0100 Subject: [PATCH 3/3] rename patch --- ...ch => react-native+0.76.3+030+disable-suggestion-pop-up.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename patches/{react-native+0.76.3+031+disable-suggestion-pop-up.patch => react-native+0.76.3+030+disable-suggestion-pop-up.patch} (100%) diff --git a/patches/react-native+0.76.3+031+disable-suggestion-pop-up.patch b/patches/react-native+0.76.3+030+disable-suggestion-pop-up.patch similarity index 100% rename from patches/react-native+0.76.3+031+disable-suggestion-pop-up.patch rename to patches/react-native+0.76.3+030+disable-suggestion-pop-up.patch