-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
textTransform Capitalize Does Not Behave As it Does in CSS #34117
Comments
|
I think the |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
The github-actions bot told me I had to add a comment or the issue would be closed as stale. Does anyone have any plans to look at it at some point? |
UPDATE: I have upgraded my OS and a lot of the libraries. Still seeing the same behavior, so none of those changes made a difference with this particular issue. New output of
|
Description
When using
textTransform: 'capitalize'
on a Text component in RN, if there are any characters after the first character in a given word which were already upper-case, they are then converted to lower-case. For example: "I am PSYCHED about react native" becomes, "I Am Psyched About React Native." When using CSS on the web, the result of applying the same property value on the same source text would be, "I Am PSYCHED About React Native," leaving characters which are already upper-case as they are.This difference is observable both in iOS and Android simulators, as well as on an iOS physical device (an Android physical device was not available for testing).
I understand that React Native style props are not meant to be absolutely equivalent to CSS, but it is my understanding that the intent of the project was to create an environment which was as familiar to web developers as possible. And it sure would be nice if they behaved the same way in both environments.
If there are a significant number of users who prefer the RN implementation to the way it is implemented in CSS, certainly one solution might be to add another option for the enum (maybe "pure-capitalize," for example) so that developers could have it whichever way they like.
Version
0.64.3
Output of
npx react-native info
Steps to reproduce
Add the
textTransform: 'capitalize'
property to any Text component for which the source text contains an upper-case character in a word at some position after the initial character.Snack, code example, screenshot, or link to a repository
Link to snack that reproduces the issue: https://snack.expo.dev/@duckandbeaver/texttransformnotlikecss
This MDN page shows how the similar property value behaves in CSS: https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform
The text was updated successfully, but these errors were encountered: