1.0.4 • Published 6 years ago

rn-expandable-text v1.0.4

Weekly downloads
6
License
ISC
Repository
github
Last release
6 years ago

RN-ExpandableText

NPM Version License

Introduction

RN-ExpandableText is an component of React Native, all the usages of ExpandableText is the same as the native Text component, but it will collapse text when its content exceeds specified number of lines.

Installation

npm install rn-expandable-text --save

ExpandableText Usage

    import ExpandableText from 'rn-expandable-text'
    
    <ExpandableText
      numberOfLines={10}
      style={styles.expandableText}
      unexpandView={() => null}
      expandView={() =>
        (<View style={styles.arrow} />)
      }
    >
      {content}
    </ExpandableText>

Properties

PropDescriptionDefault
numberOfLinesThe max number of lines the content will be, the content exceed this value, the expandview will show.5
expandViewA callback function to return expand-view, you can customize the expand-view. when it's null, expand-view will disappear
unexpandViewA callback function to return unexpand-view. Usage the same as expandView
onExpandA callback when the content expands-
onCollapseA callback when the content collapses-

Demos

Default Viewcustomize the expand-view
Default ViewDefault View

Follow Me