Commit be09d12
TextInput -
Summary:
Pull Request resolved: #44398
**Problem:**
`selection` prop is not being set on component creation.
Not quite sure which RN version this issue was introduced but fixing it on latest code.
Use playground for testing (refer to following diff)
**Proposed Solution:**
Added notes in comments but `viewCommands.setTextAndSelection()` is called only on text or selection update which relies on comparing data with `lastNativeSelection`. Problem is that `lastNativeSelection` is initially set to the props value that is passed in so does not send the command on component creation.
So assign a default selection value of `{start: -1, end: -1}` so it can be set on component creation.
**Changelog:**
[General][Fixed] - `selection` prop in `TextInput` was not being applied at component creation
Reviewed By: cipolleschi
Differential Revision: D56911712
fbshipit-source-id: 7774b246383f85216536040688b0a8ea85b3478aselection prop is not set on component creation (#44398)1 parent 9b77506 commit be09d12
File tree
1 file changed
+5
-3
lines changed- packages/react-native/Libraries/Components/TextInput
1 file changed
+5
-3
lines changedLines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1099 | 1099 | | |
1100 | 1100 | | |
1101 | 1101 | | |
1102 | | - | |
1103 | 1102 | | |
1104 | 1103 | | |
1105 | | - | |
| 1104 | + | |
1106 | 1105 | | |
1107 | | - | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1108 | 1110 | | |
1109 | 1111 | | |
1110 | 1112 | | |
| |||
0 commit comments