-
Notifications
You must be signed in to change notification settings - Fork 20
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
Cursor position #49
Cursor position #49
Conversation
|
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.
The code looks good to me however, can we test this first? Could you build app against this commit/branch of our fork and test it there directly? Not sure how this testing was done before cc @roryabraham
@perunt It looks like this is missing an upstream PR. For every change we make in our React Native fork, it's very important that we have:
Furthermore, we should try to get that upstream PR reviewed and merged before we merge changes in our fork, and only fall back on using our fork when that fails because review from Meta is taking too long. |
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.
Also, new changes need to target the ExpensifyRC1-0.72.0-alpha.0 branch
@mountiny, I can place an example in the |
@roryabraham Alright, I'll work on creating PR to RN. However, I'm not certain how quickly the RN team will respond. If this PR is held up for 2-6 months, would that also delay the implementation of this feature in our project for the same duration? |
No we would most likely not, but we want the issue up so we can drive towards updating this upstream too so we dont have to maintain the diff in our repo forever. |
58f91ab
to
eddebe6
Compare
if (mReactEditText.getLayout() == null) { | ||
mReactEditText.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | ||
@Override | ||
public void onGlobalLayout() { | ||
mReactEditText.getViewTreeObserver().removeOnGlobalLayoutListener(this); | ||
onSelectionChanged(start, end); | ||
} | ||
}); | ||
return; | ||
} |
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.
I observed that in version 0.71.6 of React Native, the mReactEditText variable can be null, so this is a hotfix to address that issue
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.
I think this is looking great now, thanks for updating the base version.
@roryabraham all yours
@roryabraham would you like to review this as well? |
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.
Just a few very minor points. Otherwise LGTM
...ive/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
Outdated
Show resolved
Hide resolved
...ive/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
Outdated
Show resolved
Hide resolved
...ive/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
Outdated
Show resolved
Hide resolved
I think we are good to merge now. |
Upstream PR Link
facebook#36979
Expensify/App#16078
Summary
This PR extends the onSelectionChange method on textInput to return the x and y position of the input caret
Changelog
In addition to the start and end indices of the selected text onSelectionChange returns also positionY and positionX position of the input caret. The new object returned by the method looks like this:
telegram-cloud-document-2-5337254171093513879.mp4
positionX and positionY represent the coordinates inside the text input area, not including padding or margin. If you add a margin, you should add that extra space when using these coords to draw stuff on the text input.
[CATEGORY] [TYPE] - Message
Test Plan
added console.log statements to the onSelectionChange method to print the positionY and positionX values of the input caret. This allows for easy verification of the correct functioning of the new functionality added by this PR.