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

react-native-gesture-handler fails to build on react-native-macos with new architecture #3144

Closed
hsjoberg opened this issue Oct 8, 2024 · 2 comments · Fixed by #3154
Closed
Labels
Platform: MacOS Repro provided A reproduction with a snack or repo is provided

Comments

@hsjoberg
Copy link
Contributor

hsjoberg commented Oct 8, 2024

Description

Hi, react-native-gesture-handler cannot be built on react-native-macos with new architecture enabled.

image

This is due to iOS environment being expected in RNGestureHandlerButtonComponentView.h.

Furthermore, even when importing AppKit instead for macOS, there are more issues in RNGestureHandlerButtonComponentView.mm, where UIView is used instead of the platform-independent RNGHUIView.

However, I don't know how to fix [_buttonView mountChildComponentView:childComponentView index:index]; simply not working (existing?) on macOS.
No visible @interface for 'RNGestureHandlerButton' declares the selector 'mountChildComponentView:index:'

- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
{
[_buttonView mountChildComponentView:childComponentView index:index];
}

This line does work either with error No visible @interface for 'RNGestureHandlerButton' declares the selector 'updateLayoutMetrics:oldLayoutMetrics:':

[_buttonView updateLayoutMetrics:buttonMetrics oldLayoutMetrics:oldbuttonMetrics];

See repro here:
https://github.com/hsjoberg/gesturehandlernewarchbug

Steps to reproduce

Please see my repro.
But to do manually; start a new react-native community CLI project, initialize react-native-macos and add react-native-gesture handler to observe the error.

npx @react-native-community/cli init gesturehandlernewarchbug

cd gesturehandlernewarchbug/

yarn add react-native-macos@^0.75.0

npx react-native-macos-init

yarn add react-native-gesture-handler

cd macos

RCT_NEW_ARCH_ENABLED=1 pod install

# then start macos app via xcode or metro

Note: you may have to add bundleUrl fix too: microsoft/react-native-macos#2164 (comment)

Snack or a link to a repository

https://github.com/hsjoberg/gesturehandlernewarchbug

Gesture Handler version

2.20.0

React Native version

0.75

Platforms

MacOS

JavaScript runtime

JSC

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

None

Device model

macOS

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snack or repo is provided Platform: MacOS labels Oct 8, 2024
@m-bert
Copy link
Contributor

m-bert commented Oct 14, 2024

Hi @hsjoberg! Could you please check if #3154 resolves this issue?

@hsjoberg
Copy link
Contributor Author

Hi @m-bert, thank you for taking the time to fix this one.
I will test the PR.

@m-bert m-bert closed this as completed in e5a9227 Oct 17, 2024
m-bert added a commit that referenced this issue 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
Platform: MacOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants