forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-native+0.73.4+005+TextInputs.patch
61 lines (59 loc) · 3.54 KB
/
react-native+0.73.4+005+TextInputs.patch
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
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 e7b69bf..9f691c9 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
@@ -115,6 +115,10 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
[self _setMultiline:newTextInputProps.traits.multiline];
}
+ if (newTextInputProps.traits.showSoftInputOnFocus != oldTextInputProps.traits.showSoftInputOnFocus) {
+ [self _setShowSoftInputOnFocus:newTextInputProps.traits.showSoftInputOnFocus];
+ }
+
if (newTextInputProps.traits.autocapitalizationType != oldTextInputProps.traits.autocapitalizationType) {
_backedTextInputView.autocapitalizationType =
RCTUITextAutocapitalizationTypeFromAutocapitalizationType(newTextInputProps.traits.autocapitalizationType);
@@ -618,6 +622,25 @@ - (void)_setMultiline:(BOOL)multiline
RCTCopyBackedTextInput(_backedTextInputView, backedTextInputView);
_backedTextInputView = backedTextInputView;
[self addSubview:_backedTextInputView];
+
+ auto const ¤tTextInputProps = *std::static_pointer_cast<TextInputProps const>(_props);
+ [self _setShowSoftInputOnFocus:currentTextInputProps.traits.showSoftInputOnFocus];
+}
+
+- (void)_setShowSoftInputOnFocus:(BOOL)showSoftInputOnFocus
+{
+ if (showSoftInputOnFocus) {
+ // Resets to default keyboard.
+ _backedTextInputView.inputView = nil;
+
+ // Without the call to reloadInputViews, the keyboard will not change until the textInput field (the first // responder) loses and regains focus.
+ if (_backedTextInputView.isFirstResponder) {
+ [_backedTextInputView reloadInputViews];
+ }
+ } else {
+ // Hides keyboard, but keeps blinking cursor.
+ _backedTextInputView.inputView = [UIView new];
+ }
}
- (BOOL)_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldText
diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp
index 0c9cc69..fee423f 100644
--- a/node_modules/react-native/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp
+++ b/node_modules/react-native/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp
@@ -159,15 +159,6 @@ void AndroidTextInputShadowNode::updateStateIfNeeded() {
Size AndroidTextInputShadowNode::measureContent(
const LayoutContext& /*layoutContext*/,
const LayoutConstraints& layoutConstraints) const {
- if (getStateData().cachedAttributedStringId != 0) {
- return textLayoutManager_
- ->measureCachedSpannableById(
- getStateData().cachedAttributedStringId,
- getConcreteProps().paragraphAttributes,
- layoutConstraints)
- .size;
- }
-
// Layout is called right after measure.
// Measure is marked as `const`, and `layout` is not; so State can be updated
// during layout, but not during `measure`. If State is out-of-date in layout,