Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nested text onPress not working on last character #30928

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public int reactTagForTouch(float touchX, float touchY) {
for (int i = 0; i < spans.length; i++) {
int spanStart = spannedText.getSpanStart(spans[i]);
int spanEnd = spannedText.getSpanEnd(spans[i]);
if (spanEnd > index && (spanEnd - spanStart) <= targetSpanTextLength) {
if (spanEnd >= index && (spanEnd - spanStart) <= targetSpanTextLength) {
Copy link
Contributor Author

@fabOnReact fabOnReact Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am asking myself why it did work on non-nested Text.
I need to find the reason spanEnd reaches the index value on the last characted when the Text is nested in another Text

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was not experienced on non-nested text as normal Text will not generate Spans. Spans are generated by nested Text react tags

target = spans[i].getReactTag();
targetSpanTextLength = (spanEnd - spanStart);
}
Expand Down