Skip to content

A super lightweight plugin to expand/collapse text in React-Native. Truncated text is ended with dotdotdot.

Notifications You must be signed in to change notification settings

team-supercharge/react-native-view-more-text

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-view-more-text

A super lightweight plugin to expand/collapse text in React-Native. Truncated text is ended with dotdotdot.

Working on IOS/Android

ios android

Installation

npm install --save react-native-view-more-text 

Usage

  • numberOfLines(required): Number of lines to be displayed.
  • renderViewMore: Render view-more component
  • renderViewLess: Render view-less component
  • afterCollapse: Callback after collapsing
  • afterExpand: Callback after expanding
	import ViewMoreText from 'react-native-view-more-text';
	
	let Example = React.createClass({
		renderViewMore(onPress){
			return(
				<Text onPress={onPress}>View more</Text>
			)
		},
		renderViewLess(onPress){
			return(
				<Text onPress={onPress}>View less</Text>
			)
		},
		render(){
			return(
				<ViewMoreText
			    numberOfLines={3}
			    renderViewMore={this.renderViewMore}
			    renderViewLess={this.renderViewLess}>
			    <Text>
			      Lorem ipsum dolor sit amet, in quo dolorum ponderum, nam veri molestie constituto eu. Eum enim tantas sadipscing ne, ut omnes malorum nostrum cum. Errem populo qui ne, ea ipsum antiopam definitionem eos.
			    </Text>
			  </ViewMoreText>
			)
		}
	})

About

A super lightweight plugin to expand/collapse text in React-Native. Truncated text is ended with dotdotdot.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%