2.2.0 • Published 1 year ago

react-native-view-more-text v2.2.0

Weekly downloads
3,979
License
-
Repository
github
Last release
1 year ago

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(number)(*required): Number of lines to be displayed.
  • renderViewMore(object): Render view-more component
  • renderViewLess(object): Render view-less component
  • afterCollapse(func): Callback after collapsing
  • afterExpand(func): Callback after expanding

  • onTextLayout(func): onTextLayout function is passed to Text inside ViewMoreText (Refer to this PR#56)

  • textStyle(object, array): Styles is passed to Text inside ViewMoreText (Refer to this PR#8)
  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}
          textStyle={{textAlign: 'center'}}
        >
          <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>
      )
    }
  })
2.2.0

1 year ago

2.1.0

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.2

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago