feat: add setSelection method#311
Conversation
2779fca to
4bd32df
Compare
|
Hey @IslamRustamov thanks for the contribution! I'll have to address a few matters first. |
|
Ah I didn't know that you were using unseen chars in text. As for use case - nothing in particular, just wanted to contribute something and saw this issue #204 that required this exact feature. If you want to develop this feature yourself or don't consider it needed for now - feel free to close this PR, or if you want me to continue working on it then let me know. |
|
I see. Honestly, this PR isn't far from being ready. If you just made sure both platforms treat the selection in the same (Android) way it would be great. You can do it similarly on iOS to how react-native-enriched/ios/EnrichedTextInputView.mm Lines 928 to 938 in c7a7a2a And with the unseen chars on iOS (afaik Android won't have that problem), all that's needed is to check the text in the range to be selected. Then extend the selection by 1 length for each \u200B (zero-width-space character). Make sure the selection won't go outside of the input range ;)
We really appreciate meaningful contributions and I don't want to take it from you by basing a PR on your wok. |
772e83c to
48668e5
Compare
|
@szydlovsky I believe that does it. If I understood correctly how you want zero width spaces handled. Tested on lists and it seemed to work. This is with zero width spaces in mind: Selection params are start === 2 and end === 6. |
szydlovsky
left a comment
There was a problem hiding this comment.
Got quite a bit iOS only cosmetic changes. Also, please pull the latest main afterwards and run lint-clang: fix in the repo root.
48668e5 to
a0f9fd1
Compare
|
@szydlovsky made the changes, check please if everything is to your liking |
|
@IslamRustamov great, will check it out on Monday, stay tuned! |
exploIF
left a comment
There was a problem hiding this comment.
Looks good to me in general. However, there is one missing thing. Similar to iOS part, we should include zero width spaces in selection range calculations on Android
exploIF
left a comment
There was a problem hiding this comment.
Looks good, thank you 🙌



Summary
Explain the motivation for making this change: here are some points to help you:
Test Plan
Screenshots / Videos
Not applicable
Compatibility