Skip to content

Don't capitalize words starting by a number (fabric renderer)#33629

Closed
MaeIg wants to merge 1 commit into
facebook:mainfrom
MaeIg:fix-capitalize-on-ios-with-fabric
Closed

Don't capitalize words starting by a number (fabric renderer)#33629
MaeIg wants to merge 1 commit into
facebook:mainfrom
MaeIg:fix-capitalize-on-ios-with-fabric

Conversation

@MaeIg
Copy link
Copy Markdown
Contributor

@MaeIg MaeIg commented Apr 13, 2022

Summary

Few month ago, I created a pull request to unify the behavior of capitalize style between Android and IOS.

But, I found out that it doesn't work when fabric is enabled. We have the old behavior :

Android IOS
capitalize_android_fabric capitalize_ios_fabric
(source: rn-tester, last commit: dac56ce)

As fabric is now live since v0.68, we should fix this behavior for fabric aswell.

I don't know why there is so much duplicated code between ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm and Libraries/Text/RCTTextAttributes.m because I don't know the architecture of the project very well. But if you see missing tests or some refacto to do I'm open to suggestions!

Changelog

[iOS] [Fixed] - Don't capitalize the first letter of a word that is starting by a number (Fabric renderer)

Test Plan

I manually tested these changes on rn-tester (react-native main branch):

Fabric ? Android IOS
YES capitalize_android_fabric capitalize_ios_fabric_after
NO android_nf_after ios_nf_after

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Apr 13, 2022
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@GijsWeterings has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@react-native-bot react-native-bot added Bug Platform: iOS iOS applications. labels Apr 13, 2022
@analysis-bot
Copy link
Copy Markdown

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: e48a580
Branch: main

@analysis-bot
Copy link
Copy Markdown

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,770,592 -3,305
android hermes armeabi-v7a 7,176,570 -3,254
android hermes x86 8,079,755 -3,309
android hermes x86_64 8,058,386 -3,288
android jsc arm64-v8a 9,645,291 -1,696
android jsc armeabi-v7a 8,419,651 -1,654
android jsc x86 9,594,507 -1,703
android jsc x86_64 10,191,922 -1,682

Base commit: e48a580
Branch: main

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @MaeIg in db284ae.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Apr 22, 2022
@MaeIg MaeIg deleted the fix-capitalize-on-ios-with-fabric branch April 23, 2022 23:40
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2023
…ok#33629)

Summary:
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

Few month ago, I created a [pull request](facebook#32774) to unify the behavior of capitalize style between Android and IOS.

But, I found out that it doesn't work when fabric is enabled. We have the old behavior :
| Android | IOS |
| ------------- | ------------- |
| <img width="458" alt="capitalize_android_fabric" src="https://user-images.githubusercontent.com/40902940/163182082-4061003c-230b-46f7-9e93-c34b66dbf3d2.png"> | <img width="476" alt="capitalize_ios_fabric" src="https://user-images.githubusercontent.com/40902940/163182124-b6dee450-46e3-41a3-b5bb-553d7c2662e6.png"> |
(source: rn-tester, last commit: dac56ce)

As fabric is now live since v0.68, we should fix this behavior for fabric aswell.

I don't know why there is so much duplicated code between `ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm` and `Libraries/Text/RCTTextAttributes.m` because I don't know the architecture of the project very well. But if you see missing tests or some refacto to do I'm open to suggestions!

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Don't capitalize the first letter of a word that is starting by a number (Fabric renderer)

Pull Request resolved: facebook#33629

Test Plan:
I manually tested these changes on rn-tester (react-native `main` branch):
| Fabric ? | Android | IOS |
| ------------- | ------------- | ------------- |
| YES | <img width="458" alt="capitalize_android_fabric" src="https://user-images.githubusercontent.com/40902940/163182082-4061003c-230b-46f7-9e93-c34b66dbf3d2.png"> | <img width="476" alt="capitalize_ios_fabric_after" src="https://user-images.githubusercontent.com/40902940/163184277-6c58c117-7144-4f6b-98ea-0c1db654f27b.png"> |
| NO | <img width="458" alt="android_nf_after" src="https://user-images.githubusercontent.com/40902940/163190263-9d801f6a-09c2-4ec6-a841-3dca115a5ef7.png"> | <img width="476" alt="ios_nf_after" src="https://user-images.githubusercontent.com/40902940/163190333-7e9eac6a-3f28-4826-8ef9-bcf45bf870a9.png"> |

Reviewed By: cortinico

Differential Revision: D35611086

Pulled By: GijsWeterings

fbshipit-source-id: 0c43807dcddb30e65921eb1525c0fe440162ec32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants