Skip to content
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

Open
TheRealMikeD opened this issue Jul 2, 2022 · 5 comments
Open

textTransform Capitalize Does Not Behave As it Does in CSS #34117

TheRealMikeD opened this issue Jul 2, 2022 · 5 comments
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project.

Comments

@TheRealMikeD
Copy link

TheRealMikeD commented Jul 2, 2022

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

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
    Memory: 21.95 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.17.6/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8309675
    Xcode: 11.3.1/11C505 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.3 => 0.64.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

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

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Environment Info Please run `react-native info` and edit your issue with that command's output. and removed Needs: Triage 🔍 labels Jul 2, 2022
@github-actions
Copy link

github-actions bot commented Jul 2, 2022

⚠️ Missing Environment Information
ℹ️ Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

@react-native-bot react-native-bot removed the Needs: Environment Info Please run `react-native info` and edit your issue with that command's output. label Jul 2, 2022
@TheRealMikeD
Copy link
Author

TheRealMikeD commented Jul 7, 2022

I think the react-native info output is pretty easy for a human to see in the initial description. Only a poorly programmed bot would have trouble finding it.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Jul 7, 2022
@github-actions
Copy link

github-actions bot commented Jan 3, 2023

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.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 3, 2023
@TheRealMikeD
Copy link
Author

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?

@github-actions github-actions bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 4, 2023
@TheRealMikeD
Copy link
Author

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 npx react-native info:

System:
  OS: macOS 12.7.1
  CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  Memory: 392.98 MB / 32.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 16.20.0
    path: ~/.nvm/versions/node/v16.20.0/bin/node
  Yarn:
    version: 1.22.18
    path: /usr/local/bin/yarn
  npm:
    version: 8.19.4
    path: ~/.nvm/versions/node/v16.20.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.11.3
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.2
      - iOS 16.2
      - macOS 13.1
      - tvOS 16.1
      - watchOS 9.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 14.2/14C18
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.15.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

@cortinico cortinico added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Attention Issues where the author has responded to feedback. labels Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project.
Projects
None yet
Development

No branches or pull requests

3 participants