react / react/react-native

[IOS][New Arch] TextInput dataDetectorTypes has no effect when set to `all`

Đang mở Phù hợp với người mới
#55,367 5 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Component: TextInput Needs: Attention Platform: iOS Type: New Architecture Type: Unsupported Version
Ngôn ngữ chính
C++
Star
127k
Fork
25.3k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
4

Mô tả

Description

When TextInput dataDetectorTypes is set to all, it doesn't detect link, etc. But other options seem to work.

The following patch fixes the issue. The value of all is NSUIntegerMax, but unsignedIntValue converts it from 64-bit to 32-bit and causes the issue.

diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm
index 92467e2..9f45eb4 100644
--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm
+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm
@@ -293,7 +293,7 @@ UIDataDetectorTypes RCTUITextViewDataDetectorTypesFromStringVector(const std::ve
   for (const auto &dataType : dataDetectorTypes) {
     NSNumber *val = dataDetectorTypesMap[RCTNSStringFromString(dataType)];
     if (val) {
-      ret |= (UIDataDetectorTypes)val.unsignedIntValue;
+      ret |= (UIDataDetectorTypes)val.unsignedIntegerValue;
     }
   }
   return ret;

Steps to reproduce

Add a TextInput and include a link in the text:
<TextInput multiline={true} editable={false} dataDetectorTypes={'all'} value={text}/>

The link is not displayed as a link or tappable.

React Native Version

0.80.2, 0.81

Affected Platforms

Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx @react-native-community/cli info
System:
  OS: macOS 26.2
  CPU: (10) arm64 Apple M1 Pro
  Memory: 168.83 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.18.0
    path: ~/.volta/tools/image/node/22.18.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.volta/tools/image/yarn/1.22.22/bin/yarn
  npm:
    version: 10.9.3
    path: ~/.volta/tools/image/node/22.18.0/bin/npm
  Watchman:
    version: 2025.05.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2513.14007798
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.16
    path: /Users/yupeng/.sdkman/candidates/java/17.0.16-zulu/bin/javac
  Ruby:
    version: 3.4.5
    path: /Users/yupeng/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.1.1
    wanted: 19.1.1
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.2
    wanted: 0.80.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
N/A
MANDATORY Reproducer

https://snack.expo.dev/@yupeng_li/textinput-datadetectortypes---all

Screenshots and Videos

No response

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm tại RCTUITextViewDataDetectorTypesFromStringVector và kiểm tra cách giá trị all được chuyển đổi. Sử dụng trình tái hiện Snack được liên kết với một iOS Fabric TextInput, sau đó xác nhận rằng dataDetectorTypes={'all'} phát hiện các liên kết và làm cho chúng có thể nhấn được.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
objective-c, react-native
Lĩnh vực
mobile
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
70/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.