diff --git a/ios/NewArch/FabricViewImplementationProtocol.swift b/ios/NewArch/FabricViewImplementationProtocol.swift index f8e66b40..80353c6c 100644 --- a/ios/NewArch/FabricViewImplementationProtocol.swift +++ b/ios/NewArch/FabricViewImplementationProtocol.swift @@ -2,5 +2,8 @@ import Foundation @objc public protocol FabricViewImplementationProtocol { var actions: [NSDictionary]? { get set } var title: NSString? { get set } + var themeVariant: NSString? { get set } + var shouldOpenOnLongPress: Bool { get set } + @objc optional var hitSlop: UIEdgeInsets { get set } var onPressAction: ((String) -> Void)? { get set } } diff --git a/ios/NewArch/MenuView.mm b/ios/NewArch/MenuView.mm index 17dc0f41..da06dfd8 100644 --- a/ios/NewArch/MenuView.mm +++ b/ios/NewArch/MenuView.mm @@ -137,6 +137,26 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & _view.title = [NSString stringWithUTF8String:newViewProps.title.c_str()]; } + if (oldViewProps.themeVariant != newViewProps.themeVariant) { + _view.themeVariant = [NSString stringWithUTF8String:newViewProps.themeVariant.c_str()]; + } + + if (oldViewProps.shouldOpenOnLongPress != newViewProps.shouldOpenOnLongPress) { + _view.shouldOpenOnLongPress = newViewProps.shouldOpenOnLongPress; + } + + if (oldViewProps.hitSlop.top != newViewProps.hitSlop.top || + oldViewProps.hitSlop.bottom != newViewProps.hitSlop.bottom || + oldViewProps.hitSlop.left != newViewProps.hitSlop.left || + oldViewProps.hitSlop.right != newViewProps.hitSlop.right) { + _view.hitSlop = UIEdgeInsetsMake( + newViewProps.hitSlop.top, + newViewProps.hitSlop.left, + newViewProps.hitSlop.bottom, + newViewProps.hitSlop.right + ); + } + [super updateProps:props oldProps:oldProps]; } diff --git a/ios/Shared/ActionSheetView.swift b/ios/Shared/ActionSheetView.swift index 79e30a25..c521b19d 100644 --- a/ios/Shared/ActionSheetView.swift +++ b/ios/Shared/ActionSheetView.swift @@ -33,10 +33,10 @@ public class ActionSheetView: UIView { } } - @objc var shouldOpenOnLongPress: Bool = false + @objc public var shouldOpenOnLongPress: Bool = false private var _themeVariant: String? - @objc var themeVariant: NSString? { + @objc public var themeVariant: NSString? { didSet { self._themeVariant = themeVariant as? String } } diff --git a/ios/Shared/MenuViewImplementation.swift b/ios/Shared/MenuViewImplementation.swift index 86299537..ccfc5810 100644 --- a/ios/Shared/MenuViewImplementation.swift +++ b/ios/Shared/MenuViewImplementation.swift @@ -36,21 +36,21 @@ public class MenuViewImplementation: UIButton { } } - @objc var shouldOpenOnLongPress: Bool = false { + @objc public var shouldOpenOnLongPress: Bool = false { didSet { self.setup() } } private var _themeVariant: String? - @objc var themeVariant: NSString? { + @objc public var themeVariant: NSString? { didSet { self._themeVariant = themeVariant as? String self.setup() } } - @objc var hitSlop: UIEdgeInsets = .zero + @objc public var hitSlop: UIEdgeInsets = .zero override init(frame: CGRect) { super.init(frame: frame) diff --git a/src/NativeModuleSpecs/UIMenuNativeComponent.ts b/src/NativeModuleSpecs/UIMenuNativeComponent.ts index f1bf041e..34726504 100644 --- a/src/NativeModuleSpecs/UIMenuNativeComponent.ts +++ b/src/NativeModuleSpecs/UIMenuNativeComponent.ts @@ -48,6 +48,14 @@ export interface NativeProps extends ViewProps { actions: Array; actionsHash: string; // just a workaround to make sure we don't have to manually compare MenuActions manually in C++ (since it's a struct and that's a pain) title?: string; + themeVariant?: string; + shouldOpenOnLongPress?: boolean; + hitSlop: { + top: Int32; + bottom: Int32; + left: Int32; + right: Int32; + } } export default codegenNativeComponent(