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.
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.