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

[0.57.4-0.57.8/0.58.6] using textTransform causes text to disappear on Android, but works on iOS #21966

Closed
3 tasks done
kristerkari opened this issue Oct 26, 2018 · 39 comments
Closed
3 tasks done
Labels
Bug Component: Text Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@kristerkari
Copy link

Environment

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
      Memory: 1.51 GB / 16.00 GB
      Shell: 2.7.1 - /usr/local/bin/fish
    Binaries:
      Node: 8.11.4 - /usr/local/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 6.4.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
      Android SDK:
        Build Tools: 23.0.1, 23.0.3, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0
        API Levels: 17, 18, 19, 21, 22, 23, 25, 26, 27
    IDEs:
      Android Studio: 3.1 AI-173.4670197
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728 
      react-native: 0.57.4 => 0.57.4 

Description

React Native 0.57.4 brings support for using textTransform style property on Android. When setting textTransform value to uppercase, lowercase or capitalize the text is not shown at all on Android, but is shown correctly on iOS.

If the textTransform property is removed, then the text renders normally.

This can be easily reproduced by creating a new React Native project and setting the textTransform property to one of the texts inside App.js.

Screenshots:

iOS simulator (iPhone 8 / iOS 12):

ios

Android emulator (Nexus 5X / Android 5.0):

android5

Android emulator (Nexus 5X / Android 8.0):

android8

Reproducible Demo

Have a look at the demo that is a new 0.57.4 project with textTransform added to the welcome text.
https://github.com/kristerkari/react-native-text-transform-issue/blob/master/App.js#L43

@react-native-bot react-native-bot added Platform: iOS iOS applications. Platform: Android Android applications. 🔶Components labels Oct 26, 2018
@ziyafenn
Copy link

ziyafenn commented Nov 8, 2018

Enabling textTransform on android with RN0.57.4 breaks the styling of the text and renders the text very weirdly.

@kristerkari
Copy link
Author

I tested with React Native 0.57.5, and the bug is still reproducible.

@kristerkari kristerkari changed the title [0.57.4] using textTransform causes text to disappear on Android, but works on iOS [0.57.4-0.57.5] using textTransform causes text to disappear on Android, but works on iOS Nov 13, 2018
@marlosirapuan
Copy link

marlosirapuan commented Nov 21, 2018

same here.. "react-native": "0.57.4" : (

with textTransform: 'uppercase'
screen shot 2018-11-21 at 17 50 51

without
screen shot 2018-11-21 at 17 51 48

@ghost
Copy link

ghost commented Nov 23, 2018

reproducible on react-native 0.58-rc.0

@gbfeliped
Copy link

same as here
react-native-cli: 2.0.1
react-native: 0.57.4

@harveyconnor
Copy link

I have the text displaying however it isn't applying my color styling to it.

@estevaolucas
Copy link

I noticed something weird: If the text has some (any) emoji, the text appears.

@riso
Copy link

riso commented Dec 5, 2018

Can reproduce this on react-native 0.57.7 as well

@n1ru4l
Copy link
Contributor

n1ru4l commented Dec 7, 2018

Seems like this issue was introduced in 22cf5dc (#20572)

@sumitjr
Copy link

sumitjr commented Dec 11, 2018

experiencing the same issue in react-native 0.57.5

@kristerkari kristerkari changed the title [0.57.4-0.57.5] using textTransform causes text to disappear on Android, but works on iOS [0.57.4-0.57.7/0.58.0-rc.1] using textTransform causes text to disappear on Android, but works on iOS Dec 11, 2018
@aamalric
Copy link
Contributor

Same here !
react-native-cli: 2.0.1
react-native: 0.57.4

@kelset
Copy link
Contributor

kelset commented Dec 12, 2018

Is this reproducible on master?

@kelset kelset removed the Platform: iOS iOS applications. label Dec 12, 2018
@soutot
Copy link

soutot commented Dec 13, 2018

I'm facing the same issue ATM. On iOS textTransform works fine, but it disappears on Android.

RN 0.57.7

A workaround for now is using JS to capitalize the string

capitalizeString = (text: string) => typeof text === 'string' && text.length > 0 && `${text[0].toUpperCase()}${text.slice(1)}`

capitalizeString('mystring') 

@kristerkari kristerkari changed the title [0.57.4-0.57.7/0.58.0-rc.1] using textTransform causes text to disappear on Android, but works on iOS [0.57.4-0.57.8/0.58.0-rc.1] using textTransform causes text to disappear on Android, but works on iOS Dec 16, 2018
@kristerkari
Copy link
Author

Still reproducible with 0.57.8

@Surbhiairan
Copy link

Any Update on this issue?

@kristerkari
Copy link
Author

Any Update on this issue?

There is a pull request that should fix the bug: #22670

DesmanLead added a commit to SoftwareCountry/arcadian-assistant that referenced this issue Dec 24, 2018
facebook/react-native#21966
textTransform doesn’t work properly on the latest React Native version.
@MrLoh
Copy link

MrLoh commented Jan 12, 2019

Will f6f8b09 be part of the next RC, would be great to get a version with the fix.

@kristerkari
Copy link
Author

Still reproducible with v0.58.4

@sryze
Copy link
Contributor

sryze commented Feb 7, 2019

I'm using this function as a workraound, perhaps it could be useful to somebody

@kristerkari
Copy link
Author

Looks like this is finally fixed in React Native 0.59.0-rc.0 and the fix is most likely going to be part of the 0.59.0 release.

@hbaseline
Copy link

I noticed something weird: If the text has some (any) emoji, the text appears.

Boss: Why is there emoji?
Me: Ho that? it’s a bug fix.

@arnotixe
Copy link

Reproducible on 0.58.5… I'm using string.toUpperCase() as workaround

@trane294
Copy link

Confirming. Still happens on 0.58.5

@akhilsanker
Copy link

Anyone have any workaround to solve this bug?
Any suggestion is appreciable.

Thanks

@kristerkari kristerkari changed the title [0.57.4-0.57.8/0.58.4] using textTransform causes text to disappear on Android, but works on iOS [0.57.4-0.57.8/0.58.6] using textTransform causes text to disappear on Android, but works on iOS Feb 28, 2019
@MrLoh
Copy link

MrLoh commented Mar 1, 2019

Wait for 0.59 to use text-transform

@reddeguzman
Copy link

User upperCase from Lodash instead

@reddeguzman
Copy link

does not fix the RN issue but fixes your problem

flsilva added a commit to reflex-ui/reflex-ui that referenced this issue Mar 11, 2019
…d bug to be fixed. it seems it's fixed already but not released yet, should be released soon. issue: facebook/react-native#21966
@arthurjosse
Copy link

react-native 0.59.0
textTransform:"uppercase" on Text still not working...

@kelset
Copy link
Contributor

kelset commented Mar 12, 2019

0.59.0 is released, @kristerkari is it finally fixed, as you mentioned here?

@kristerkari
Copy link
Author

is it finally fixed, as you mentioned here?

I will re-test 👍

@kristerkari
Copy link
Author

I created a fresh 0.59.0 project, added some styling, and it seems to me that the bug is now fixed:

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#F5FCFF"
  },
  welcome: {
    fontSize: 48,
    textAlign: "center",
    margin: 10,
    color: "red",
    lineHeight: 60,
    textTransform: "lowercase"
  },
  instructions: {
    textAlign: "center",
    marginBottom: 5,
    lineHeight: 20,
    color: "green",
    textTransform: "uppercase"
  }
});

Skärmavbild 2019-03-12 kl  20 11 59

Skärmavbild 2019-03-12 kl  20 13 17

Skärmavbild 2019-03-12 kl  20 12 01

@kristerkari
Copy link
Author

textTransform: "capitalize" is working too:
Skärmavbild 2019-03-12 kl  20 38 42

@kelset
Copy link
Contributor

kelset commented Mar 13, 2019

Great, thanks @kristerkari!

@kelset kelset closed this as completed Mar 13, 2019
@sboudouk
Copy link

Thanks, also works for me.

@marlosirapuan
Copy link

100%! thank you!

@Nayan014
Copy link

Nayan014 commented Oct 31, 2019

What I found is textTransform: "uppercase" will WORK.
textTransform: 'uppercase' will NOT work.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 13, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: Text Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests