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

Inconsistent text-transform: capitalize behaviour #7059

Closed
lambourn opened this issue Mar 22, 2019 · 3 comments · Fixed by #9598
Closed

Inconsistent text-transform: capitalize behaviour #7059

lambourn opened this issue Mar 22, 2019 · 3 comments · Fixed by #9598

Comments

@lambourn
Copy link

@lambourn lambourn commented Mar 22, 2019

Environment

  • CLI: 5.2
  • Cross-platform modules: 5.2.2
  • Android Runtime: 5.2.0
  • iOS Runtime: 5.2.1

Describe the bug

When using text-transform: capitalize on label/text/button/etc. UI elements, the behaviour on iOS and Android inconsistent and wrong on Android.

On Android, the source string is split on " " (space) to get an array of words, then each word gets lower-cased(!), then the first character of each word gets upper-cased.

On iOS, a platform native function is used which which uses a different/hidden implementation.

To Reproduce

<Label text="this is kind-Of-Magic - or a bUG?" style="text-transform: capitalize"></Label>

This produces

  • on iOS: This Is Kind-Of-Magic - Or A Bug?
  • on Android: This Is Kind-of-magic - Or A Bug?

Expected behavior
I would expect the display of This Is Kind-Of-Magic - Or A BUG?

Sample project
https://play.nativescript.org/?template=play-tsc&id=pb9SJ0&v=6


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@lambourn lambourn changed the title Incorrect text-transform: capitalize behaviour on Android Inconsistent text-transform: capitalize behaviour Mar 22, 2019
@NickIliev
Copy link
Member

@NickIliev NickIliev commented Mar 22, 2019

@lambourn marking this one as a bug as it looks like that the splitting words on Android is not cognitive enough to recognize different ones when a dash is used.

@lambourn
Copy link
Author

@lambourn lambourn commented Mar 22, 2019

@NickIliev agreed. Even the iOS implementation does not produce what I would expect as it also does automatic lower-case on the last word (Bug vs BUG) - but that's due to the underlying NSString implementation. But here I think the Android implementation should produce the same as on iOS.

@rickwalking
Copy link

@rickwalking rickwalking commented Oct 22, 2019

I'm currently working on it. Just having some issues with tests.

kinshukdua added a commit to kinshukdua/NativeScript that referenced this issue Oct 6, 2021
make it consistent for android and ios

fix NativeScript#7059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants