Skip to content

Commit 0bd2cb1

Browse files
Cedric921meta-codesync[bot]
authored andcommitted
Fix TextInput dataDetectorTypes="all" having no effect on iOS (New Arch) (#58829)
Summary: Fixes #55367. On the New Architecture, `<TextInput dataDetectorTypes="all" />` has no effect on iOS, while individual types (`link`, `phoneNumber`, …) work. `RCTUITextViewDataDetectorTypesFromStringVector` reads the mapped `NSNumber` with `unsignedIntValue`. `UIDataDetectorTypeAll` is `NSUIntegerMax`, so it gets truncated to `0x00000000ffffffff`, which is not equal to `UIDataDetectorTypeAll` and UIKit does not treat it as "all". This switches to `unsignedIntegerValue`, matching the width of `UIDataDetectorTypes` (`NSUInteger`). The legacy `RCTConvert` path already reads the same mapping with `unsignedLongLongValue`, which is why the Old Architecture is unaffected. ## Changelog: [IOS] [FIXED] - Fix `TextInput` `dataDetectorTypes="all"` having no effect on the New Architecture Pull Request resolved: #58829 Test Plan: I compiled `RCTUITextViewDataDetectorTypesFromStringVector`, copied verbatim from the file before and after this change, into a small harness against the iOS SDK (stubbing only `RCTNSStringFromString`), and ran it on an iOS 26 simulator: ``` == before all -> 0x00000000ffffffff link -> 0x0000000000000002 link+phoneNumber -> 0x0000000000000003 lookupSuggestion -> 0x0000000000000040 == after all -> 0xffffffffffffffff (== UIDataDetectorTypeAll) link -> 0x0000000000000002 link+phoneNumber -> 0x0000000000000003 lookupSuggestion -> 0x0000000000000040 ``` `all` now maps to exactly `UIDataDetectorTypeAll`, and the other values are unchanged. I did not run this end-to-end in RNTester. The issue reporter and another user ([comment](#55367)) confirmed that this same patch, applied via patch-package, fixes link detection on 0.81 and 0.86.2. Reviewed By: javache Differential Revision: D125664939 Pulled By: cortinico fbshipit-source-id: a7eaf87de91216345517d517bf49a75ec8cbbb70
1 parent 9ae68b5 commit 0bd2cb1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ UIDataDetectorTypes RCTUITextViewDataDetectorTypesFromStringVector(const std::ve
296296
for (const auto &dataType : dataDetectorTypes) {
297297
NSNumber *val = dataDetectorTypesMap[RCTNSStringFromString(dataType)];
298298
if (val) {
299-
ret |= (UIDataDetectorTypes)val.unsignedIntValue;
299+
ret |= (UIDataDetectorTypes)val.unsignedIntegerValue;
300300
}
301301
}
302302
return ret;

0 commit comments

Comments
 (0)