Skip to content

[ios][ui] Add textContentType modifier#44548

Merged
intergalacticspacehighway merged 1 commit intoexpo:mainfrom
ramonclaudio:feat/expo-ui-text-content-type
Apr 7, 2026
Merged

[ios][ui] Add textContentType modifier#44548
intergalacticspacehighway merged 1 commit intoexpo:mainfrom
ramonclaudio:feat/expo-ui-text-content-type

Conversation

@ramonclaudio
Copy link
Copy Markdown
Contributor

Add textContentType modifier for setting the semantic meaning of text input areas. Wraps SwiftUI's textContentType(_:) (iOS 13+), mapping to all 45 UITextContentType values.

Enables iOS autofill for passwords, emails, addresses, credit cards, OTP codes, and more.

import { textContentType } from "@expo/ui/swift-ui/modifiers";

<TextField
  placeholder="Username"
  modifiers={[textContentType("username")]}
/>

<SecureField
  placeholder="Password"
  modifiers={[textContentType("password")]}
/>

Without this modifier, text fields cannot participate in the iOS keychain autofill system. Values introduced in iOS 17+ (creditCardExpiration, birthdate, etc.) and iOS 17.4+ (cellularEID, cellularIMEI) include #available guards with sensible fallbacks.

Test Plan

  • yarn build in packages/expo-ui: clean
  • yarn lint --fix in packages/expo-ui: clean
  • yarn lint in packages/expo-ui: clean
  • yarn test in packages/expo-ui: 42/42 passing
  • Regenerated docs API data with et generate-docs-api-data -p expo-ui
  • Applied .username to TextField and .password to SecureField in bare-expo, verified iOS password autofill suggestion appears above keyboard

@ramonclaudio ramonclaudio force-pushed the feat/expo-ui-text-content-type branch from bb2cd5f to cd8d07d Compare April 7, 2026 01:03
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Subscribed to pull request

File Patterns Mentions
docs/** @amandeepmittal
packages/expo-ui/** @Kudo, @behenate, @intergalacticspacehighway

Generated by CodeMention

@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Apr 7, 2026
Copy link
Copy Markdown
Contributor

@intergalacticspacehighway intergalacticspacehighway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sick! Thanks!

@intergalacticspacehighway
Copy link
Copy Markdown
Contributor

intergalacticspacehighway commented Apr 7, 2026

Will require conflict resolution as i just merged the previous PR 😅

@ramonclaudio ramonclaudio force-pushed the feat/expo-ui-text-content-type branch from cd8d07d to 0fcc415 Compare April 7, 2026 04:22
@ramonclaudio
Copy link
Copy Markdown
Contributor Author

Will require conflict resolution as i just merged the previous PR 😅

😂 sorry. rebased and pushed. @intergalacticspacehighway

@intergalacticspacehighway intergalacticspacehighway merged commit edb706e into expo:main Apr 7, 2026
14 checks passed
intergalacticspacehighway pushed a commit that referenced this pull request Apr 7, 2026
Add `textContentType` modifier for setting the semantic meaning of text
input areas. Wraps SwiftUI's
[`textContentType(_:)`](https://developer.apple.com/documentation/swiftui/view/textcontenttype(_:)-ufdv)
(iOS 13+), mapping to all 45
[`UITextContentType`](https://developer.apple.com/documentation/uikit/uitextcontenttype)
values.

Enables iOS autofill for passwords, emails, addresses, credit cards, OTP
codes, and more.

```tsx
import { textContentType } from "@expo/ui/swift-ui/modifiers";

<TextField
  placeholder="Username"
  modifiers={[textContentType("username")]}
/>

<SecureField
  placeholder="Password"
  modifiers={[textContentType("password")]}
/>
```

Without this modifier, text fields cannot participate in the iOS
keychain autofill system. Values introduced in iOS 17+
(`creditCardExpiration`, `birthdate`, etc.) and iOS 17.4+
(`cellularEID`, `cellularIMEI`) include `#available` guards with
sensible fallbacks.

# Test Plan

- `yarn build` in `packages/expo-ui`: clean
- `yarn lint --fix` in `packages/expo-ui`: clean
- `yarn lint` in `packages/expo-ui`: clean
- `yarn test` in `packages/expo-ui`: 42/42 passing
- Regenerated docs API data with `et generate-docs-api-data -p expo-ui`
- Applied `.username` to TextField and `.password` to SecureField in
bare-expo, verified iOS password autofill suggestion appears above
keyboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: passed checks ExpoBot has nothing to complain about sdk-55

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants