forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact-native+0.76.3+031+disable-suggestion-pop-up.patch
More file actions
325 lines (294 loc) · 15.4 KB
/
react-native+0.76.3+031+disable-suggestion-pop-up.patch
File metadata and controls
325 lines (294 loc) · 15.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
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<NSAttributedStringKey, id> *_defaultTextAttributes;
+ NSArray<UIBarButtonItemGroup *> *_initialValueLeadingBarButtonGroups;
+ NSArray<UIBarButtonItemGroup *> *_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<UIBarButtonItemGroup *> *_initialValueLeadingBarButtonGroups;
+ NSArray<UIBarButtonItemGroup *> *_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<NSAttributedStringKey, id> *_defaultTextAttributes;
+ NSArray<UIBarButtonItemGroup *> *_initialValueLeadingBarButtonGroups;
+ NSArray<UIBarButtonItemGroup *> *_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<NSAttributedStringKey, id> *)_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