fix weird animation

This commit is contained in:
Samuel Newman
2026-04-20 12:17:03 +03:00
parent acec5885ec
commit 343ce24cba
@@ -22,6 +22,20 @@ class ExpoBlueskyContextMenuView: ExpoView, UIContextMenuInteractionDelegate {
self.addInteraction(interaction) self.addInteraction(interaction)
} }
override var bounds: CGRect {
get {
let b = super.bounds
let s = UIScreen.main.scale
return CGRect(
x: b.origin.x,
y: b.origin.y,
width: round(b.width * s) / s,
height: round(b.height * s) / s
)
}
set { super.bounds = newValue }
}
func setPreview(_ value: [String: Any]?) { self.preview = value } func setPreview(_ value: [String: Any]?) { self.preview = value }
func setMenuItems(_ value: [[String: Any]]) { self.menuItems = value } func setMenuItems(_ value: [[String: Any]]) { self.menuItems = value }
func setPreviewCornerRadius(_ value: Double) { func setPreviewCornerRadius(_ value: Double) {
@@ -59,11 +73,12 @@ class ExpoBlueskyContextMenuView: ExpoView, UIContextMenuInteractionDelegate {
return makeTargetedPreview() return makeTargetedPreview()
} }
// NOTE: Intentionally not implementing func contextMenuInteraction(
// `previewForDismissingMenuWithConfiguration`. iOS reverses the highlight _ interaction: UIContextMenuInteraction,
// animation by default, which interpolates size + position together. Supplying previewForDismissingMenuWithConfiguration configuration: UIContextMenuConfiguration
// a separate dismiss preview tends to produce a two-stage animation on ) -> UITargetedPreview? {
// aspect-mismatched thumbnails (snap to original size, then translate). return makeTargetedPreview()
}
func contextMenuInteraction( func contextMenuInteraction(
_ interaction: UIContextMenuInteraction, _ interaction: UIContextMenuInteraction,