2015-01-30 01:10:49 +00:00
/ * *
2017-05-06 03:50:47 +00:00
* Copyright ( c ) 2015 - present , Facebook , Inc .
2016-05-17 17:31:07 +00:00
* All rights reserved .
*
* This source code is licensed under the BSD - style license found in the
* LICENSE file in the root directory of this source tree . An additional grant
* of patent rights can be found in the PATENTS file in the same directory .
*
2015-03-23 22:07:33 +00:00
* @ flow
2017-02-25 11:05:32 +00:00
* @ providesModule TextExample
2015-01-30 01:10:49 +00:00
* /
'use strict' ;
2016-12-19 14:26:07 +00:00
const Platform = require ( 'Platform' ) ;
2016-04-09 03:36:40 +00:00
var React = require ( 'react' ) ;
2017-07-07 21:24:25 +00:00
var createReactClass = require ( 'create-react-class' ) ;
2016-04-09 03:36:40 +00:00
var ReactNative = require ( 'react-native' ) ;
2017-10-03 19:54:50 +00:00
var { Image , Text , View , LayoutAnimation , Button } = ReactNative ;
type TextAlignExampleRTLState = { |
isRTL : boolean ,
| } ;
class TextAlignRTLExample extends React . Component < * , TextAlignExampleRTLState > {
constructor ( ... args : Array < * > ) {
super ( ... args ) ;
this . state = {
isRTL : false ,
} ;
}
render ( ) {
const { isRTL } = this . state ;
const toggleRTL = ( ) => this . setState ( { isRTL : ! isRTL } ) ;
return (
< View style = { { direction : isRTL ? 'rtl' : 'ltr' } } >
< Text > auto ( default ) - english LTR < / T e x t >
< Text >
{ '\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 ' +
'\u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic RTL' }
< / T e x t >
< Text style = { { textAlign : 'left' } } >
left left left left left left left left left left left left left left
left
< / T e x t >
< Text style = { { textAlign : 'center' } } >
center center center center center center center center center center
center
< / T e x t >
< Text style = { { textAlign : 'right' } } >
right right right right right right right right right right right
right right
< / T e x t >
< Text style = { { textAlign : 'justify' } } >
justify : this text component { "'" } s contents are laid out with
"textAlign: justify" and as you can see all of the lines except the
last one span the available width of the parent container .
< / T e x t >
< Button
onPress = { toggleRTL }
title = { ` Switch to ${ isRTL ? 'LTR' : 'RTL' } ` }
/ >
< / V i e w >
) ;
}
}
2015-01-30 01:10:49 +00:00
2017-08-18 01:36:54 +00:00
class Entity extends React . Component < $FlowFixMeProps > {
2016-07-26 08:00:02 +00:00
render ( ) {
2015-01-30 01:10:49 +00:00
return (
2015-06-17 12:37:20 +00:00
< Text style = { { fontWeight : '500' , color : '#527fe4' } } >
2015-01-30 01:10:49 +00:00
{ this . props . children }
< / T e x t >
) ;
}
2016-07-26 08:00:02 +00:00
}
2015-01-30 01:10:49 +00:00
2017-08-18 01:36:54 +00:00
class AttributeToggler extends React . Component < { } , $FlowFixMeState > {
2016-07-26 08:00:02 +00:00
state = { fontWeight : 'bold' , fontSize : 15 } ;
toggleWeight = ( ) => {
2015-06-17 12:37:20 +00:00
this . setState ( {
2017-10-03 19:54:50 +00:00
fontWeight : this . state . fontWeight === 'bold' ? 'normal' : 'bold' ,
2015-06-17 12:37:20 +00:00
} ) ;
2016-07-26 08:00:02 +00:00
} ;
increaseSize = ( ) => {
2015-01-30 01:10:49 +00:00
this . setState ( {
2017-10-03 19:54:50 +00:00
fontSize : this . state . fontSize + 1 ,
2015-01-30 01:10:49 +00:00
} ) ;
2016-07-26 08:00:02 +00:00
} ;
render ( ) {
2017-10-03 19:54:50 +00:00
var curStyle = {
fontWeight : this . state . fontWeight ,
fontSize : this . state . fontSize ,
} ;
2015-01-30 01:10:49 +00:00
return (
2015-06-17 12:37:20 +00:00
< View >
2015-01-30 01:10:49 +00:00
< Text style = { curStyle } >
Tap the controls below to change attributes .
< / T e x t >
< Text >
2017-10-03 19:54:50 +00:00
< Text >
See how it will even work on { ' ' }
< Text style = { curStyle } > this nested text < / T e x t >
< / T e x t >
2015-01-30 01:10:49 +00:00
< / T e x t >
2015-06-17 12:37:20 +00:00
< Text
style = { { backgroundColor : '#ffaaaa' , marginTop : 5 } }
onPress = { this . toggleWeight } >
Toggle Weight
< / T e x t >
< Text
style = { { backgroundColor : '#aaaaff' , marginTop : 5 } }
onPress = { this . increaseSize } >
Increase Size
< / T e x t >
< / V i e w >
2015-01-30 01:10:49 +00:00
) ;
}
2016-07-26 08:00:02 +00:00
}
2015-01-30 01:10:49 +00:00
2017-07-07 21:24:25 +00:00
var AdjustingFontSize = createReactClass ( {
displayName : 'AdjustingFontSize' ,
2016-08-10 18:14:36 +00:00
getInitialState : function ( ) {
2017-10-03 19:54:50 +00:00
return { dynamicText : '' , shouldRender : true } ;
2016-08-10 18:14:36 +00:00
} ,
reset : function ( ) {
LayoutAnimation . easeInEaseOut ( ) ;
this . setState ( {
shouldRender : false ,
} ) ;
2017-10-03 19:54:50 +00:00
setTimeout ( ( ) => {
2016-08-10 18:14:36 +00:00
LayoutAnimation . easeInEaseOut ( ) ;
this . setState ( {
dynamicText : '' ,
shouldRender : true ,
} ) ;
} , 300 ) ;
} ,
addText : function ( ) {
this . setState ( {
2017-10-03 19:54:50 +00:00
dynamicText :
this . state . dynamicText +
( Math . floor ( ( Math . random ( ) * 10 ) % 2 ) ? ' foo' : ' bar' ) ,
2016-08-10 18:14:36 +00:00
} ) ;
} ,
removeText : function ( ) {
this . setState ( {
2017-10-03 19:54:50 +00:00
dynamicText : this . state . dynamicText . slice (
0 ,
this . state . dynamicText . length - 4 ,
) ,
2016-08-10 18:14:36 +00:00
} ) ;
} ,
render : function ( ) {
if ( ! this . state . shouldRender ) {
2017-10-03 19:54:50 +00:00
return < View / > ;
2016-08-10 18:14:36 +00:00
}
return (
< View >
2017-10-03 19:54:50 +00:00
< Text
ellipsizeMode = "tail"
numberOfLines = { 1 }
style = { { fontSize : 36 , marginVertical : 6 } } >
2016-08-10 18:14:36 +00:00
Truncated text is baaaaad .
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text
numberOfLines = { 1 }
adjustsFontSizeToFit = { true }
style = { { fontSize : 40 , marginVertical : 6 } } >
2016-08-10 18:14:36 +00:00
Shrinking to fit available space is much better !
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text
adjustsFontSizeToFit = { true }
numberOfLines = { 1 }
style = { { fontSize : 30 , marginVertical : 6 } } >
{ 'Add text to me to watch me shrink!' + ' ' + this . state . dynamicText }
2016-08-10 18:14:36 +00:00
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text
adjustsFontSizeToFit = { true }
numberOfLines = { 4 }
style = { { fontSize : 20 , marginVertical : 6 } } >
{ 'Multiline text component shrinking is supported, watch as this reeeeaaaally loooooong teeeeeeext grooooows and then shriiiinks as you add text to me! ioahsdia soady auydoa aoisyd aosdy ' +
' ' +
this . state . dynamicText }
2016-08-10 18:14:36 +00:00
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text
adjustsFontSizeToFit = { true }
numberOfLines = { 1 }
style = { { marginVertical : 6 } } >
< Text style = { { fontSize : 14 } } >
2016-08-10 18:14:36 +00:00
{ 'Differently sized nested elements will shrink together. ' }
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text style = { { fontSize : 20 } } >
2016-08-10 18:14:36 +00:00
{ 'LARGE TEXT! ' + this . state . dynamicText }
< / T e x t >
< / T e x t >
2017-10-03 19:54:50 +00:00
< View
style = { {
flexDirection : 'row' ,
justifyContent : 'space-around' ,
marginTop : 5 ,
marginVertical : 6 ,
} } >
< Text style = { { backgroundColor : '#ffaaaa' } } onPress = { this . reset } >
2016-08-10 18:14:36 +00:00
Reset
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text style = { { backgroundColor : '#aaaaff' } } onPress = { this . removeText } >
2016-08-10 18:14:36 +00:00
Remove Text
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text style = { { backgroundColor : '#aaffaa' } } onPress = { this . addText } >
2016-08-10 18:14:36 +00:00
Add Text
< / T e x t >
< / V i e w >
< / V i e w >
) ;
2017-10-03 19:54:50 +00:00
} ,
2016-08-10 18:14:36 +00:00
} ) ;
2015-01-30 01:10:49 +00:00
exports . title = '<Text>' ;
exports . description = 'Base component for rendering styled text.' ;
2015-03-25 17:16:19 +00:00
exports . displayName = 'TextExample' ;
2015-01-30 01:10:49 +00:00
exports . examples = [
2017-10-03 19:54:50 +00:00
{
title : 'Wrap' ,
render : function ( ) {
return (
< Text >
The text should wrap if it goes on multiple lines . See , this is going
to the next line .
< / T e x t >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Padding' ,
render : function ( ) {
return (
< Text style = { { padding : 10 } } >
This text is indented by 10 px padding on all sides .
< / T e x t >
) ;
} ,
2015-03-31 03:12:32 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Font Family' ,
render : function ( ) {
return (
< View >
< Text style = { { fontFamily : Platform . isTVOS ? 'Times' : 'Cochin' } } >
Cochin
< / T e x t >
< Text
style = { {
fontFamily : Platform . isTVOS ? 'Times' : 'Cochin' ,
fontWeight : 'bold' ,
} } >
Cochin bold
< / T e x t >
< Text style = { { fontFamily : 'Helvetica' } } > Helvetica < / T e x t >
< Text style = { { fontFamily : 'Helvetica' , fontWeight : 'bold' } } >
Helvetica bold
< / T e x t >
< Text style = { { fontFamily : Platform . isTVOS ? 'Courier' : 'Verdana' } } >
Verdana
< / T e x t >
< Text
style = { {
fontFamily : Platform . isTVOS ? 'Courier' : 'Verdana' ,
fontWeight : 'bold' ,
} } >
Verdana bold
< / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Font Size' ,
render : function ( ) {
return (
< View >
< Text style = { { fontSize : 23 } } > Size 23 < / T e x t >
< Text style = { { fontSize : 8 } } > Size 8 < / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Color' ,
render : function ( ) {
return (
< View >
< Text style = { { color : 'red' } } > Red color < / T e x t >
< Text style = { { color : 'blue' } } > Blue color < / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Font Weight' ,
render : function ( ) {
return (
< View >
< Text style = { { fontSize : 20 , fontWeight : '100' } } >
Move fast and be ultralight
< / T e x t >
< Text style = { { fontSize : 20 , fontWeight : '200' } } >
Move fast and be light
< / T e x t >
< Text style = { { fontSize : 20 , fontWeight : 'normal' } } >
Move fast and be normal
< / T e x t >
< Text style = { { fontSize : 20 , fontWeight : 'bold' } } >
Move fast and be bold
< / T e x t >
< Text style = { { fontSize : 20 , fontWeight : '900' } } >
Move fast and be ultrabold
< / T e x t >
< / V i e w >
) ;
} ,
2015-03-26 01:19:28 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Font Style' ,
render : function ( ) {
return (
< View >
< Text style = { { fontStyle : 'normal' } } > Normal text < / T e x t >
< Text style = { { fontStyle : 'italic' } } > Italic text < / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Selectable' ,
render : function ( ) {
return (
< View >
< Text selectable = { true } >
This text is < Text style = { { fontWeight : 'bold' } } > selectable < / T e x t > i f
you click - and - hold .
< / T e x t >
< / V i e w >
) ;
} ,
2016-11-18 00:09:43 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Text Decoration' ,
render : function ( ) {
return (
< View >
< Text
style = { {
textDecorationLine : 'underline' ,
textDecorationStyle : 'solid' ,
} } >
Solid underline
< / T e x t >
< Text
style = { {
textDecorationLine : 'underline' ,
textDecorationStyle : 'double' ,
textDecorationColor : '#ff0000' ,
} } >
Double underline with custom color
< / T e x t >
< Text
style = { {
textDecorationLine : 'underline' ,
textDecorationStyle : 'dashed' ,
textDecorationColor : '#9CDC40' ,
} } >
Dashed underline with custom color
< / T e x t >
< Text
style = { {
textDecorationLine : 'underline' ,
textDecorationStyle : 'dotted' ,
textDecorationColor : 'blue' ,
} } >
Dotted underline with custom color
< / T e x t >
< Text style = { { textDecorationLine : 'none' } } > None textDecoration < / T e x t >
< Text
style = { {
textDecorationLine : 'line-through' ,
textDecorationStyle : 'solid' ,
} } >
Solid line - through
< / T e x t >
< Text
style = { {
textDecorationLine : 'line-through' ,
textDecorationStyle : 'double' ,
textDecorationColor : '#ff0000' ,
} } >
Double line - through with custom color
< / T e x t >
< Text
style = { {
textDecorationLine : 'line-through' ,
textDecorationStyle : 'dashed' ,
textDecorationColor : '#9CDC40' ,
} } >
Dashed line - through with custom color
< / T e x t >
< Text
style = { {
textDecorationLine : 'line-through' ,
textDecorationStyle : 'dotted' ,
textDecorationColor : 'blue' ,
} } >
Dotted line - through with custom color
< / T e x t >
< Text style = { { textDecorationLine : 'underline line-through' } } >
Both underline and line - through
< / T e x t >
< / V i e w >
) ;
} ,
2015-07-07 13:03:56 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Nested' ,
description :
'Nested text components will inherit the styles of their ' +
'parents (only backgroundColor is inherited from non-Text parents). ' +
'<Text> only supports other <Text> and raw text (strings) as children.' ,
render : function ( ) {
return (
< View >
< Text >
( Normal text ,
< Text style = { { fontWeight : 'bold' } } >
( and bold
< Text style = { { fontSize : 11 , color : '#527fe4' } } >
( and tiny inherited bold blue )
< / T e x t >
)
2015-01-30 01:10:49 +00:00
< / T e x t >
2015-11-04 16:52:58 +00:00
)
2015-11-04 16:52:46 +00:00
< / T e x t >
2017-10-03 19:54:50 +00:00
< Text style = { { opacity : 0.7 } } >
( opacity
2015-11-04 16:52:58 +00:00
< Text >
( is inherited
2017-10-03 19:54:50 +00:00
< Text style = { { opacity : 0.7 } } >
( and accumulated
< Text style = { { backgroundColor : '#ffaaaa' } } >
( and also applies to the background )
2015-11-04 16:52:58 +00:00
< / T e x t >
2017-10-03 19:54:50 +00:00
)
< / T e x t >
2015-11-04 16:52:58 +00:00
)
< / T e x t >
2017-10-03 19:54:50 +00:00
)
< / T e x t >
< Text style = { { fontSize : 12 } } >
< Entity > Entity Name < / E n t i t y >
< / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Text Align' ,
render : function ( ) {
return (
< View >
< Text > auto ( default ) - english LTR < / T e x t >
< Text >
{ '\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 ' +
'\u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic ' +
'RTL' }
< / T e x t >
< Text style = { { textAlign : 'left' } } >
left left left left left left left left left left left left left
left left
< / T e x t >
< Text style = { { textAlign : 'center' } } >
center center center center center center center center center
center center
< / T e x t >
< Text style = { { textAlign : 'right' } } >
right right right right right right right right right right right
right right
< / T e x t >
< Text style = { { textAlign : 'justify' } } >
justify : this text component { "'" } s contents are laid out with
"textAlign: justify" and as you can see all of the lines except the
last one span the available width of the parent container .
< / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Letter Spacing' ,
render : function ( ) {
return (
< View >
< Text style = { { letterSpacing : 0 } } > letterSpacing = 0 < / T e x t >
< Text style = { { letterSpacing : 2 , marginTop : 5 } } >
letterSpacing = 2
< / T e x t >
< Text style = { { letterSpacing : 9 , marginTop : 5 } } >
letterSpacing = 9
< / T e x t >
< Text style = { { letterSpacing : - 1 , marginTop : 5 } } >
letterSpacing = - 1
< / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Spaces' ,
render : function ( ) {
return (
< Text >
A { 'generated' } { ' ' } { 'string' } and some & nbsp ; & nbsp ; & nbsp ; spaces
< / T e x t >
) ;
} ,
2017-10-02 18:03:00 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Line Height' ,
render : function ( ) {
return (
< Text >
< Text style = { { lineHeight : 35 } } >
A lot of space between the lines of this long passage that should
wrap once .
< / T e x t >
2017-10-02 19:12:10 +00:00
< / T e x t >
2017-10-03 19:54:50 +00:00
) ;
} ,
2017-10-02 19:12:10 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Empty Text' ,
description : "It's ok to have Text with zero or null children." ,
render : function ( ) {
return < Text / > ;
} ,
2017-10-02 19:12:10 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Toggling Attributes' ,
render : function ( ) : React . Element < any > {
return < AttributeToggler / > ;
} ,
2017-10-02 19:12:10 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'backgroundColor attribute' ,
description : 'backgroundColor is inherited from all types of views.' ,
render : function ( ) {
return (
< Text style = { { backgroundColor : 'yellow' } } >
Yellow container background ,
< Text style = { { backgroundColor : '#ffaaaa' } } >
{ ' ' }
red background ,
< Text style = { { backgroundColor : '#aaaaff' } } >
{ ' ' }
blue background ,
< Text >
{ ' ' }
inherited blue background ,
< Text style = { { backgroundColor : '#aaffaa' } } >
{ ' ' }
nested green background .
< / T e x t >
2015-01-30 01:10:49 +00:00
< / T e x t >
< / T e x t >
< / T e x t >
< / T e x t >
2017-10-03 19:54:50 +00:00
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'numberOfLines attribute' ,
render : function ( ) {
return (
< View >
< Text numberOfLines = { 1 } >
Maximum of one line , no matter how much I write here . If I keep
writing , it { "'" } ll just truncate after one line .
< / T e x t >
< Text numberOfLines = { 2 } style = { { marginTop : 20 } } >
Maximum of two lines , no matter how much I write here . If I keep
writing , it { "'" } ll just truncate after two lines .
< / T e x t >
< Text style = { { marginTop : 20 } } >
No maximum lines specified , no matter how much I write here . If I
keep writing , it { "'" } ll just keep going and going .
< / T e x t >
< / V i e w >
) ;
} ,
2015-01-30 01:10:49 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Text highlighting (tap the link to see highlight)' ,
render : function ( ) {
return (
< View >
< Text >
Lorem ipsum dolor sit amet , { ' ' }
< Text
suppressHighlighting = { false }
style = { {
backgroundColor : 'white' ,
textDecorationLine : 'underline' ,
color : 'blue' ,
} }
onPress = { ( ) => null } >
consectetur adipiscing elit , sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua . Ut enim ad minim veniam , quis
nostrud
< / T e x t > { ' ' }
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat .
< / T e x t >
< / V i e w >
) ;
} ,
2015-07-24 15:25:51 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'allowFontScaling attribute' ,
render : function ( ) {
return (
< View >
< Text >
By default , text will respect Text Size accessibility setting on
iOS . It means that all font sizes will be increased or descreased
depending on the value of Text Size setting in { ' ' }
< Text style = { { fontWeight : 'bold' } } >
Settings . app - Display & Brightness - Text Size
< / T e x t >
< / T e x t >
< Text style = { { marginTop : 10 } } >
You can disable scaling for your Text component by passing { '"' } allowFontScaling = { '{' } false { '}"' } { ' ' }
prop .
< / T e x t >
< Text allowFontScaling = { false } style = { { marginTop : 20 } } >
This text will not scale .
< / T e x t >
< / V i e w >
) ;
} ,
2015-07-31 14:37:12 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Inline views' ,
render : function ( ) {
return (
< View >
< Text >
This text contains an inline blue view { ' ' }
< View
style = { { width : 25 , height : 25 , backgroundColor : 'steelblue' } }
/ > { ' ' }
and an inline image { ' ' }
< Image
source = { require ( './flux.png' ) }
style = { { width : 30 , height : 11 , resizeMode : 'cover' } }
/ > . N e a t , h u h ?
< / T e x t >
< / V i e w >
) ;
} ,
2015-10-08 18:32:11 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Text shadow' ,
render : function ( ) {
return (
< View >
< Text
style = { {
fontSize : 20 ,
textShadowOffset : { width : 2 , height : 2 } ,
textShadowRadius : 1 ,
textShadowColor : '#00cccc' ,
} } >
Demo text shadow
< / T e x t >
< / V i e w >
) ;
} ,
2016-01-01 17:32:59 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Ellipsize mode' ,
render : function ( ) {
return (
< View >
< Text numberOfLines = { 1 } >
This very long text should be truncated with dots in the end .
< / T e x t >
< Text ellipsizeMode = "middle" numberOfLines = { 1 } >
This very long text should be truncated with dots in the middle .
< / T e x t >
< Text ellipsizeMode = "head" numberOfLines = { 1 } >
This very long text should be truncated with dots in the beginning .
< / T e x t >
< Text ellipsizeMode = "clip" numberOfLines = { 1 } >
This very looooooooooooooooooooooooooooong text should be clipped .
< / T e x t >
< / V i e w >
) ;
} ,
2016-06-10 11:26:45 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Font variants' ,
render : function ( ) {
return (
< View >
< Text style = { { fontVariant : [ 'small-caps' ] } } > Small Caps { '\n' } < / T e x t >
< Text
style = { {
fontFamily : Platform . isTVOS ? 'Times' : 'Hoefler Text' ,
fontVariant : [ 'oldstyle-nums' ] ,
} } >
Old Style nums 0123456789 { '\n' }
< / T e x t >
< Text
style = { {
fontFamily : Platform . isTVOS ? 'Times' : 'Hoefler Text' ,
fontVariant : [ 'lining-nums' ] ,
} } >
Lining nums 0123456789 { '\n' }
< / T e x t >
< Text style = { { fontVariant : [ 'tabular-nums' ] } } >
Tabular nums { '\n' }
1111 { '\n' }
2222 { '\n' }
< / T e x t >
< Text style = { { fontVariant : [ 'proportional-nums' ] } } >
Proportional nums { '\n' }
1111 { '\n' }
2222 { '\n' }
< / T e x t >
< / V i e w >
) ;
} ,
} ,
{
title : 'Dynamic Font Size Adjustment' ,
render : function ( ) : React . Element < any > {
return < AdjustingFontSize / > ;
} ,
2016-08-09 15:42:58 +00:00
} ,
2017-10-03 19:54:50 +00:00
{
title : 'Text Align with RTL' ,
render : function ( ) {
return < TextAlignRTLExample / > ;
} ,
2016-08-10 18:14:36 +00:00
} ,
2017-10-03 19:54:50 +00:00
] ;