Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Sep 25, 2022
2 parents 06dec57 + aaaca40 commit db77343
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ios/src/Extensions+Init/UIMenu+Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extension UIMenu.Options {
};
};

#if !targetEnvironment(macCatalyst)
#if swift(>=5.7)
@available(iOS 16, *)
extension UIMenu.ElementSize {
Expand All @@ -33,4 +34,4 @@ extension UIMenu.ElementSize {
};
};
#endif

#endif
2 changes: 2 additions & 0 deletions ios/src/Extensions+Init/UIMenuElement+Init.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ extension UIMenuElement.Attributes {
case "disabled" : self = .disabled;
case "destructive": self = .destructive;

#if !targetEnvironment(macCatalyst)
#if swift(>=5.7)
case "keepsMenuPresented":
guard #available(iOS 16.0, *) else { return nil };
self = .keepsMenuPresented
#endif
#endif

default: return nil;
};
Expand Down
4 changes: 4 additions & 0 deletions ios/src/ReactNative/RNIContextMenu/RNIMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ extension RNIMenuItem {
);
};

#if !targetEnvironment(macCatalyst)
#if swift(>=5.7)
@available(iOS 16.0, *)
var synthesizedPreferredMenuElementSize: UIMenu.ElementSize? {
Expand All @@ -128,6 +129,7 @@ extension RNIMenuItem {
return UIMenu.ElementSize(string: menuPreferredElementSize);
};
#endif
#endif
};

// MARK: - Functions
Expand Down Expand Up @@ -163,13 +165,15 @@ extension RNIMenuItem {
};
#endif

#if !targetEnvironment(macCatalyst)
#if swift(>=5.7)
if #available(iOS 16.0, *),
let preferredElementSize = self.synthesizedPreferredMenuElementSize {

menu.preferredElementSize = preferredElementSize;
};
#endif
#endif

return menu;
};
Expand Down

0 comments on commit db77343

Please sign in to comment.