@@ -194,68 +194,65 @@ - (void)setSelection:(RCTTextSelection *)selection
194
194
195
195
- (void )setTextContentType : (NSString *)type
196
196
{
197
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
198
- if (@available (iOS 10.0 , *)) {
199
-
200
- static dispatch_once_t onceToken;
201
- static NSDictionary <NSString *, NSString *> *contentTypeMap;
202
-
203
- dispatch_once (&onceToken, ^{
204
- contentTypeMap = @{@" none" : @" " ,
205
- @" URL" : UITextContentTypeURL,
206
- @" addressCity" : UITextContentTypeAddressCity,
207
- @" addressCityAndState" :UITextContentTypeAddressCityAndState,
208
- @" addressState" : UITextContentTypeAddressState,
209
- @" countryName" : UITextContentTypeCountryName,
210
- @" creditCardNumber" : UITextContentTypeCreditCardNumber,
211
- @" emailAddress" : UITextContentTypeEmailAddress,
212
- @" familyName" : UITextContentTypeFamilyName,
213
- @" fullStreetAddress" : UITextContentTypeFullStreetAddress,
214
- @" givenName" : UITextContentTypeGivenName,
215
- @" jobTitle" : UITextContentTypeJobTitle,
216
- @" location" : UITextContentTypeLocation,
217
- @" middleName" : UITextContentTypeMiddleName,
218
- @" name" : UITextContentTypeName,
219
- @" namePrefix" : UITextContentTypeNamePrefix,
220
- @" nameSuffix" : UITextContentTypeNameSuffix,
221
- @" nickname" : UITextContentTypeNickname,
222
- @" organizationName" : UITextContentTypeOrganizationName,
223
- @" postalCode" : UITextContentTypePostalCode,
224
- @" streetAddressLine1" : UITextContentTypeStreetAddressLine1,
225
- @" streetAddressLine2" : UITextContentTypeStreetAddressLine2,
226
- @" sublocality" : UITextContentTypeSublocality,
227
- @" telephoneNumber" : UITextContentTypeTelephoneNumber,
228
- };
229
-
230
- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
231
- if (@available (iOS 11.0 , tvOS 11.0 , *)) {
232
- NSDictionary <NSString *, NSString *> * iOS11extras = @{@" username" : UITextContentTypeUsername,
233
- @" password" : UITextContentTypePassword};
234
-
235
- NSMutableDictionary <NSString *, NSString *> * iOS11baseMap = [contentTypeMap mutableCopy ];
236
- [iOS11baseMap addEntriesFromDictionary: iOS11extras];
237
-
238
- contentTypeMap = [iOS11baseMap copy ];
239
- }
240
- #endif
241
-
242
- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */
243
- if (@available (iOS 12.0 , tvOS 12.0 , *)) {
244
- NSDictionary <NSString *, NSString *> * iOS12extras = @{@" newPassword" : UITextContentTypeNewPassword,
245
- @" oneTimeCode" : UITextContentTypeOneTimeCode};
246
-
247
- NSMutableDictionary <NSString *, NSString *> * iOS12baseMap = [contentTypeMap mutableCopy ];
248
- [iOS12baseMap addEntriesFromDictionary: iOS12extras];
249
-
250
- contentTypeMap = [iOS12baseMap copy ];
251
- }
252
- #endif
253
- });
254
-
255
- // Setting textContentType to an empty string will disable any
256
- // default behaviour, like the autofill bar for password inputs
257
- self.backedTextInputView .textContentType = contentTypeMap[type] ?: type;
258
- }
197
+ #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
198
+ static dispatch_once_t onceToken;
199
+ static NSDictionary <NSString *, NSString *> *contentTypeMap;
200
+
201
+ dispatch_once (&onceToken, ^{
202
+ contentTypeMap = @{@" none" : @" " ,
203
+ @" URL" : UITextContentTypeURL,
204
+ @" addressCity" : UITextContentTypeAddressCity,
205
+ @" addressCityAndState" :UITextContentTypeAddressCityAndState,
206
+ @" addressState" : UITextContentTypeAddressState,
207
+ @" countryName" : UITextContentTypeCountryName,
208
+ @" creditCardNumber" : UITextContentTypeCreditCardNumber,
209
+ @" emailAddress" : UITextContentTypeEmailAddress,
210
+ @" familyName" : UITextContentTypeFamilyName,
211
+ @" fullStreetAddress" : UITextContentTypeFullStreetAddress,
212
+ @" givenName" : UITextContentTypeGivenName,
213
+ @" jobTitle" : UITextContentTypeJobTitle,
214
+ @" location" : UITextContentTypeLocation,
215
+ @" middleName" : UITextContentTypeMiddleName,
216
+ @" name" : UITextContentTypeName,
217
+ @" namePrefix" : UITextContentTypeNamePrefix,
218
+ @" nameSuffix" : UITextContentTypeNameSuffix,
219
+ @" nickname" : UITextContentTypeNickname,
220
+ @" organizationName" : UITextContentTypeOrganizationName,
221
+ @" postalCode" : UITextContentTypePostalCode,
222
+ @" streetAddressLine1" : UITextContentTypeStreetAddressLine1,
223
+ @" streetAddressLine2" : UITextContentTypeStreetAddressLine2,
224
+ @" sublocality" : UITextContentTypeSublocality,
225
+ @" telephoneNumber" : UITextContentTypeTelephoneNumber,
226
+ };
227
+
228
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
229
+ if (@available (iOS 11.0 , tvOS 11.0 , *)) {
230
+ NSDictionary <NSString *, NSString *> * iOS11extras = @{@" username" : UITextContentTypeUsername,
231
+ @" password" : UITextContentTypePassword};
232
+
233
+ NSMutableDictionary <NSString *, NSString *> * iOS11baseMap = [contentTypeMap mutableCopy ];
234
+ [iOS11baseMap addEntriesFromDictionary: iOS11extras];
235
+
236
+ contentTypeMap = [iOS11baseMap copy ];
237
+ }
238
+ #endif
239
+
240
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */
241
+ if (@available (iOS 12.0 , tvOS 12.0 , *)) {
242
+ NSDictionary <NSString *, NSString *> * iOS12extras = @{@" newPassword" : UITextContentTypeNewPassword,
243
+ @" oneTimeCode" : UITextContentTypeOneTimeCode};
244
+
245
+ NSMutableDictionary <NSString *, NSString *> * iOS12baseMap = [contentTypeMap mutableCopy ];
246
+ [iOS12baseMap addEntriesFromDictionary: iOS12extras];
247
+
248
+ contentTypeMap = [iOS12baseMap copy ];
249
+ }
250
+ #endif
251
+ });
252
+
253
+ // Setting textContentType to an empty string will disable any
254
+ // default behaviour, like the autofill bar for password inputs
255
+ self.backedTextInputView .textContentType = contentTypeMap[type] ?: type;
259
256
#endif
260
257
}
261
258
0 commit comments