From e979f2324a5e46b82d7ca2988cdb7af3f61a653c Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Thu, 5 Mar 2015 10:21:21 -0800 Subject: [PATCH] [ReactNative] Fix ExpandingText prop types --- Libraries/Text/ExpandingText.js | 46 ++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/Libraries/Text/ExpandingText.js b/Libraries/Text/ExpandingText.js index 80b06492a..181e0a2b8 100644 --- a/Libraries/Text/ExpandingText.js +++ b/Libraries/Text/ExpandingText.js @@ -20,39 +20,49 @@ var styles = StyleSheet.create({ }); /** - * - A react component for displaying text which supports truncating - * based on a set truncLength. In the following example, the text will truncate + * A react component for displaying text which supports truncating + * based on a set truncLength. + * + * In the following example, the text will truncate * to show only the first 17 characters plus '...' with a See More button to - * expand the text to its full length + * expand the text to its full length. * - * renderText: function() { - * return ; - * }, - * - * More example code in `ExpandingTextExample.js` + * ``` + * render: function() { + * return ; + * }, + * ``` */ var ExpandingText = React.createClass({ - PropTypes: { + propTypes: { /** - * Text to be displayed. Text will be truncated if the character length - * is greater than the truncLength property. + * Text to be displayed. It will be truncated if the character length + * is greater than the `truncLength` property. */ - text: React.PropTypes.string.isRequired, + text: React.PropTypes.string, /** - * The styles that will be applied to the text (both truncated and expanded). + * The styles that will be applied to the text (both truncated and + * expanded). */ - textStyle: Text.stylePropType, + textStyle: Text.propTypes.style, /** - * The styles that will be applied to the See More button + * The styles that will be applied to the See More button. Default + * is bold. */ - seeMoreStyle: Text.stylePropType, + seeMoreStyle: Text.propTypes.style, + /** + * The caption that will be appended at the end, by default it is + * `'See More'`. + */ + seeMoreText: React.PropTypes.string, /** * The maximum character length for the text that will * be displayed by default. Note that ... will be * appended to the truncated text which is counted towards - * the total truncLength of the default displayed string + * the total truncLength of the default displayed string. + * The default is 130. */ - truncLength: React.PropTypes.number + truncLength: React.PropTypes.number, }, getDefaultProps: function() {