-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugbug: react-nativeBug associated with upstream React Native vendor codeBug associated with upstream React Native vendor code
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the issue
The current implementation of text-transform: capitalize in react-native-web does not match the behavior found in React Native. In React Native, this transformation converts all characters in a word to lowercase except for the first letter, which is capitalized. However, in react-native-web, the transformation only capitalizes the first letter of each word while leaving the remaining letters unchanged.
Expected behavior
Input: "hello WORLD from ReAcT nAtIvE"
Expected Output: "Hello World From React Native"
Current Output: "Hello WORLD From ReAcT nAtIvE"
Steps to reproduce
-
Set Up Environment:
- Create a new React Native project using Expo or React Native CLI.
- Set up a React Native Web environment (e.g., using Expo for web or a separate React project with
react-native-web).
-
Create a Component:
- In both the React Native and React Native Web projects, create a simple component that uses the
Textcomponent from both libraries.
- In both the React Native and React Native Web projects, create a simple component that uses the
-
Add Text with Capitalization:
-
Use the following example text in both projects:
<Text style={{ textTransform: 'capitalize' }}> hello WORLD from ReAcT nAtIvE </Text>
-
-
Run Both Environments:
- For React Native, run the app on a mobile simulator or device.
- For React Native Web, run the app in a web browser.
-
Observe the Output:
- Check the output in both environments:
- React Native: The expected output should be
"Hello World From React Native". - React Native Web: The output will likely be
"Hello WORLD From ReAcT nAtIvE".
- React Native: The expected output should be
- Check the output in both environments:
-
Compare Results:
- Note the difference in behavior between the two platforms, highlighting the mismatch in capitalization.
Expected Result
- React Native should properly capitalize the first letter of each word while converting the rest to lowercase.
- React Native Web should only capitalize the first letter of each word without altering the case of the remaining letters.
Test case
https://codesandbox.io/s/sad-morning-79dhqp?file=/src/App.js
Additional comments
No response
Metadata
Metadata
Assignees
Labels
bugbug: react-nativeBug associated with upstream React Native vendor codeBug associated with upstream React Native vendor code