react-native [v0.74.1]光标属性在文本上导致崩溃

aoyhnmkz  于 3个月前  发布在  React
关注(0)|答案(2)|浏览(65)

描述

我注意到当我为 Text 组件设置 cursor: 'pointer' 时,应用程序会崩溃,尽管它在 View 上运行良好。
CleanShot.2024-05-14.at.03.51.46.mp4

重现步骤

react-native 中为 Text 组件设置 cursor: 'pointer' 样式属性。

<Text style={{ cursor: "pointer" }}>Hey, there!👋</Text>

React Native 版本

0.74.1

受影响的平台

运行时 - iOS

npx react-native info 的输出

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1 Pro
  Memory: 266.41 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.5.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.5.1
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.14.3
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK:
    API Levels:
      - "26"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 33.0.1
      - 34.0.0
    System Images:
      - android-26 | Google APIs Intel x86 Atom_64
      - android-34 | Google Play ARM 64 v8a
    Android NDK: Not Found

堆栈跟踪或日志

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

__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke
    RCTUIManager.m:1165
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.143
_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
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start_sim
0x0
0x0

重现器

https://snack.expo.dev/@alantoa/cursor-prop-is-causing-crash-on-text

截图和视频

CleanShot.2024-05-14.at.03.51.46.mp4

ilmyapht

ilmyapht1#

嘿,@Saadnajmi,我知道光标属性特性是你的贡献,感谢你的优秀PR!
我理解在VisionOS中可能不需要为Text设置它,但有时候我们需要在RN Web中使用它。所以我在想我们是否可以在Text上忽略这个属性而不是抛出错误?

rta7y2nd

rta7y2nd2#

编辑:固定到主键,我猜如果它落地了? #44563
啊,是的,这是一个合法的bug。我们应该允许你在Text上设置cursor,或者过滤掉它(可能通过不将其包含在Text的ViewConfig中)。我可以稍后调查一下什么有效。
初步测试表明,这只在旧架构上复现。

相关问题