diff --git a/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.m b/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.m index abd071bc8b9ffd..233c76ed84092f 100644 --- a/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -235,7 +235,8 @@ - (void)setTextContentType:(NSString *)type static NSDictionary *contentTypeMap; dispatch_once(&onceToken, ^{ - NSDictionary *mutableContentTypeMap = @{ + NSMutableDictionary *mutableContentTypeMap = [NSMutableDictionary new]; + [mutableContentTypeMap addEntriesFromDictionary:@{ @"none" : @"", @"URL" : UITextContentTypeURL, @"addressCity" : UITextContentTypeAddressCity, @@ -264,11 +265,11 @@ - (void)setTextContentType:(NSString *)type @"password" : UITextContentTypePassword, @"newPassword" : UITextContentTypeNewPassword, @"oneTimeCode" : UITextContentTypeOneTimeCode, - }; + }]; #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 /* __IPHONE_17_0 */ if (@available(iOS 17.0, *)) { - mutableContentTypeMap = [[mutableContentTypeMap mutableCopy] addEntriesFromDictionary:@{ + [mutableContentTypeMap addEntriesFromDictionary:@{ @"creditCardExpiration" : UITextContentTypeCreditCardExpiration, @"creditCardExpirationMonth" : UITextContentTypeCreditCardExpirationMonth, @"creditCardExpirationYear" : UITextContentTypeCreditCardExpirationYear, diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm index 6e3d662f15a150..a7526fd562a837 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm @@ -181,7 +181,8 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType) static NSDictionary *contentTypeMap; dispatch_once(&onceToken, ^{ - NSDictionary *mutableContentTypeMap = @{ + NSMutableDictionary *mutableContentTypeMap = [NSMutableDictionary new]; + [mutableContentTypeMap addEntriesFromDictionary:@{ @"" : @"", @"none" : @"", @"URL" : UITextContentTypeURL, @@ -211,11 +212,11 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType) @"password" : UITextContentTypePassword, @"newPassword" : UITextContentTypeNewPassword, @"oneTimeCode" : UITextContentTypeOneTimeCode, - }; + }]; #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 /* __IPHONE_17_0 */ if (@available(iOS 17.0, *)) { - mutableContentTypeMap = [[mutableContentTypeMap mutableCopy] addEntriesFromDictionary:@{ + [mutableContentTypeMap addEntriesFromDictionary:@{ @"creditCardExpiration" : UITextContentTypeCreditCardExpiration, @"creditCardExpirationMonth" : UITextContentTypeCreditCardExpirationMonth, @"creditCardExpirationYear" : UITextContentTypeCreditCardExpirationYear,