Skip to content

Commit

Permalink
Android textTransform style support (#20572)
Browse files Browse the repository at this point in the history
Summary:
Issue facebook/react-native#2088 (closed, but a bit pre-emptively imo, since Android support was skipped)

Related (merged) iOS PR facebook/react-native#18387

Related documentation PR facebook/react-native-website#500

The basic desire is to have a declarative mechanism to transform text content to uppercase or lowercase or titlecase ("capitalized").
Pull Request resolved: facebook/react-native#20572

Differential Revision: D9311716

Pulled By: hramos

fbshipit-source-id: dfbb855117196958e7ae5e980700d31be07a448d
  • Loading branch information
Stephen Cook authored and facebook-github-bot committed Aug 14, 2018
1 parent c7e6695 commit e90bbd2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions js/TextExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,56 @@ class TextExample extends React.Component<{}> {
make text look slightly misaligned when centered vertically.
</Text>
</RNTesterBlock>
<RNTesterBlock title="Text transform">
<Text style={{textTransform: 'uppercase'}}>
This text should be uppercased.
</Text>
<Text style={{textTransform: 'lowercase'}}>
This TEXT SHOULD be lowercased.
</Text>
<Text style={{textTransform: 'capitalize'}}>
This text should be CAPITALIZED.
</Text>
<Text style={{textTransform: 'capitalize'}}>
Mixed: <Text style={{textTransform: 'uppercase'}}>uppercase </Text>
<Text style={{textTransform: 'lowercase'}}>LoWeRcAsE </Text>
<Text style={{textTransform: 'capitalize'}}>
capitalize each word
</Text>
</Text>
<Text>
Should be "ABC":
<Text style={{textTransform: 'uppercase'}}>
a<Text>b</Text>c
</Text>
</Text>
<Text>
Should be "AbC":
<Text style={{textTransform: 'uppercase'}}>
a<Text style={{textTransform: 'none'}}>b</Text>c
</Text>
</Text>
<Text style={{textTransform: 'none'}}>
{
'.aa\tbb\t\tcc dd EE \r\nZZ I like to eat apples. \n中文éé 我喜欢吃苹果。awdawd '
}
</Text>
<Text style={{textTransform: 'uppercase'}}>
{
'.aa\tbb\t\tcc dd EE \r\nZZ I like to eat apples. \n中文éé 我喜欢吃苹果。awdawd '
}
</Text>
<Text style={{textTransform: 'lowercase'}}>
{
'.aa\tbb\t\tcc dd EE \r\nZZ I like to eat apples. \n中文éé 我喜欢吃苹果。awdawd '
}
</Text>
<Text style={{textTransform: 'capitalize'}}>
{
'.aa\tbb\t\tcc dd EE \r\nZZ I like to eat apples. \n中文éé 我喜欢吃苹果。awdawd '
}
</Text>
</RNTesterBlock>
</RNTesterPage>
);
}
Expand Down

0 comments on commit e90bbd2

Please sign in to comment.