mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert D19271321: iOS - deprecate iOS 9 support by removing runtime checks for 10.0+
Differential Revision: D19271321 Original commit changeset: 424ad7e21612 fbshipit-source-id: 2bd9599e8fb31914dbcbc03f732379d6c8103028
This commit is contained in:
committed by
Facebook Github Bot
parent
8b735a2c1e
commit
f11937ef65
@@ -194,65 +194,68 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame)
|
||||
|
||||
- (void)setTextContentType:(NSString *)type
|
||||
{
|
||||
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
|
||||
static dispatch_once_t onceToken;
|
||||
static NSDictionary<NSString *, NSString *> *contentTypeMap;
|
||||
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
||||
if (@available(iOS 10.0, *)) {
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
contentTypeMap = @{@"none": @"",
|
||||
@"URL": UITextContentTypeURL,
|
||||
@"addressCity": UITextContentTypeAddressCity,
|
||||
@"addressCityAndState":UITextContentTypeAddressCityAndState,
|
||||
@"addressState": UITextContentTypeAddressState,
|
||||
@"countryName": UITextContentTypeCountryName,
|
||||
@"creditCardNumber": UITextContentTypeCreditCardNumber,
|
||||
@"emailAddress": UITextContentTypeEmailAddress,
|
||||
@"familyName": UITextContentTypeFamilyName,
|
||||
@"fullStreetAddress": UITextContentTypeFullStreetAddress,
|
||||
@"givenName": UITextContentTypeGivenName,
|
||||
@"jobTitle": UITextContentTypeJobTitle,
|
||||
@"location": UITextContentTypeLocation,
|
||||
@"middleName": UITextContentTypeMiddleName,
|
||||
@"name": UITextContentTypeName,
|
||||
@"namePrefix": UITextContentTypeNamePrefix,
|
||||
@"nameSuffix": UITextContentTypeNameSuffix,
|
||||
@"nickname": UITextContentTypeNickname,
|
||||
@"organizationName": UITextContentTypeOrganizationName,
|
||||
@"postalCode": UITextContentTypePostalCode,
|
||||
@"streetAddressLine1": UITextContentTypeStreetAddressLine1,
|
||||
@"streetAddressLine2": UITextContentTypeStreetAddressLine2,
|
||||
@"sublocality": UITextContentTypeSublocality,
|
||||
@"telephoneNumber": UITextContentTypeTelephoneNumber,
|
||||
};
|
||||
static dispatch_once_t onceToken;
|
||||
static NSDictionary<NSString *, NSString *> *contentTypeMap;
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
|
||||
if (@available(iOS 11.0, tvOS 11.0, *)) {
|
||||
NSDictionary<NSString *, NSString *> * iOS11extras = @{@"username": UITextContentTypeUsername,
|
||||
@"password": UITextContentTypePassword};
|
||||
dispatch_once(&onceToken, ^{
|
||||
contentTypeMap = @{@"none": @"",
|
||||
@"URL": UITextContentTypeURL,
|
||||
@"addressCity": UITextContentTypeAddressCity,
|
||||
@"addressCityAndState":UITextContentTypeAddressCityAndState,
|
||||
@"addressState": UITextContentTypeAddressState,
|
||||
@"countryName": UITextContentTypeCountryName,
|
||||
@"creditCardNumber": UITextContentTypeCreditCardNumber,
|
||||
@"emailAddress": UITextContentTypeEmailAddress,
|
||||
@"familyName": UITextContentTypeFamilyName,
|
||||
@"fullStreetAddress": UITextContentTypeFullStreetAddress,
|
||||
@"givenName": UITextContentTypeGivenName,
|
||||
@"jobTitle": UITextContentTypeJobTitle,
|
||||
@"location": UITextContentTypeLocation,
|
||||
@"middleName": UITextContentTypeMiddleName,
|
||||
@"name": UITextContentTypeName,
|
||||
@"namePrefix": UITextContentTypeNamePrefix,
|
||||
@"nameSuffix": UITextContentTypeNameSuffix,
|
||||
@"nickname": UITextContentTypeNickname,
|
||||
@"organizationName": UITextContentTypeOrganizationName,
|
||||
@"postalCode": UITextContentTypePostalCode,
|
||||
@"streetAddressLine1": UITextContentTypeStreetAddressLine1,
|
||||
@"streetAddressLine2": UITextContentTypeStreetAddressLine2,
|
||||
@"sublocality": UITextContentTypeSublocality,
|
||||
@"telephoneNumber": UITextContentTypeTelephoneNumber,
|
||||
};
|
||||
|
||||
NSMutableDictionary<NSString *, NSString *> * iOS11baseMap = [contentTypeMap mutableCopy];
|
||||
[iOS11baseMap addEntriesFromDictionary:iOS11extras];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
|
||||
if (@available(iOS 11.0, tvOS 11.0, *)) {
|
||||
NSDictionary<NSString *, NSString *> * iOS11extras = @{@"username": UITextContentTypeUsername,
|
||||
@"password": UITextContentTypePassword};
|
||||
|
||||
contentTypeMap = [iOS11baseMap copy];
|
||||
}
|
||||
#endif
|
||||
NSMutableDictionary<NSString *, NSString *> * iOS11baseMap = [contentTypeMap mutableCopy];
|
||||
[iOS11baseMap addEntriesFromDictionary:iOS11extras];
|
||||
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */
|
||||
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
||||
NSDictionary<NSString *, NSString *> * iOS12extras = @{@"newPassword": UITextContentTypeNewPassword,
|
||||
@"oneTimeCode": UITextContentTypeOneTimeCode};
|
||||
contentTypeMap = [iOS11baseMap copy];
|
||||
}
|
||||
#endif
|
||||
|
||||
NSMutableDictionary<NSString *, NSString *> * iOS12baseMap = [contentTypeMap mutableCopy];
|
||||
[iOS12baseMap addEntriesFromDictionary:iOS12extras];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 /* __IPHONE_12_0 */
|
||||
if (@available(iOS 12.0, tvOS 12.0, *)) {
|
||||
NSDictionary<NSString *, NSString *> * iOS12extras = @{@"newPassword": UITextContentTypeNewPassword,
|
||||
@"oneTimeCode": UITextContentTypeOneTimeCode};
|
||||
|
||||
contentTypeMap = [iOS12baseMap copy];
|
||||
}
|
||||
#endif
|
||||
});
|
||||
NSMutableDictionary<NSString *, NSString *> * iOS12baseMap = [contentTypeMap mutableCopy];
|
||||
[iOS12baseMap addEntriesFromDictionary:iOS12extras];
|
||||
|
||||
// Setting textContentType to an empty string will disable any
|
||||
// default behaviour, like the autofill bar for password inputs
|
||||
self.backedTextInputView.textContentType = contentTypeMap[type] ?: type;
|
||||
contentTypeMap = [iOS12baseMap copy];
|
||||
}
|
||||
#endif
|
||||
});
|
||||
|
||||
// Setting textContentType to an empty string will disable any
|
||||
// default behaviour, like the autofill bar for password inputs
|
||||
self.backedTextInputView.textContentType = contentTypeMap[type] ?: type;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user