From 196bc85629676556a82f4ea4db6a5e0cb53dad19 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Wed, 18 Mar 2015 13:12:40 -0700 Subject: [PATCH] [ReactNative] Remove ExpandingText --- Examples/Movies/MovieScreen.js | 8 +- Examples/UIExplorer/ExpandingTextExample.js | 52 ------- Examples/UIExplorer/UIExplorerList.js | 1 - Libraries/Text/ExpandingText.js | 130 ------------------ .../react-native/react-native-interface.js | 1 - Libraries/react-native/react-native.js | 1 - 6 files changed, 3 insertions(+), 190 deletions(-) delete mode 100644 Examples/UIExplorer/ExpandingTextExample.js delete mode 100644 Libraries/Text/ExpandingText.js diff --git a/Examples/Movies/MovieScreen.js b/Examples/Movies/MovieScreen.js index 53c8879dc..8584d8753 100644 --- a/Examples/Movies/MovieScreen.js +++ b/Examples/Movies/MovieScreen.js @@ -6,7 +6,6 @@ var React = require('react-native'); var { - ExpandingText, Image, PixelRatio, ScrollView, @@ -40,10 +39,9 @@ var MovieScreen = React.createClass({ - + + {this.props.movie.synopsis} + diff --git a/Examples/UIExplorer/ExpandingTextExample.js b/Examples/UIExplorer/ExpandingTextExample.js deleted file mode 100644 index 2a2f61fc8..000000000 --- a/Examples/UIExplorer/ExpandingTextExample.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2004-present Facebook. All Rights Reserved. - */ -'use strict'; - -var React = require('react-native'); -var { - ExpandingText -} = React; - -var LOREM = 'Lorem ipsum dolor sit amet, mea adipisci inimicus ex, paulo essent bonorum et ius, rebum deserunt mediocritatem ius ei.'; - -exports.title = ''; -exports.description = 'Base component for rendering text that is truncated and can be expanded upon tap.'; -exports.examples = [ -{ - title: 'Expanding text (truncLength=20)', - description: 'Setting the truncLength prop will cause the text to truncate to that character length', - render: function() { - return ; - } -}, { - title: 'Expanding text (truncLength=80)', - description: 'The higher the truncLength the more characters that will be shown by default', - render: function() { - return ; - } -}, { - title: 'Expanding text with custom style', - description: 'You can style the text within the ExpandingText component', - render: function() { - return ( - - ); - } -}, { - title: 'See More button with custom style' , - description: 'You can also style just the See More button', - render: function() { - return ( - - ); - } -}]; diff --git a/Examples/UIExplorer/UIExplorerList.js b/Examples/UIExplorer/UIExplorerList.js index ed9aa3c68..08558971f 100644 --- a/Examples/UIExplorer/UIExplorerList.js +++ b/Examples/UIExplorer/UIExplorerList.js @@ -22,7 +22,6 @@ var EXAMPLES = [ require('./TextExample.ios'), require('./TimerExample'), require('./TextInputExample'), - require('./ExpandingTextExample'), require('./ImageExample'), require('./ListViewSimpleExample'), require('./ListViewPagingExample'), diff --git a/Libraries/Text/ExpandingText.js b/Libraries/Text/ExpandingText.js deleted file mode 100644 index 181e0a2b8..000000000 --- a/Libraries/Text/ExpandingText.js +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule ExpandingText - */ -'use strict'; - -var React = require('React'); -var StyleSheet = require('StyleSheet'); -var Text = require('Text'); -var TouchableWithoutFeedback = require('TouchableWithoutFeedback'); -var View = require('View'); - -var truncate = require('truncate'); - -var styles = StyleSheet.create({ - boldText: { - fontWeight: 'bold', - }, -}); - -/** - * 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. - * - * ``` - * render: function() { - * return ; - * }, - * ``` - */ -var ExpandingText = React.createClass({ - propTypes: { - /** - * Text to be displayed. It will be truncated if the character length - * is greater than the `truncLength` property. - */ - text: React.PropTypes.string, - /** - * The styles that will be applied to the text (both truncated and - * expanded). - */ - textStyle: Text.propTypes.style, - /** - * The styles that will be applied to the See More button. Default - * is bold. - */ - 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 default is 130. - */ - truncLength: React.PropTypes.number, - }, - - getDefaultProps: function() { - return { - truncLength: 130, - seeMoreText: 'See More', - seeMoreStyle: styles.boldText, - }; - }, - - getInitialState: function() { - return { - truncated: true, - }; - }, - - onTapSeeMore: function() { - this.setState({ - truncated: !this.state.truncated, - }); - }, - - isTruncated: function() { - return ( - this.props.text.length > this.props.truncLength && - this.state.truncated - ); - }, - - getText: function() { - var text = this.props.text; - if (!this.isTruncated()) { - return text; - } - - return truncate(text, this.props.truncLength) + ' '; - }, - - renderSeeMore: function() { - if (!this.isTruncated()) { - return null; - } - - return ( - - {this.props.seeMoreText} - - ); - }, - - render: function() { - return ( - - - - {this.getText()} - {this.renderSeeMore()} - - - - ); - } -}); - -module.exports = ExpandingText; diff --git a/Libraries/react-native/react-native-interface.js b/Libraries/react-native/react-native-interface.js index c37bbe685..82ceeb77e 100644 --- a/Libraries/react-native/react-native-interface.js +++ b/Libraries/react-native/react-native-interface.js @@ -4,7 +4,6 @@ declare module "react-native" { } declare var AppRegistry: ReactClass; - declare var ExpandingText: ReactClass; declare var Image: ReactClass; declare var ListView: ReactClass; declare var NavigatorIOS: ReactClass; diff --git a/Libraries/react-native/react-native.js b/Libraries/react-native/react-native.js index 43dda595b..63690c4fa 100644 --- a/Libraries/react-native/react-native.js +++ b/Libraries/react-native/react-native.js @@ -11,7 +11,6 @@ var ReactNative = { // Components ActivityIndicatorIOS: require('ActivityIndicatorIOS'), DatePickerIOS: require('DatePickerIOS'), - ExpandingText: require('ExpandingText'), Image: require('Image'), ListView: require('ListView'), ListViewDataSource: require('ListViewDataSource'),