@@ -15,7 +15,7 @@ const Platform = require('Platform');
1515var React = require ( 'react' ) ;
1616var createReactClass = require ( 'create-react-class' ) ;
1717var ReactNative = require ( 'react-native' ) ;
18- var { Image, Text, View, LayoutAnimation, Button} = ReactNative ;
18+ var { Image, Text, TextInput , View, LayoutAnimation, Button} = ReactNative ;
1919
2020type TextAlignExampleRTLState = { |
2121 isRTL : boolean ,
@@ -224,6 +224,70 @@ var AdjustingFontSize = createReactClass({
224224 } ,
225225} ) ;
226226
227+ class TextBaseLineLayoutExample extends React . Component < * , * > {
228+ render ( ) {
229+ var texts = [ ] ;
230+ for ( var i = 9 ; i >= 0 ; i -- ) {
231+ texts . push ( < Text key = { i } style = { { fontSize : 8 + i * 5 , backgroundColor : '#eee' } } > { i } </ Text > ) ;
232+ }
233+
234+ const marker = < View style = { { width : 20 , height : 20 , backgroundColor : 'gray' } } /> ;
235+ const subtitleStyle = { fontSize : 16 , marginTop : 8 , fontWeight : 'bold' } ;
236+
237+ return (
238+ < View >
239+ < Text style = { subtitleStyle } > { 'Nested <Text/>s:' } </ Text >
240+ < View style = { { flexDirection : 'row' , alignItems : 'baseline' } } >
241+ { marker }
242+ < Text >
243+ { texts }
244+ </ Text >
245+ { marker }
246+ </ View >
247+
248+ < Text style = { subtitleStyle } > { 'Array of <Text/>s in <View>:' } </ Text >
249+ < View style = { { flexDirection : 'row' , alignItems : 'baseline' } } >
250+ { marker }
251+ { texts }
252+ { marker }
253+ </ View >
254+
255+ < Text style = { subtitleStyle } > { 'Interleaving <View> and <Text>:' } </ Text >
256+ < View style = { { flexDirection : 'row' , alignItems : 'baseline' } } >
257+ { marker }
258+ < Text selectable = { true } >
259+ Some text.
260+ < View style = { { flexDirection : 'row' , alignItems : 'baseline' , backgroundColor : '#eee' } } >
261+ { marker }
262+ < Text > Text inside View.</ Text >
263+ { marker }
264+ </ View >
265+ </ Text >
266+ { marker }
267+ </ View >
268+
269+ < Text style = { subtitleStyle } > { '<TextInput/>:' } </ Text >
270+ < View style = { { flexDirection : 'row' , alignItems : 'baseline' } } >
271+ { marker }
272+ < TextInput style = { { margin : 0 , padding : 0 } } >
273+ { texts }
274+ </ TextInput >
275+ { marker }
276+ </ View >
277+
278+ < Text style = { subtitleStyle } > { '<TextInput multiline/>:' } </ Text >
279+ < View style = { { flexDirection : 'row' , alignItems : 'baseline' } } >
280+ { marker }
281+ < TextInput multiline = { true } style = { { margin : 0 , padding : 0 } } >
282+ { texts }
283+ </ TextInput >
284+ { marker }
285+ </ View >
286+ </ View >
287+ ) ;
288+ }
289+ }
290+
227291exports . title = '<Text>' ;
228292exports . description = 'Base component for rendering styled text.' ;
229293exports . displayName = 'TextExample' ;
@@ -780,4 +844,10 @@ exports.examples = [
780844 return < TextAlignRTLExample /> ;
781845 } ,
782846 } ,
847+ {
848+ title : 'Text `alignItems: \'baseline\'` style' ,
849+ render : function ( ) {
850+ return < TextBaseLineLayoutExample /> ;
851+ } ,
852+ } ,
783853] ;
0 commit comments