RichEditorView
RichEditorView copied to clipboard
relativeCaretYPosition returns 0 on new line
If the cursor is in the middle or at the start of a word, relativeCaretYPosition returns 0 when Return pressed.
As a result, the view does not follow the cursor.
It happens because runJS("RE.getRelativeCaretYPosition();") in this case returns NaN.
To reproduce: Run RichEditorViewSample, select Swift or Objective-C, type any character, move the cursor to the start of the line, press "return" till the cursor disappears below the bottom edge of the view. The view will not scroll.
Expected behaviour:
The view scrolls to show the cursor.
Tested on iOS 11.
I believe I fixed the issue. Please check the linked commit.
The problem was happening when editing a text node.
Its not solved yet as its easy reproducible if editor's isScrollEnabled is false