Unverified Commit 5e5ea520 authored by dima.avdeev's avatar dima.avdeev Committed by GitHub

fix iOS TextField Context menu blink bug (#735)

Issue: https://github.com/JetBrains/compose-multiplatform/issues/3276
parent 20bc1d2f
......@@ -58,16 +58,24 @@ class SkikoUIView : UIView, UIKeyInputProtocol, UITextInputProtocol,
fun showTextMenu(targetRect: Rect, textActions: TextActions) {
_currentTextMenuActions = textActions
val menu: UIMenuController = UIMenuController.sharedMenuController()
if (menu.isMenuVisible()) {
menu.hideMenu()
}
val cgRect = CGRectMake(
x = targetRect.left.toDouble(),
y = targetRect.top.toDouble(),
width = targetRect.width.toDouble(),
height = targetRect.height.toDouble()
)
menu.showMenuFromView(this, cgRect)
val isTargetVisible = CGRectIntersectsRect(bounds, cgRect)
if (isTargetVisible) {
if (menu.isMenuVisible()) {
menu.setTargetRect(cgRect, this)
} else {
menu.showMenuFromView(this, cgRect)
}
} else {
if (menu.isMenuVisible()) {
menu.hideMenu()
}
}
}
fun hideTextMenu() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment