2015-09-14 14:35:58 +00:00
|
|
|
/**
|
2017-05-06 03:50:47 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
2016-07-12 12:51:57 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2016-07-12 12:51:57 +00:00
|
|
|
*
|
2018-05-11 20:32:37 +00:00
|
|
|
* @format
|
2015-09-14 14:35:58 +00:00
|
|
|
* @flow
|
|
|
|
*/
|
2018-05-11 20:32:37 +00:00
|
|
|
|
2015-09-14 14:35:58 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-04-09 03:36:40 +00:00
|
|
|
var React = require('react');
|
|
|
|
var ReactNative = require('react-native');
|
2018-05-11 20:32:37 +00:00
|
|
|
var {Image, StyleSheet, Text, View} = ReactNative;
|
2017-05-06 03:50:47 +00:00
|
|
|
var RNTesterBlock = require('./RNTesterBlock');
|
|
|
|
var RNTesterPage = require('./RNTesterPage');
|
2015-09-14 14:35:58 +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-09-14 14:35:58 +00:00
|
|
|
return (
|
|
|
|
<Text style={{fontWeight: 'bold', color: '#527fe4'}}>
|
|
|
|
{this.props.children}
|
|
|
|
</Text>
|
|
|
|
);
|
|
|
|
}
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
2015-09-14 14:35:58 +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-09-14 14:35:58 +00:00
|
|
|
this.setState({
|
2018-05-11 20:32:37 +00:00
|
|
|
fontWeight: this.state.fontWeight === 'bold' ? 'normal' : 'bold',
|
2015-09-14 14:35:58 +00:00
|
|
|
});
|
2016-07-26 08:00:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
increaseSize = () => {
|
2015-09-14 14:35:58 +00:00
|
|
|
this.setState({
|
2018-05-11 20:32:37 +00:00
|
|
|
fontSize: this.state.fontSize + 1,
|
2015-09-14 14:35:58 +00:00
|
|
|
});
|
2016-07-26 08:00:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2018-05-11 20:32:37 +00:00
|
|
|
var curStyle = {
|
|
|
|
fontWeight: this.state.fontWeight,
|
|
|
|
fontSize: this.state.fontSize,
|
|
|
|
};
|
2015-09-14 14:35:58 +00:00
|
|
|
return (
|
|
|
|
<View>
|
|
|
|
<Text style={curStyle}>
|
|
|
|
Tap the controls below to change attributes.
|
|
|
|
</Text>
|
|
|
|
<Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text>
|
|
|
|
See how it will even work on{' '}
|
|
|
|
<Text style={curStyle}>this nested text</Text>
|
|
|
|
</Text>
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
|
|
|
<Text>
|
|
|
|
<Text onPress={this.toggleWeight}>Toggle Weight</Text>
|
|
|
|
{' (with highlight onPress)'}
|
|
|
|
</Text>
|
|
|
|
<Text onPress={this.increaseSize} suppressHighlighting={true}>
|
|
|
|
Increase Size (suppressHighlighting true)
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
2015-09-14 14:35:58 +00:00
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class TextExample extends React.Component<{}> {
|
2016-07-26 08:00:02 +00:00
|
|
|
static title = '<Text>';
|
|
|
|
static description = 'Base component for rendering styled text.';
|
|
|
|
|
|
|
|
render() {
|
2015-09-14 14:35:58 +00:00
|
|
|
return (
|
2017-05-06 03:50:47 +00:00
|
|
|
<RNTesterPage title="<Text>">
|
|
|
|
<RNTesterBlock title="Wrap">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
The text should wrap if it goes on multiple lines. See, this is
|
|
|
|
going to the next line.
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Padding">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{padding: 10}}>
|
|
|
|
This text is indented by 10px padding on all sides.
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Font Family">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontFamily: 'sans-serif'}}>Sans-Serif</Text>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{fontFamily: 'sans-serif', fontWeight: 'bold'}}>
|
|
|
|
Sans-Serif Bold
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontFamily: 'serif'}}>Serif</Text>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{fontFamily: 'serif', fontWeight: 'bold'}}>
|
|
|
|
Serif Bold
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontFamily: 'monospace'}}>Monospace</Text>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{fontFamily: 'monospace', fontWeight: 'bold'}}>
|
|
|
|
Monospace Bold (After 5.0)
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Android Material Design fonts">
|
2015-09-14 14:35:58 +00:00
|
|
|
<View style={{flexDirection: 'row', alignItems: 'flex-start'}}>
|
|
|
|
<View style={{flex: 1}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontFamily: 'sans-serif'}}>Roboto Regular</Text>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{fontFamily: 'sans-serif', fontStyle: 'italic'}}>
|
|
|
|
Roboto Italic
|
|
|
|
</Text>
|
|
|
|
<Text style={{fontFamily: 'sans-serif', fontWeight: 'bold'}}>
|
|
|
|
Roboto Bold
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontFamily: 'sans-serif',
|
|
|
|
fontStyle: 'italic',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
Roboto Bold Italic
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontFamily: 'sans-serif-light'}}>Roboto Light</Text>
|
|
|
|
<Text
|
|
|
|
style={{fontFamily: 'sans-serif-light', fontStyle: 'italic'}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
Roboto Light Italic
|
|
|
|
</Text>
|
|
|
|
<Text style={{fontFamily: 'sans-serif-thin'}}>
|
|
|
|
Roboto Thin (After 4.2)
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontFamily: 'sans-serif-thin', fontStyle: 'italic'}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
Roboto Thin Italic (After 4.2)
|
|
|
|
</Text>
|
|
|
|
<Text style={{fontFamily: 'sans-serif-condensed'}}>
|
|
|
|
Roboto Condensed
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontFamily: 'sans-serif-condensed',
|
|
|
|
fontStyle: 'italic',
|
|
|
|
}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
Roboto Condensed Italic
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontFamily: 'sans-serif-condensed',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
Roboto Condensed Bold
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{
|
2015-09-14 14:35:58 +00:00
|
|
|
fontFamily: 'sans-serif-condensed',
|
|
|
|
fontStyle: 'italic',
|
2018-05-11 20:32:37 +00:00
|
|
|
fontWeight: 'bold',
|
|
|
|
}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
Roboto Condensed Bold Italic
|
|
|
|
</Text>
|
|
|
|
<Text style={{fontFamily: 'sans-serif-medium'}}>
|
|
|
|
Roboto Medium (After 5.0)
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontFamily: 'sans-serif-medium', fontStyle: 'italic'}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
Roboto Medium Italic (After 5.0)
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Custom Fonts">
|
2015-11-07 02:14:08 +00:00
|
|
|
<View style={{flexDirection: 'row', alignItems: 'flex-start'}}>
|
|
|
|
<View style={{flex: 1}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontFamily: 'notoserif'}}>NotoSerif Regular</Text>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontFamily: 'notoserif',
|
|
|
|
fontStyle: 'italic',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
}}>
|
2015-11-07 02:14:08 +00:00
|
|
|
NotoSerif Bold Italic
|
|
|
|
</Text>
|
|
|
|
<Text style={{fontFamily: 'notoserif', fontStyle: 'italic'}}>
|
|
|
|
NotoSerif Italic (Missing Font file)
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
2015-11-07 02:14:08 +00:00
|
|
|
|
2017-05-06 03:50:47 +00:00
|
|
|
<RNTesterBlock title="Font Size">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontSize: 23}}>Size 23</Text>
|
|
|
|
<Text style={{fontSize: 8}}>Size 8</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Color">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{color: 'red'}}>Red color</Text>
|
|
|
|
<Text style={{color: 'blue'}}>Blue color</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Font Weight">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontWeight: 'bold'}}>Move fast and be bold</Text>
|
|
|
|
<Text style={{fontWeight: 'normal'}}>Move fast and be bold</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Font Style">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{fontStyle: 'italic'}}>Move fast and be bold</Text>
|
|
|
|
<Text style={{fontStyle: 'normal'}}>Move fast and be bold</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Font Style and Weight">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{fontStyle: 'italic', fontWeight: 'bold'}}>
|
|
|
|
Move fast and be bold
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Text Decoration">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{textDecorationLine: 'underline'}}>Solid underline</Text>
|
|
|
|
<Text style={{textDecorationLine: 'none'}}>None textDecoration</Text>
|
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
textDecorationLine: 'line-through',
|
|
|
|
textDecorationStyle: 'solid',
|
|
|
|
}}>
|
2016-04-12 10:36:29 +00:00
|
|
|
Solid line-through
|
|
|
|
</Text>
|
|
|
|
<Text style={{textDecorationLine: 'underline line-through'}}>
|
|
|
|
Both underline and line-through
|
|
|
|
</Text>
|
|
|
|
<Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
Mixed text with{' '}
|
|
|
|
<Text style={{textDecorationLine: 'underline'}}>underline</Text> and{' '}
|
|
|
|
<Text style={{textDecorationLine: 'line-through'}}>
|
|
|
|
line-through
|
|
|
|
</Text>{' '}
|
|
|
|
text nodes
|
2016-04-12 10:36:29 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Nested">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text onPress={() => console.log('1st')}>
|
|
|
|
(Normal text,
|
2017-09-18 04:59:31 +00:00
|
|
|
<Text style={{color: 'red', fontWeight: 'bold'}}>
|
|
|
|
(R)red
|
|
|
|
<Text style={{color: 'green', fontWeight: 'normal'}}>
|
|
|
|
(G)green
|
|
|
|
<Text style={{color: 'blue', fontWeight: 'bold'}}>
|
|
|
|
(B)blue
|
|
|
|
<Text style={{color: 'cyan', fontWeight: 'normal'}}>
|
|
|
|
(C)cyan
|
|
|
|
<Text style={{color: 'magenta', fontWeight: 'bold'}}>
|
|
|
|
(M)magenta
|
|
|
|
<Text style={{color: 'yellow', fontWeight: 'normal'}}>
|
|
|
|
(Y)yellow
|
|
|
|
<Text style={{color: 'black', fontWeight: 'bold'}}>
|
|
|
|
(K)black
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontWeight: 'bold'}}
|
|
|
|
onPress={() => console.log('2nd')}>
|
2015-09-14 14:35:58 +00:00
|
|
|
(and bold
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontStyle: 'italic', fontSize: 11, color: '#527fe4'}}
|
|
|
|
onPress={() => console.log('3rd')}>
|
2015-09-14 14:35:58 +00:00
|
|
|
(and tiny bold italic blue
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontWeight: 'normal', fontStyle: 'normal'}}
|
|
|
|
onPress={() => console.log('4th')}>
|
2015-09-14 14:35:58 +00:00
|
|
|
(and tiny normal blue)
|
|
|
|
</Text>
|
|
|
|
)
|
|
|
|
</Text>
|
|
|
|
)
|
|
|
|
</Text>
|
|
|
|
)
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontFamily: 'serif'}}
|
|
|
|
onPress={() => console.log('1st')}>
|
2015-09-14 14:35:58 +00:00
|
|
|
(Serif
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontStyle: 'italic', fontWeight: 'bold'}}
|
|
|
|
onPress={() => console.log('2nd')}>
|
2015-09-14 14:35:58 +00:00
|
|
|
(Serif Bold Italic
|
|
|
|
<Text
|
2018-05-11 20:32:37 +00:00
|
|
|
style={{
|
|
|
|
fontFamily: 'monospace',
|
|
|
|
fontStyle: 'normal',
|
|
|
|
fontWeight: 'normal',
|
|
|
|
}}
|
2015-09-14 14:35:58 +00:00
|
|
|
onPress={() => console.log('3rd')}>
|
|
|
|
(Monospace Normal
|
|
|
|
<Text
|
|
|
|
style={{fontFamily: 'sans-serif', fontWeight: 'bold'}}
|
|
|
|
onPress={() => console.log('4th')}>
|
|
|
|
(Sans-Serif Bold
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{fontWeight: 'normal'}}
|
|
|
|
onPress={() => console.log('5th')}>
|
2015-09-14 14:35:58 +00:00
|
|
|
(and Sans-Serif Normal)
|
|
|
|
</Text>
|
|
|
|
)
|
|
|
|
</Text>
|
|
|
|
)
|
|
|
|
</Text>
|
|
|
|
)
|
|
|
|
</Text>
|
|
|
|
)
|
|
|
|
</Text>
|
|
|
|
<Text style={{fontSize: 12}}>
|
|
|
|
<Entity>Entity Name</Entity>
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Text Align">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text>auto (default) - english LTR</Text>
|
|
|
|
<Text>أحب اللغة العربية auto (default) - arabic RTL</Text>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{textAlign: 'left'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
left left left left left left left left left left left left left
|
|
|
|
left left
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
|
|
|
<Text style={{textAlign: 'center'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
center center center center center center center center center
|
|
|
|
center center
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
|
|
|
<Text style={{textAlign: 'right'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
right right right right right right right right right right right
|
|
|
|
right right
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Unicode">
|
2016-09-26 18:50:59 +00:00
|
|
|
<View>
|
2015-09-14 14:35:58 +00:00
|
|
|
<View style={{flexDirection: 'row'}}>
|
|
|
|
<Text style={{backgroundColor: 'red'}}>
|
|
|
|
星际争霸是世界上最好的游戏。
|
|
|
|
</Text>
|
|
|
|
</View>
|
2016-09-26 18:50:59 +00:00
|
|
|
<View>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{backgroundColor: 'red'}}>
|
|
|
|
星际争霸是世界上最好的游戏。
|
|
|
|
</Text>
|
|
|
|
</View>
|
2016-09-26 18:50:59 +00:00
|
|
|
<View style={{alignItems: 'center'}}>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{backgroundColor: 'red'}}>
|
|
|
|
星际争霸是世界上最好的游戏。
|
|
|
|
</Text>
|
|
|
|
</View>
|
2016-09-26 18:50:59 +00:00
|
|
|
<View>
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{backgroundColor: 'red'}}>
|
|
|
|
星际争霸是世界上最好的游戏。星际争霸是世界上最好的游戏。星际争霸是世界上最好的游戏。星际争霸是世界上最好的游戏。
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Spaces">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
A {'generated'} {'string'} and some spaces
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Line Height">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{lineHeight: 35}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
Holisticly formulate inexpensive ideas before best-of-breed
|
|
|
|
benefits. <Text style={{fontSize: 20}}>Continually</Text> expedite
|
|
|
|
magnetic potentialities rather than client-focused interfaces.
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
Implement letterSpacing on Android >= 5.0
Summary:
`letterSpacing` is completely missing from RN Android at the moment.
I've reviewed the `letterSpacing` implementations in #13199, #13877 and #16801 (that all seem to have stalled) and managed to put together an improved one based on #13199, updated to merge cleanly post https://github.com/facebook/react-native/commit/6114f863c3aed826355530bcf404ee5aed2f927b, that resolves the [issues](https://github.com/facebook/react-native/pull/13199#issuecomment-354568863) I've identified with that code.
I believe this is the closest PR yet to a correct implementation of this feature, with a few caveats:
- As with the other PRs, this only works on Android >= 5.0 (silently falling back to no letter spacing on older versions). Is this acceptable for a RN feature, in general? Would a dev mode warning be desirable?
- The other PRs seem to have explored the space of potential solutions to the layout issue ([Android renders space _around_ glyphs](https://issuetracker.google.com/issues/37079859), iOS to the _right_ of each one) and come up empty, so I've opted to merely document the difference.
- I have neither updated nor tested the "Flat" UI implementation - everything compiles but I've taken [this comment](https://github.com/facebook/react-native/issues/12770#issuecomment-294052694) to mean there's no point in trying to wade through it on my own right now; I'm happy to tackle it if given some pointers.
- The implementation in `ReactEditText` is only there to handle the placeholder text, as `ReactBaseTextShadowNode` already affects the input control's contents correctly.
- I'm not sure whether `<TextInput>` is meant to respect `allowFontScaling`; I've taken my cue here from `ReactTextInputManager.setFontSize()`, and used the same units (SP) to interpret the value in `ReactEditText.setLetterSpacingPt()`.
- I'm not sure whether `<TextInput>` is even meant to support `letterSpacing` - it doesn't actually work on iOS. I'm not going to be able to handle the Objective-C side of this, not as part of this PR at least.
- I have not added unit tests to `ReactTextTest` - is this desirable? I see that some other props such as `lineHeight` aren't covered there (unless I'm not looking in the right place).
- Overall, I'm new to this codebase, so it's likely I've missed something not mentioned here.
Note comment re: unit tests above; RNTester screenshots follow.
| iOS (existing functionality, amended test) | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458459-c8d59498-edcb-11e7-8c8f-e7426f723886.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458473-2a1ca368-edcc-11e7-9ce6-30c6d3a48660.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458481-6c60a36e-edcc-11e7-9af5-9734dd722ced.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458486-8b3cdcf8-edcc-11e7-974b-25c6085fa674.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458492-d69a77be-edcc-11e7-896f-21212621dbee.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458490-b3a1139e-edcc-11e7-88c8-79d4430d1514.png width=300> |
https://github.com/facebook/react-native-website/pull/105 - this docs PR is edited slightly from what's in `TextStylePropTypes` here; happy to align either one to the other after a review.
[ANDROID] [FEATURE] [Text] - Implemented letterSpacing
Closes https://github.com/facebook/react-native/pull/17398
Reviewed By: mdvacca
Differential Revision: D6837718
Pulled By: hramos
fbshipit-source-id: 5c9d49e9cf4af6457b636416ce5fe15315aab72c
2018-02-27 22:26:20 +00:00
|
|
|
<RNTesterBlock title="Letter Spacing">
|
|
|
|
<View>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={{letterSpacing: 0}}>letterSpacing = 0</Text>
|
Implement letterSpacing on Android >= 5.0
Summary:
`letterSpacing` is completely missing from RN Android at the moment.
I've reviewed the `letterSpacing` implementations in #13199, #13877 and #16801 (that all seem to have stalled) and managed to put together an improved one based on #13199, updated to merge cleanly post https://github.com/facebook/react-native/commit/6114f863c3aed826355530bcf404ee5aed2f927b, that resolves the [issues](https://github.com/facebook/react-native/pull/13199#issuecomment-354568863) I've identified with that code.
I believe this is the closest PR yet to a correct implementation of this feature, with a few caveats:
- As with the other PRs, this only works on Android >= 5.0 (silently falling back to no letter spacing on older versions). Is this acceptable for a RN feature, in general? Would a dev mode warning be desirable?
- The other PRs seem to have explored the space of potential solutions to the layout issue ([Android renders space _around_ glyphs](https://issuetracker.google.com/issues/37079859), iOS to the _right_ of each one) and come up empty, so I've opted to merely document the difference.
- I have neither updated nor tested the "Flat" UI implementation - everything compiles but I've taken [this comment](https://github.com/facebook/react-native/issues/12770#issuecomment-294052694) to mean there's no point in trying to wade through it on my own right now; I'm happy to tackle it if given some pointers.
- The implementation in `ReactEditText` is only there to handle the placeholder text, as `ReactBaseTextShadowNode` already affects the input control's contents correctly.
- I'm not sure whether `<TextInput>` is meant to respect `allowFontScaling`; I've taken my cue here from `ReactTextInputManager.setFontSize()`, and used the same units (SP) to interpret the value in `ReactEditText.setLetterSpacingPt()`.
- I'm not sure whether `<TextInput>` is even meant to support `letterSpacing` - it doesn't actually work on iOS. I'm not going to be able to handle the Objective-C side of this, not as part of this PR at least.
- I have not added unit tests to `ReactTextTest` - is this desirable? I see that some other props such as `lineHeight` aren't covered there (unless I'm not looking in the right place).
- Overall, I'm new to this codebase, so it's likely I've missed something not mentioned here.
Note comment re: unit tests above; RNTester screenshots follow.
| iOS (existing functionality, amended test) | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458459-c8d59498-edcb-11e7-8c8f-e7426f723886.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458473-2a1ca368-edcc-11e7-9ce6-30c6d3a48660.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458481-6c60a36e-edcc-11e7-9af5-9734dd722ced.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458486-8b3cdcf8-edcc-11e7-974b-25c6085fa674.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458492-d69a77be-edcc-11e7-896f-21212621dbee.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458490-b3a1139e-edcc-11e7-88c8-79d4430d1514.png width=300> |
https://github.com/facebook/react-native-website/pull/105 - this docs PR is edited slightly from what's in `TextStylePropTypes` here; happy to align either one to the other after a review.
[ANDROID] [FEATURE] [Text] - Implemented letterSpacing
Closes https://github.com/facebook/react-native/pull/17398
Reviewed By: mdvacca
Differential Revision: D6837718
Pulled By: hramos
fbshipit-source-id: 5c9d49e9cf4af6457b636416ce5fe15315aab72c
2018-02-27 22:26:20 +00:00
|
|
|
<Text style={{letterSpacing: 2, marginTop: 5}}>
|
|
|
|
letterSpacing = 2
|
|
|
|
</Text>
|
|
|
|
<Text style={{letterSpacing: 9, marginTop: 5}}>
|
|
|
|
letterSpacing = 9
|
|
|
|
</Text>
|
|
|
|
<View style={{flexDirection: 'row'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontSize: 12,
|
|
|
|
letterSpacing: 2,
|
|
|
|
backgroundColor: 'fuchsia',
|
|
|
|
marginTop: 5,
|
|
|
|
}}>
|
Implement letterSpacing on Android >= 5.0
Summary:
`letterSpacing` is completely missing from RN Android at the moment.
I've reviewed the `letterSpacing` implementations in #13199, #13877 and #16801 (that all seem to have stalled) and managed to put together an improved one based on #13199, updated to merge cleanly post https://github.com/facebook/react-native/commit/6114f863c3aed826355530bcf404ee5aed2f927b, that resolves the [issues](https://github.com/facebook/react-native/pull/13199#issuecomment-354568863) I've identified with that code.
I believe this is the closest PR yet to a correct implementation of this feature, with a few caveats:
- As with the other PRs, this only works on Android >= 5.0 (silently falling back to no letter spacing on older versions). Is this acceptable for a RN feature, in general? Would a dev mode warning be desirable?
- The other PRs seem to have explored the space of potential solutions to the layout issue ([Android renders space _around_ glyphs](https://issuetracker.google.com/issues/37079859), iOS to the _right_ of each one) and come up empty, so I've opted to merely document the difference.
- I have neither updated nor tested the "Flat" UI implementation - everything compiles but I've taken [this comment](https://github.com/facebook/react-native/issues/12770#issuecomment-294052694) to mean there's no point in trying to wade through it on my own right now; I'm happy to tackle it if given some pointers.
- The implementation in `ReactEditText` is only there to handle the placeholder text, as `ReactBaseTextShadowNode` already affects the input control's contents correctly.
- I'm not sure whether `<TextInput>` is meant to respect `allowFontScaling`; I've taken my cue here from `ReactTextInputManager.setFontSize()`, and used the same units (SP) to interpret the value in `ReactEditText.setLetterSpacingPt()`.
- I'm not sure whether `<TextInput>` is even meant to support `letterSpacing` - it doesn't actually work on iOS. I'm not going to be able to handle the Objective-C side of this, not as part of this PR at least.
- I have not added unit tests to `ReactTextTest` - is this desirable? I see that some other props such as `lineHeight` aren't covered there (unless I'm not looking in the right place).
- Overall, I'm new to this codebase, so it's likely I've missed something not mentioned here.
Note comment re: unit tests above; RNTester screenshots follow.
| iOS (existing functionality, amended test) | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458459-c8d59498-edcb-11e7-8c8f-e7426f723886.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458473-2a1ca368-edcc-11e7-9ce6-30c6d3a48660.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458481-6c60a36e-edcc-11e7-9af5-9734dd722ced.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458486-8b3cdcf8-edcc-11e7-974b-25c6085fa674.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458492-d69a77be-edcc-11e7-896f-21212621dbee.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458490-b3a1139e-edcc-11e7-88c8-79d4430d1514.png width=300> |
https://github.com/facebook/react-native-website/pull/105 - this docs PR is edited slightly from what's in `TextStylePropTypes` here; happy to align either one to the other after a review.
[ANDROID] [FEATURE] [Text] - Implemented letterSpacing
Closes https://github.com/facebook/react-native/pull/17398
Reviewed By: mdvacca
Differential Revision: D6837718
Pulled By: hramos
fbshipit-source-id: 5c9d49e9cf4af6457b636416ce5fe15315aab72c
2018-02-27 22:26:20 +00:00
|
|
|
With size and background color
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
<Text style={{letterSpacing: -1, marginTop: 5}}>
|
|
|
|
letterSpacing = -1
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
letterSpacing: 3,
|
|
|
|
backgroundColor: '#dddddd',
|
|
|
|
marginTop: 5,
|
|
|
|
}}>
|
Implement letterSpacing on Android >= 5.0
Summary:
`letterSpacing` is completely missing from RN Android at the moment.
I've reviewed the `letterSpacing` implementations in #13199, #13877 and #16801 (that all seem to have stalled) and managed to put together an improved one based on #13199, updated to merge cleanly post https://github.com/facebook/react-native/commit/6114f863c3aed826355530bcf404ee5aed2f927b, that resolves the [issues](https://github.com/facebook/react-native/pull/13199#issuecomment-354568863) I've identified with that code.
I believe this is the closest PR yet to a correct implementation of this feature, with a few caveats:
- As with the other PRs, this only works on Android >= 5.0 (silently falling back to no letter spacing on older versions). Is this acceptable for a RN feature, in general? Would a dev mode warning be desirable?
- The other PRs seem to have explored the space of potential solutions to the layout issue ([Android renders space _around_ glyphs](https://issuetracker.google.com/issues/37079859), iOS to the _right_ of each one) and come up empty, so I've opted to merely document the difference.
- I have neither updated nor tested the "Flat" UI implementation - everything compiles but I've taken [this comment](https://github.com/facebook/react-native/issues/12770#issuecomment-294052694) to mean there's no point in trying to wade through it on my own right now; I'm happy to tackle it if given some pointers.
- The implementation in `ReactEditText` is only there to handle the placeholder text, as `ReactBaseTextShadowNode` already affects the input control's contents correctly.
- I'm not sure whether `<TextInput>` is meant to respect `allowFontScaling`; I've taken my cue here from `ReactTextInputManager.setFontSize()`, and used the same units (SP) to interpret the value in `ReactEditText.setLetterSpacingPt()`.
- I'm not sure whether `<TextInput>` is even meant to support `letterSpacing` - it doesn't actually work on iOS. I'm not going to be able to handle the Objective-C side of this, not as part of this PR at least.
- I have not added unit tests to `ReactTextTest` - is this desirable? I see that some other props such as `lineHeight` aren't covered there (unless I'm not looking in the right place).
- Overall, I'm new to this codebase, so it's likely I've missed something not mentioned here.
Note comment re: unit tests above; RNTester screenshots follow.
| iOS (existing functionality, amended test) | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458459-c8d59498-edcb-11e7-8c8f-e7426f723886.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458473-2a1ca368-edcc-11e7-9ce6-30c6d3a48660.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458481-6c60a36e-edcc-11e7-9af5-9734dd722ced.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458486-8b3cdcf8-edcc-11e7-974b-25c6085fa674.png width=300> |
| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458492-d69a77be-edcc-11e7-896f-21212621dbee.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458490-b3a1139e-edcc-11e7-88c8-79d4430d1514.png width=300> |
https://github.com/facebook/react-native-website/pull/105 - this docs PR is edited slightly from what's in `TextStylePropTypes` here; happy to align either one to the other after a review.
[ANDROID] [FEATURE] [Text] - Implemented letterSpacing
Closes https://github.com/facebook/react-native/pull/17398
Reviewed By: mdvacca
Differential Revision: D6837718
Pulled By: hramos
fbshipit-source-id: 5c9d49e9cf4af6457b636416ce5fe15315aab72c
2018-02-27 22:26:20 +00:00
|
|
|
[letterSpacing = 3]
|
|
|
|
<Text style={{letterSpacing: 0, backgroundColor: '#bbbbbb'}}>
|
|
|
|
[Nested letterSpacing = 0]
|
|
|
|
</Text>
|
|
|
|
<Text style={{letterSpacing: 6, backgroundColor: '#eeeeee'}}>
|
|
|
|
[Nested letterSpacing = 6]
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</RNTesterBlock>
|
2017-05-06 03:50:47 +00:00
|
|
|
<RNTesterBlock title="Empty Text">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text />
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Toggling Attributes">
|
2015-09-14 14:35:58 +00:00
|
|
|
<AttributeToggler />
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="backgroundColor attribute">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{backgroundColor: '#ffaaaa'}}>
|
|
|
|
Red background,
|
|
|
|
<Text style={{backgroundColor: '#aaaaff'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
{' '}
|
|
|
|
blue background,
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
{' '}
|
|
|
|
inherited blue background,
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text style={{backgroundColor: '#aaffaa'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
{' '}
|
|
|
|
nested green background.
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
2015-09-29 16:12:19 +00:00
|
|
|
<Text style={{backgroundColor: 'rgba(100, 100, 100, 0.3)'}}>
|
|
|
|
Same alpha as background,
|
|
|
|
<Text>
|
|
|
|
Inherited alpha from background,
|
|
|
|
<Text style={{backgroundColor: 'rgba(100, 100, 100, 0.3)'}}>
|
|
|
|
Reapply alpha
|
|
|
|
</Text>
|
|
|
|
</Text>
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="containerBackgroundColor attribute">
|
2015-09-14 14:35:58 +00:00
|
|
|
<View style={{flexDirection: 'row', height: 85}}>
|
|
|
|
<View style={{backgroundColor: '#ffaaaa', width: 150}} />
|
|
|
|
<View style={{backgroundColor: '#aaaaff', width: 150}} />
|
|
|
|
</View>
|
|
|
|
<Text style={[styles.backgroundColorText, {top: -80}]}>
|
|
|
|
Default containerBackgroundColor (inherited) + backgroundColor wash
|
|
|
|
</Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={[
|
|
|
|
styles.backgroundColorText,
|
|
|
|
{top: -70, backgroundColor: 'transparent'},
|
|
|
|
]}>
|
2015-09-14 14:35:58 +00:00
|
|
|
{"containerBackgroundColor: 'transparent' + backgroundColor wash"}
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="numberOfLines attribute">
|
2015-09-14 14:35:58 +00:00
|
|
|
<Text numberOfLines={1}>
|
2018-05-11 20:32:37 +00:00
|
|
|
Maximum of one line no matter now much I write here. If I keep
|
|
|
|
writing it{"'"}ll just truncate after one line
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
|
|
|
<Text numberOfLines={2} style={{marginTop: 20}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
Maximum of two lines no matter now much I write here. If I keep
|
|
|
|
writing it{"'"}ll just truncate after two lines
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
|
|
|
<Text style={{marginTop: 20}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
No maximum lines specified no matter now much I write here. If I
|
|
|
|
keep writing it{"'"}ll just keep going and going
|
2015-09-14 14:35:58 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="selectable attribute">
|
2017-01-18 20:53:58 +00:00
|
|
|
<Text selectable>
|
2018-05-11 20:32:37 +00:00
|
|
|
This text is selectable if you click-and-hold, and will offer the
|
|
|
|
native Android selection menus.
|
2016-06-23 02:07:31 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="selectionColor attribute">
|
2017-01-18 20:53:58 +00:00
|
|
|
<Text selectable selectionColor="orange">
|
|
|
|
This text will have a orange highlight on selection.
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Inline images">
|
2015-11-13 18:51:09 +00:00
|
|
|
<Text>
|
2018-05-11 20:32:37 +00:00
|
|
|
This text contains an inline image{' '}
|
|
|
|
<Image source={require('./flux.png')} />. Neat, huh?
|
2015-11-13 18:51:09 +00:00
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Text shadow">
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
fontSize: 20,
|
|
|
|
textShadowOffset: {width: 2, height: 2},
|
|
|
|
textShadowRadius: 1,
|
|
|
|
textShadowColor: '#00cccc',
|
|
|
|
}}>
|
2016-01-01 17:32:59 +00:00
|
|
|
Demo text shadow
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Ellipsize mode">
|
2016-06-10 11:26:45 +00:00
|
|
|
<Text numberOfLines={1}>
|
|
|
|
This very long text should be truncated with dots in the end.
|
|
|
|
</Text>
|
2016-07-25 20:05:14 +00:00
|
|
|
<Text ellipsizeMode="middle" numberOfLines={1}>
|
2016-06-10 11:26:45 +00:00
|
|
|
This very long text should be truncated with dots in the middle.
|
|
|
|
</Text>
|
2016-07-25 20:05:14 +00:00
|
|
|
<Text ellipsizeMode="head" numberOfLines={1}>
|
2016-06-10 11:26:45 +00:00
|
|
|
This very long text should be truncated with dots in the beginning.
|
|
|
|
</Text>
|
2018-03-26 03:39:22 +00:00
|
|
|
<Text ellipsizeMode="clip" numberOfLines={1}>
|
|
|
|
This very long text should be clipped and this will not be visible.
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
<RNTesterBlock title="Include Font Padding">
|
2018-05-11 20:32:37 +00:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-around',
|
|
|
|
marginBottom: 10,
|
|
|
|
}}>
|
2016-12-02 20:46:44 +00:00
|
|
|
<View style={{alignItems: 'center'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={styles.includeFontPaddingText}>Ey</Text>
|
2016-12-02 20:46:44 +00:00
|
|
|
<Text>Default</Text>
|
|
|
|
</View>
|
|
|
|
<View style={{alignItems: 'center'}}>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text
|
|
|
|
style={[
|
|
|
|
styles.includeFontPaddingText,
|
|
|
|
{includeFontPadding: false, marginLeft: 10},
|
|
|
|
]}>
|
2016-12-02 20:46:44 +00:00
|
|
|
Ey
|
|
|
|
</Text>
|
|
|
|
<Text>includeFontPadding: false</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text>
|
|
|
|
By default Android will put extra space above text to allow for
|
|
|
|
upper-case accents or other ascenders. With some fonts, this can
|
|
|
|
make text look slightly misaligned when centered vertically.
|
|
|
|
</Text>
|
2017-05-06 03:50:47 +00:00
|
|
|
</RNTesterBlock>
|
|
|
|
</RNTesterPage>
|
2015-09-14 14:35:58 +00:00
|
|
|
);
|
|
|
|
}
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
2015-09-14 14:35:58 +00:00
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
backgroundColorText: {
|
|
|
|
left: 5,
|
2018-05-11 20:32:37 +00:00
|
|
|
backgroundColor: 'rgba(100, 100, 100, 0.3)',
|
2015-09-14 14:35:58 +00:00
|
|
|
},
|
2016-12-02 20:46:44 +00:00
|
|
|
includeFontPaddingText: {
|
|
|
|
fontSize: 120,
|
|
|
|
fontFamily: 'sans-serif',
|
|
|
|
backgroundColor: '#EEEEEE',
|
|
|
|
color: '#000000',
|
|
|
|
textAlignVertical: 'center',
|
|
|
|
alignSelf: 'center',
|
2018-05-11 20:32:37 +00:00
|
|
|
},
|
2015-09-14 14:35:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = TextExample;
|