From 110dfe4dfcdb6a2260f573b31cc16d992dff0672 Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Mon, 13 Jun 2022 06:32:36 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Refactor:=20Fix=20iOS=2016=20Dep?= =?UTF-8?q?recations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RNIContextMenuView.swift | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ios/src/ReactNative/RNIContextMenuView/RNIContextMenuView.swift b/ios/src/ReactNative/RNIContextMenuView/RNIContextMenuView.swift index ec3b0e3..f0cbe58 100644 --- a/ios/src/ReactNative/RNIContextMenuView/RNIContextMenuView.swift +++ b/ios/src/ReactNative/RNIContextMenuView/RNIContextMenuView.swift @@ -877,14 +877,38 @@ extension RNIContextMenuView: UIContextMenuInteractionDelegate { }; }; + #if swift(>=5.7) + func contextMenuInteraction( + _ interaction: UIContextMenuInteraction, + configuration: UIContextMenuConfiguration, + highlightPreviewForItemWithIdentifier identifier: NSCopying + ) -> UITargetedPreview? { + + return self.makeTargetedPreview(); + }; + #else + /// deprecated in iOS 16 func contextMenuInteraction( _ : UIContextMenuInteraction, previewForHighlightingMenuWithConfiguration: UIContextMenuConfiguration -) -> UITargetedPreview? { + ) -> UITargetedPreview? { return self.makeTargetedPreview(); }; + #endif + + #if swift(>=5.7) + func contextMenuInteraction( + _ interaction: UIContextMenuInteraction, + configuration: UIContextMenuConfiguration, + dismissalPreviewForItemWithIdentifier identifier: NSCopying + ) -> UITargetedPreview? { + + return self.makeTargetedPreview(); + }; + #else + /// deprecated in iOS 16 func contextMenuInteraction( _ interaction: UIContextMenuInteraction, previewForDismissingMenuWithConfiguration @@ -893,6 +917,7 @@ extension RNIContextMenuView: UIContextMenuInteractionDelegate { return self.makeTargetedPreview(); }; + #endif }; // MARK: - RNIContextMenu