# react-native-truncated-text-view

> Effortlessly truncate and expand text in React Native

Latest version **0.5.0** (published 2023-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-truncated-text-view
pnpm add react-native-truncated-text-view
yarn add react-native-truncated-text-view
bun add react-native-truncated-text-view
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2023-12-11 |
| First published | 2023-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 16.0.0 |
| Dependencies | 0 |
| Unpacked size | 56.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Lohen Yumnam |
| Maintainers | lohenyumnam |
| Keywords | react-native, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-truncated-text-view
- Repository: https://github.com/lohenyumnam/react-native-truncated-text-view
- Homepage: https://github.com/lohenyumnam/react-native-truncated-text-view#readme
- Issues: https://github.com/lohenyumnam/react-native-truncated-text-view/issues
- npm.io page: https://npm.io/package/react-native-truncated-text-view

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2023-12-11
- 0.4.0 — 2023-03-18
- 0.3.2 — 2023-01-29
- 0.3.1 — 2023-01-27
- 0.3.0 — 2023-01-27
- 0.2.0 — 2023-01-23
- 0.1.1 — 2023-01-23
- 0.1.0 — 2023-01-23

## README

<div align="center">
  <img src="./demo/assets/logo.png?raw=true" width="550">

Add See More in Your Text View easily
<BR/>
<BR/>

<kbd>
<img src="https://github.com/lohenyumnam/react-native-truncated-text-view/blob/74cc2c46c0cea284211743399a012540dd7aa823/demo/assets/preview.ios.gif?raw=true" width="350">
</kbd>

</div>

## Installation

```sh
npm install react-native-truncated-text-view
```

```sh
# for yarn user
yarn add react-native-truncated-text-view
```

## Run the Example

```sh
# Get started with the project:

yarn
# Run the example app on iOS:

yarn example ios

# Run the example app on Android:

yarn example android
```

## Usage

```js
import * as React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { TruncatedTextView } from 'react-native-truncated-text-view';

export default function App() {
  return (
    <View style={styles.container}>
      <Text style={styles.title}>Truncated Text View</Text>
      <TruncatedTextView
        text={DATA}
        style={styles.textStyle}
        tailTextStyle={styles.tailText}
        numberOfLines={2}
        enableShowLess={false}
		 textPropsChild={{allowFontScaling: false}}
         textPropsRoot={{allowFontScaling: false}}
      />
    </View>
  );
}
```

## API

| Prop                  | Type                 | Required | Default     | Description                                       |
| --------------------- | -------------------- | -------- | ----------- | ------------------------------------------------- |
| text                  | string               | No       |             | The text to be displayed                          |
| style                 | StyleProp<TextStyle> | No       |             | Style for the text                                |
| tailTextStyle         | StyleProp<TextStyle> | No       |             | Style for the tail text                           |
| containerStyle        | StyleProp<ViewStyle> | No       |             | Style for the container                           |
| lineHeight            | number               | No       | 21          | The line height for the text                      |
| numberOfLines         | number               | No       | 2           | The number of lines to be displayed               |
| enableShowLess        | boolean              | No       | true        | Whether to enable the show less functionality     |
| collapsedText         | string               | No       | .. See more | The collapsed text to be displayed                |
| expandedText          | string               | No       | .. See Less | The expanded text to be displayed                 |
| enableOnPressToggle   | boolean              | No       | true        | Whether to enable on press toggle functionality   |
| enableLayoutAnimation | boolean              | No       | true        | Whether to enable layout animation                |
| enableTailView        | boolean              | No       | true        | Whether to enable Tail View (See More & See Less) |
| textPropsRoot | [TextProps](https://reactnative.dev/docs/text-style-props#props) | No    | Default Value  | A property to apply native props to text.
| textPropsChild | [TextProps](https://reactnative.dev/docs/text-style-props#props) | No   | Default Value  | A property to apply native props to text.

## Contributors


-  [<img src="https://github.com/BLOCKMATERIAL.png" width="30" height="30">](https://github.com/BLOCKMATERIAL) [MATERIALBLOCK](https://github.com/BLOCKMATERIAL) 


## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

react-native-truncated-text-view is [MIT licensed](LICENSE)

---

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)

---
_Source: https://npm.io/package/react-native-truncated-text-view · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
