You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: set text position should not reset component text (#49450)
Summary:
fix: #49368
description is provided inside the ticket.
When we use TextInput on ios and manage selection with the selection prop, TextInput is reset when we change selection.
## Changelog:
[IOS] [FIXED] - Fix selection makes TextInput clear its content when using children
Pull Request resolved: #49450
Test Plan:
Tested with sample provided in ticket.
I also test it with my app on both android and ios, but I cannot share video
Reviewed By: sammy-SC
Differential Revision: D69984616
Pulled By: cipolleschi
fbshipit-source-id: a17169608f9df0ea1cb579e6038345f8e48bbc27
Copy file name to clipboardexpand all lines: packages/react-native/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap
+112-8
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
-
exports[`TextInput tests (useRefsForTextInputState = false should render as expected: should deep render when mocked (please verify output manually) 1`] =`
3
+
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = false should render as expected: should deep render when mocked (please verify output manually) 1`] =`
4
4
<RCTSinglelineTextInputView
5
5
accessible={true}
6
6
allowFontScaling={true}
@@ -23,12 +23,11 @@ exports[`TextInput tests (useRefsForTextInputState = false should render as expe
23
23
rejectResponderTermination={true}
24
24
selection={null}
25
25
submitBehavior="blurAndSubmit"
26
-
text=""
27
26
underlineColorAndroid="transparent"
28
27
/>
29
28
`;
30
29
31
-
exports[`TextInput tests (useRefsForTextInputState = false should render as expected: should deep render when not mocked (please verify output manually) 1`] =`
30
+
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = false should render as expected: should deep render when not mocked (please verify output manually) 1`] =`
32
31
<RCTSinglelineTextInputView
33
32
accessible={true}
34
33
allowFontScaling={true}
@@ -51,12 +50,11 @@ exports[`TextInput tests (useRefsForTextInputState = false should render as expe
51
50
rejectResponderTermination={true}
52
51
selection={null}
53
52
submitBehavior="blurAndSubmit"
54
-
text=""
55
53
underlineColorAndroid="transparent"
56
54
/>
57
55
`;
58
56
59
-
exports[`TextInput tests (useRefsForTextInputState = true should render as expected: should deep render when mocked (please verify output manually) 1`] =`
57
+
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = true should render as expected: should deep render when mocked (please verify output manually) 1`] =`
60
58
<RCTSinglelineTextInputView
61
59
accessible={true}
62
60
allowFontScaling={true}
@@ -79,12 +77,119 @@ exports[`TextInput tests (useRefsForTextInputState = true should render as expec
79
77
rejectResponderTermination={true}
80
78
selection={null}
81
79
submitBehavior="blurAndSubmit"
82
-
text=""
83
80
underlineColorAndroid="transparent"
84
81
/>
85
82
`;
86
83
87
-
exports[`TextInput tests (useRefsForTextInputState = true should render as expected: should deep render when not mocked (please verify output manually) 1`] =`
84
+
exports[`TextInput tests (useRefsForTextInputState = false) useTextChildren = true should render as expected: should deep render when not mocked (please verify output manually) 1`] =`
85
+
<RCTSinglelineTextInputView
86
+
accessible={true}
87
+
allowFontScaling={true}
88
+
focusable={true}
89
+
forwardedRef={null}
90
+
mostRecentEventCount={0}
91
+
onBlur={[Function]}
92
+
onChange={[Function]}
93
+
onClick={[Function]}
94
+
onFocus={[Function]}
95
+
onResponderGrant={[Function]}
96
+
onResponderMove={[Function]}
97
+
onResponderRelease={[Function]}
98
+
onResponderTerminate={[Function]}
99
+
onResponderTerminationRequest={[Function]}
100
+
onScroll={[Function]}
101
+
onSelectionChange={[Function]}
102
+
onSelectionChangeShouldSetResponder={[Function]}
103
+
onStartShouldSetResponder={[Function]}
104
+
rejectResponderTermination={true}
105
+
selection={null}
106
+
submitBehavior="blurAndSubmit"
107
+
underlineColorAndroid="transparent"
108
+
/>
109
+
`;
110
+
111
+
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = false should render as expected: should deep render when mocked (please verify output manually) 1`] =`
112
+
<RCTSinglelineTextInputView
113
+
accessible={true}
114
+
allowFontScaling={true}
115
+
focusable={true}
116
+
forwardedRef={null}
117
+
mostRecentEventCount={0}
118
+
onBlur={[Function]}
119
+
onChange={[Function]}
120
+
onClick={[Function]}
121
+
onFocus={[Function]}
122
+
onResponderGrant={[Function]}
123
+
onResponderMove={[Function]}
124
+
onResponderRelease={[Function]}
125
+
onResponderTerminate={[Function]}
126
+
onResponderTerminationRequest={[Function]}
127
+
onScroll={[Function]}
128
+
onSelectionChange={[Function]}
129
+
onSelectionChangeShouldSetResponder={[Function]}
130
+
onStartShouldSetResponder={[Function]}
131
+
rejectResponderTermination={true}
132
+
selection={null}
133
+
submitBehavior="blurAndSubmit"
134
+
underlineColorAndroid="transparent"
135
+
/>
136
+
`;
137
+
138
+
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = false should render as expected: should deep render when not mocked (please verify output manually) 1`] =`
139
+
<RCTSinglelineTextInputView
140
+
accessible={true}
141
+
allowFontScaling={true}
142
+
focusable={true}
143
+
forwardedRef={null}
144
+
mostRecentEventCount={0}
145
+
onBlur={[Function]}
146
+
onChange={[Function]}
147
+
onClick={[Function]}
148
+
onFocus={[Function]}
149
+
onResponderGrant={[Function]}
150
+
onResponderMove={[Function]}
151
+
onResponderRelease={[Function]}
152
+
onResponderTerminate={[Function]}
153
+
onResponderTerminationRequest={[Function]}
154
+
onScroll={[Function]}
155
+
onSelectionChange={[Function]}
156
+
onSelectionChangeShouldSetResponder={[Function]}
157
+
onStartShouldSetResponder={[Function]}
158
+
rejectResponderTermination={true}
159
+
selection={null}
160
+
submitBehavior="blurAndSubmit"
161
+
underlineColorAndroid="transparent"
162
+
/>
163
+
`;
164
+
165
+
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = true should render as expected: should deep render when mocked (please verify output manually) 1`] =`
166
+
<RCTSinglelineTextInputView
167
+
accessible={true}
168
+
allowFontScaling={true}
169
+
focusable={true}
170
+
forwardedRef={null}
171
+
mostRecentEventCount={0}
172
+
onBlur={[Function]}
173
+
onChange={[Function]}
174
+
onClick={[Function]}
175
+
onFocus={[Function]}
176
+
onResponderGrant={[Function]}
177
+
onResponderMove={[Function]}
178
+
onResponderRelease={[Function]}
179
+
onResponderTerminate={[Function]}
180
+
onResponderTerminationRequest={[Function]}
181
+
onScroll={[Function]}
182
+
onSelectionChange={[Function]}
183
+
onSelectionChangeShouldSetResponder={[Function]}
184
+
onStartShouldSetResponder={[Function]}
185
+
rejectResponderTermination={true}
186
+
selection={null}
187
+
submitBehavior="blurAndSubmit"
188
+
underlineColorAndroid="transparent"
189
+
/>
190
+
`;
191
+
192
+
exports[`TextInput tests (useRefsForTextInputState = true) useTextChildren = true should render as expected: should deep render when not mocked (please verify output manually) 1`] =`
88
193
<RCTSinglelineTextInputView
89
194
accessible={true}
90
195
allowFontScaling={true}
@@ -107,7 +212,6 @@ exports[`TextInput tests (useRefsForTextInputState = true should render as expec
0 commit comments