line break mode for ios

Summary:
What do you think is ```lineBreakMode``` a good name? For android it is called ```ellipsize```.

<img src="https://cloud.githubusercontent.com/assets/1488195/15628555/7372f8d0-250c-11e6-8919-722f28a38d60.png"" width="300" />
Closes https://github.com/facebook/react-native/pull/7819

Differential Revision: D3417256

fbshipit-source-id: 189441a23ff554bf7f6d67fa8510959351e9e5cc
This commit is contained in:
Sokovikov
2016-06-10 04:26:45 -07:00
committed by Facebook Github Bot 3
parent 33dfc9db92
commit c03b166854
9 changed files with 70 additions and 8 deletions

View File

@@ -29,6 +29,7 @@ const viewConfig = {
validAttributes: merge(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
numberOfLines: true,
lineBreakMode: true,
allowFontScaling: true,
}),
uiViewClassName: 'RCTText',
@@ -69,6 +70,11 @@ const viewConfig = {
const Text = React.createClass({
propTypes: {
/**
* Line Break mode. Works only with numberOfLines.
* clip is working only for iOS
*/
lineBreakMode: React.PropTypes.oneOf(['head', 'middle', 'tail', 'clip']),
/**
* Used to truncate the text with an ellipsis after computing the text
* layout, including line wrapping, such that the total number of lines
@@ -110,6 +116,7 @@ const Text = React.createClass({
return {
accessible: true,
allowFontScaling: true,
lineBreakMode: 'tail',
};
},
getInitialState: function(): Object {