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:'
This line does work either with error No visible @interface for 'RNGestureHandlerButton' declares the selector 'updateLayoutMetrics:oldLayoutMetrics:':
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
Description
Hi, react-native-gesture-handler cannot be built on react-native-macos with new architecture enabled.
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-independentRNGHUIView
.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:'
https://github.com/software-mansion/react-native-gesture-handler/blob/a6741a920718f35d04cccf621737a146eeff370d/apple/RNGestureHandlerButtonComponentView.mm#L43-L46
This line does work either with error
No visible @interface for 'RNGestureHandlerButton' declares the selector 'updateLayoutMetrics:oldLayoutMetrics:'
:https://github.com/software-mansion/react-native-gesture-handler/blob/a6741a920718f35d04cccf621737a146eeff370d/apple/RNGestureHandlerButtonComponentView.mm#L85
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.
Note: you may have to add bundleUrl fix too: https://github.com/microsoft/react-native-macos/issues/2164#issuecomment-2294816367
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