Skip to content

Commit

Permalink
Merge pull request #1553 from wordpress-mobile/release/1.16.1
Browse files Browse the repository at this point in the history
Release 1.16.1

Android device tests look stuck so I'm moving the PR forward.
  • Loading branch information
SergioEstevao authored Nov 8, 2019
2 parents b6d1204 + 06c2e9f commit a660543
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 41 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.16.1
------
*[iOS] Fix tap on links bug that reappear on iOS 13.2

1.16.0
------
* [Android] Add support for pexels images
Expand Down
22 changes: 11 additions & 11 deletions bundle/android/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/android/App.js.map

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions bundle/ios/App.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/ios/App.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg-mobile",
"version": "1.16.0",
"version": "1.16.1",
"private": true,
"config": {
"jsfiles": "./*.js src/*.js src/**/*.js src/**/**/*.js",
Expand Down
33 changes: 17 additions & 16 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class RCTAztecView: Aztec.TextView {
textDragInteraction?.isEnabled = false
storage.htmlConverter.characterToReplaceLastEmptyLine = Character(.zeroWidthSpace)
shouldNotifyOfNonUserChanges = false
disableLinkTapRecognizer()
}

func addPlaceholder() {
Expand All @@ -147,6 +148,22 @@ class RCTAztecView: Aztec.TextView {
])
}

/**
This handles a bug introduced by iOS 13.0 (tested up to 13.2) where link interactions don't respect what the documentation says.
The documenatation for textView(_:shouldInteractWith:in:interaction:) says:
> Links in text views are interactive only if the text view is selectable but noneditable.
Our Aztec Text views are selectable and editable, and yet iOS was opening links on Safari when tapped.
*/
func disableLinkTapRecognizer() {
guard let recognizer = gestureRecognizers?.first(where: { $0.name == "UITextInteractionNameLinkTap" }) else {
return
}
recognizer.isEnabled = false
}

// MARK - View Height: Match to content height

override func layoutSubviews() {
Expand Down Expand Up @@ -627,20 +644,4 @@ extension RCTAztecView: UITextViewDelegate {
func textViewDidEndEditing(_ textView: UITextView) {
onBlur?([:])
}

func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
if #available(iOS 13.1, *) {
return false
} else if #available(iOS 13.0.0, *) {
// Sergio Estevao: This shouldn't happen in an editable textView, but it looks we have a system bug in iOS13 so we need this workaround
let position = characterRange.location
textView.selectedRange = NSRange(location: position, length: 0)
textView.typingAttributes = textView.attributedText.attributes(at: position, effectiveRange: nil)
textView.delegate?.textViewDidChangeSelection?(textView)
} else {
return false
}

return false
}
}

0 comments on commit a660543

Please sign in to comment.