1.0.5 • Published 1 year ago

zq-react-native-expandable-text v1.0.5

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

react-native-expandable-text

简体中文 | English

Introduction

zq-react-native-expandable-textis an expandable and collapsible Text component. Support buttons trailing the end of the text when expanded. It has been adapted to iOS and Android, and supports certain UI configurations

The core calculation logic is implemented through the onLayout and onTextLayout events that come with TextView, without relying on native code.

Demo

demo

Manually import:

Copy the files and resources in the src directory to your project

NPM import:

npm install zq-react-native-expandable-text --save

Dependencies

The UI depends on the following items, please manually introduce these two items in the project's package.json, and execute pod install in the iOS directory

react-native-fast-image

react-native-linear-gradient

Basic use

<ExpandableText
  width={screenWidth - 2 * padding}
  content={text}
/>

Props

PropTypeRequiredNote
widthnumberyesExpandable text component width
contentstringnoComponent content, default is ""
numberOfLinesnumbernoLimit the number of lines, default is 2
textStyleobjectno{lineHeight, color, fontSize},default is{lineHeight: 16},If you set lineHeight, please also set lineHeight in buttonStyle
buttonConfigobjectno{iconPath, normalText, expandText}
buttonStyleobjectno{lineHeight, color, fontSize}

Other

If you like this component, please help to click start, thank you very much