Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Fix build on fabric #3154

Merged
merged 9 commits into from
Oct 17, 2024
Merged

[macOS] Fix build on fabric #3154

merged 9 commits into from
Oct 17, 2024

Conversation

m-bert
Copy link
Contributor

@m-bert m-bert commented Oct 14, 2024

Description

Right now Gesture Handler fails to build on macOS on new architecture. This PR brings changes necessary to fix this problem.

Fixes #3144.

Test plan

Build macOS example app on new architecture.

@m-bert m-bert changed the title [macos] Fix build on fabric [macOS] Fix build on fabric Oct 14, 2024
apple/RNGestureHandlerButtonComponentView.mm Show resolved Hide resolved
Comment on lines 30 to 35
#ifdef __cplusplus
- (void)mountChildComponentView:(RNGHUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)unmountChildComponentView:(RNGHUIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index;
- (void)updateLayoutMetrics:(const facebook::react::LayoutMetrics &)layoutMetrics
oldLayoutMetrics:(const facebook::react::LayoutMetrics &)oldLayoutMetrics;
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually have no idea whether it's safe to do (have method declarations behind a compile flag but not the implementation.

Why do it this way instead of just changing files where it was included to be Objective-C++?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was already change into Obj-C++. The thing is, changing it to Obj-C++ is not enough and without this flag you'll get compilation errors. We talked about it with @piaskowyk and this was the solution that he came up with. Let us know if you see better one 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that everything that includes RNGestureHandlerButton.h should also be changed to Objective-C++ file not only RNGestureHandlerButton.m

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that makes sense.

Done in 9ebcbff

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checks for __cplusplus shouldn't be necessary in that case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, done in d8d1772

@hsjoberg
Copy link
Contributor

Can confirm that it fixes #3144 💯

@m-bert m-bert merged commit e5a9227 into main Oct 17, 2024
3 checks passed
@m-bert m-bert deleted the @mbert/macos-fabric-build branch October 17, 2024 14:56
m-bert added a commit that referenced this pull request Oct 24, 2024
## Description

Right now Gesture Handler fails to build on macOS on new architecture. This PR brings changes necessary to fix this problem.

Fixes #3144.

## Test plan

Build macOS example app on new architecture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

react-native-gesture-handler fails to build on react-native-macos with new architecture
3 participants