Skip to content

Commit

Permalink
[macOS] Fix build on old architecture (#3182)
Browse files Browse the repository at this point in the history
## Description

Currently macOS fails to build on old architecture. This PR fixes that.

## Test plan

Run MacOSExample on paper.
  • Loading branch information
m-bert committed Oct 24, 2024
1 parent 36bf1dc commit 97b19c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions apple/RNGestureHandlerButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@

#if TARGET_OS_OSX

#if RCT_NEW_ARCH_ENABLED

#include <react/renderer/core/LayoutMetrics.h>

@protocol RCTComponentViewProtocol;

#endif // RCT_NEW_ARCH_ENABLED

@interface RNGestureHandlerButton : NSControl
#else
@interface RNGestureHandlerButton : UIControl
#endif
#endif // TARGET_OS_OSX
/**
* Insets used when hit testing inside this view.
*/
@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
@property (nonatomic) BOOL userEnabled;

#if TARGET_OS_OSX
#if TARGET_OS_OSX && RCT_NEW_ARCH_ENABLED
- (void)mountChildComponentView:(RNGHUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)unmountChildComponentView:(RNGHUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
Expand Down
6 changes: 5 additions & 1 deletion apple/RNGestureHandlerButton.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
#import <React/RCTUIKit.h>
#endif

#if RCT_NEW_ARCH_ENABLED

#import <React/RCTConversions.h>
#import <React/RCTFabricComponentsPlugins.h>

#endif

/**
* Gesture Handler Button components overrides standard mechanism used by RN
* to determine touch target, which normally would reurn the UIView that is placed
Expand Down Expand Up @@ -87,7 +91,7 @@ - (RNGHUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
}
#endif

#if TARGET_OS_OSX
#if TARGET_OS_OSX && RCT_NEW_ARCH_ENABLED
- (void)mountChildComponentView:(RNGHUIView *)childComponentView index:(NSInteger)index
{
if (childComponentView.superview != nil) {
Expand Down

0 comments on commit 97b19c1

Please sign in to comment.