-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open sourced the onSelectionChange event
Summary: public Open-sourced the onSelectionChange event for RCTTextView, and also added onSelectionChange support for RCTTextField. Reviewed By: javache Differential Revision: D2647541 fb-gh-sync-id: ab0ab37f5f087e708a199461ffc33231a47d2133
- Loading branch information
1 parent
397791f
commit 5a34a09
Showing
7 changed files
with
91 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5a34a09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicklockwood I've noticed something that may be unexpected with this event. When setting the
value
prop of a controlledTextInput
there are twoselectionChange
events: One with the selection set to the end of the new value, one with the selection set to the current selection. For example, ifvalue = "foobar"
and then settingvalue = "foobars"
, there's these two events:{start: 7, end: 7}
{start: 6, end: 6}
I've noticed this when working on #2668 where I ran into a bug where setting the selection programatically would trigger the event handler even though it should not.