0.2.3 • Published 5 years ago

@mloureiro/react-native-expandable-text v0.2.3

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

React Native Expandable Text

NPM Version License

Travis CI Codacy Badge Codacy Badge

Introduction

ExpandableText React Native component which allows to collapse and expand text. This was built to be very flexible but still lightweight.

There are already a few projects with the same propose, so why another one?

  • animated
  • not opionated
    • some of other implementations already have the text in place,
    • force the touchable render to be right after the text
  • full control
    • provides control API so that you use as you wish
  • works with typography:
    • it allows to use your own text components implementation (instead of forcing to style the ExpandableText component)
  • simply works:
    • it works with any level of nested text components
    • it takes the styling into account when measuring

Installation

npm install --save @mloureiro/react-native-expandable-text

or

yarn add @mloureiro/react-native-expandable-text

Usage

An example can be found here.

API:

interface Props {
  children: string | Text
  duration?: number
  easing?: EasingMode
  controller?: (ref: ExpandableTextInterface) => void
  numberOfLines: number
  onReady?: (prop: { isCollapsible: boolean }) => void
}

interface ExpandableTextInterface {
  collapse(): void
  expand(): void
  isCollapsed(): boolean
  isCollapsible(): boolean
  toggle(): void
}

For the available easing modes, there's the documentation on the react-native-collapsible package.

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago