Skip to content

Commit

Permalink
Merge pull request #619 from wordpress-mobile/issue/559_Shift_Enter_fix
Browse files Browse the repository at this point in the history
Avoid sending invalid caret rect information.
  • Loading branch information
SergioEstevao authored Feb 20, 2019
2 parents 163d04f + 0807763 commit b28b394
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,11 @@ class RCTAztecView: Aztec.TextView {

if let selectedTextRange = selectedTextRange {
let caretEndRect = caretRect(for: selectedTextRange.end)
result["selectionEndCaretX"] = caretEndRect.origin.x
result["selectionEndCaretY"] = caretEndRect.origin.y
// Sergio Estevao: Sometimes the carectRect can be invalid so we need to check before sending this to JS.
if !(caretEndRect.isInfinite || caretEndRect.isEmpty || caretEndRect.isNull) {
result["selectionEndCaretX"] = caretEndRect.origin.x
result["selectionEndCaretY"] = caretEndRect.origin.y
}
}

return result
Expand Down

0 comments on commit b28b394

Please sign in to comment.