Skip to content

Handle autoCapitalize for native <TextInput />#436

Closed
wlabu wants to merge 12 commits into
react:mainfrom
wlabu:input-autoCapitalize
Closed

Handle autoCapitalize for native <TextInput />#436
wlabu wants to merge 12 commits into
react:mainfrom
wlabu:input-autoCapitalize

Conversation

@wlabu

@wlabu wlabu commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

The autoCapitalize prop is not being forwarded through to the native input component. Which means that the following has no effect on the mobile device software-keyboard when the input is focused:

<html.input autoCapitalize="none" />

This change maps the autoCapitalize prop's various values to the underlying native <TextInput /> element, and allows the software-keyboard to react to the prop.


There is some complexity with mapping the prop's values since the types declare a list larger than what is supported in react-native.

The declared type's values are:

"none" | "off" | "on" | "sentences" | "words" | "characters"

The list of supported values in react-native is:

"none" | "sentences" | "words" | "characters"

Further, there was also an existing test which assumed that the autoCapitalize prop could be set to boolean true, as follows:

<html.input autoCapitalize />

The way this PR maps these values has been based on the MDN docs:

prop value native value
none none
off none
true sentences
on sentences
sentences sentences
words words
characters characters

👋 Quick disclaimer

RSD is very exciting, and has been a lot of fun to use.
Thank you very much for the hard work!

This is my first PR here, and even though I think I've covered most of the requirements and tests, I'd be happy to amend it however required.

@wlabu wlabu requested a review from necolas as a code owner December 10, 2025 09:23
@meta-cla meta-cla Bot added the cla signed label Dec 10, 2025

@necolas necolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this. Generally looks good, just a few tweaks

let _autoCapitalize;
switch (autoCapitalize) {
case 'on':
case true:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can get rid of the boolean. I don't see it as part of the standard

Comment on lines +59 to +63
autoCapitalize?: ?(
| true
| 'off'
| 'none'
| 'on'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RN doesn't support off and on so they shouldn't be in this type

Comment on lines 285 to 287
| 'off'
| 'none'
| 'on'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Potentially we could remove off and on as they were part of the pre-standard, iOS version of autoCapitalize and were retained for backwards compatibility. Not necessary for now, just putting it out there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to me. 👍

As per the spec:

  • on is covered/duplicated by sentences
  • off is covered/duplicated by none

Just to say it: removing these 2 values would cause type errors in consuming projects that use them, so it might be useful to add a note in the next release.

Comment on lines +397 to +404
// web only
'on',
'off',
// web & native
'none', // used instead of 'off'
'sentences', // used instead of 'on'
'words',
'characters'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test is just for native, and if we're supporting all 6 values it's confusing (and inaccurate) to have comments like "web only".

@wlabu wlabu requested a review from necolas December 12, 2025 08:37
@wlabu

wlabu commented Dec 12, 2025

Copy link
Copy Markdown
Contributor Author

On an aside - I had a look at the failing CI jobs before force-pushing:

Wondering if it might be related to this: peter-evans/create-or-update-comment#395

@necolas necolas closed this in 32a8b66 Dec 12, 2025
@necolas

necolas commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Thanks

@wlabu wlabu deleted the input-autoCapitalize branch December 15, 2025 09:56
@wlabu

wlabu commented Jan 6, 2026

Copy link
Copy Markdown
Contributor Author

Sorry to comment on a closed PR - I'm not even sure you'll be notified.
All I really wanted to ask is whether you have an idea of when the next release will be cut?

I'd love to use this change downstream in a project :)

@necolas

necolas commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

I'll cut a release today. Thanks for the reminder

@necolas

necolas commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

Sorry for the delay. Just published 0.0.55

@wlabu

wlabu commented Jan 10, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!

@wlabu

wlabu commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

👋 Once again, sorry for commenting on a closed PR. I didn't want to create a fresh issue or discussion just for this.

When trying to upgrade RSD to 0.0.55 (we use yarn v4, so yarn up 'react-strict-dom'), we get an error:

› yarn up 'react-strict-dom'

➤ YN0000: · Yarn 4.9.2
➤ YN0000: ┌ Resolution step
➤ YN0082: │ postcss-react-strict-dom@npm:0.0.55: No candidates found
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 120ms

I've checked main, and the postcss package was bumped.

However, I don't see a 0.0.55 Release, and the latest version on npmjs.com is 0.0.54

Could I kindly ask you to have a look?

@necolas

necolas commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Should be published now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants