microsoft / react-native-macos

A framework for building native macOS apps with React.
https://microsoft.github.io/react-native-windows/
MIT License
3.49k stars 135 forks source link

<Text onBlur={() => {}}> throws -[RCTTextView setOnBlur:]: unrecognized selector sent #2090

Open thejustinwalsh opened 7 months ago

thejustinwalsh commented 7 months ago

Environment

react-native -v: 12.3.2
npm ls react-native-macos: react-native-macos@0.73.17
node -v: v18.15.0
npm -v: 9.7.2
yarn --version: 1.22.21
xcodebuild -version: Xcode 15.3 Build version 15E204a

Steps to reproduce the bug

Add a Text component with an onBlur event handler...

<Text onBlur={() => {}}>

Expected Behavior

This component is valid on react-native for iOS / Andoird / Expo and does not throw an exception.

Actual Behavior

On react-native-macos, the following exception is thrown...

Exception thrown while executing UI block: -[RCTTextView setOnBlur:]: unrecognized selector sent to instance 0x11e4a34f0

__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke
    RCTUIManager.m:1265
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.189
__RCTExecuteOnMainQueue_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_drain
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
RunCurrentEventLoopInMode
ReceiveNextEventCommon
_BlockUntilNextEventMatchingListInModeWithFilter
_DPSNextEvent
-[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
-[NSApplication run]
NSApplicationMain
main
start

This was discovered when attempting to use https://github.com/tamagui/tamagui on react-native-macos

Reproducible Demo

https://snack.expo.dev/@thejustinwalsh/text-on-blur

Additional context

No response

Saadnajmi commented 7 months ago

Thanks for the report! Interesting..