Add support for new iOS text content type cellular EID and cellular IMEI (#46378)

Summary:
Support for new iOS text content type to autofill cellular EID or cellular IMEI:
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellulareid?language=objc
- https://developer.apple.com/documentation/uikit/uitextcontenttypecellularimei?language=objc

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [ADDED] - new text content type cellular EID and cellular IMEI

Pull Request resolved: https://github.com/facebook/react-native/pull/46378

Test Plan:
JavaScript Tests - yarn test [PASSED]
- No errors related with the changes

Flow - yarn flow && yarn lint [PASSED]
- No errors related with the changes

iOS Tests - ./scripts/objc-test.sh test [PASSED]
- No errors related with the changes

Build RNTester [PASSED]
- No errors related with the changes
- Proof:
<img width="838" alt="Screenshot 2024-09-07 at 12 06 48" src="https://github.com/user-attachments/assets/836a71f2-8adb-428f-b98d-8b84f71e93d6">
<img width="806" alt="Screenshot 2024-09-07 at 12 07 29" src="https://github.com/user-attachments/assets/7b33b919-3b29-4846-b6a2-3427dbbc2869">
<img width="1221" alt="Screenshot 2024-09-07 at 12 13 02" src="https://github.com/user-attachments/assets/58b369e9-5281-4a6b-9663-1cbd77439510">

![Simulator Screenshot - iPhone 15 Pro - 2024-09-07 at 12 06 36](https://github.com/user-attachments/assets/9411c9d9-0b93-4f47-b21c-cbd95810f4c7)
Note: Since the test was done using an iOS simulator the autofill suggestion won't appear for the cellularEID or cellularIMEI

Reviewed By: cortinico

Differential Revision: D62386126

Pulled By: cipolleschi

fbshipit-source-id: 50da572650b796d0426a15f0c06fd0c52a8247f5
This commit is contained in:
Pascoal Júnior
2024-09-16 07:27:01 -07:00
committed by Facebook GitHub Bot
parent 1ac3b890d8
commit 14e0d0dffb
2 changed files with 18 additions and 0 deletions
@@ -323,6 +323,15 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
@"birthdateYear" : UITextContentTypeBirthdateYear,
}];
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 170400 /* __IPHONE_17_4 */
if (@available(iOS 17.4, *)) {
[mutableContentTypeMap addEntriesFromDictionary:@{
@"cellularEID" : UITextContentTypeCellularEID,
@"cellularIMEI" : UITextContentTypeCellularIMEI,
}];
}
#endif
#endif
contentTypeMap = mutableContentTypeMap;
@@ -240,6 +240,15 @@ UITextContentType RCTUITextContentTypeFromString(const std::string &contentType)
@"birthdateYear" : UITextContentTypeBirthdateYear,
}];
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 170400 /* __IPHONE_17_4 */
if (@available(iOS 17.4, *)) {
[mutableContentTypeMap addEntriesFromDictionary:@{
@"cellularEID" : UITextContentTypeCellularEID,
@"cellularIMEI" : UITextContentTypeCellularIMEI,
}];
}
#endif
#endif
contentTypeMap = mutableContentTypeMap;