0.5.0 • Published 5 months ago

react-native-truncated-text-view v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Add See More in Your Text View easily

Installation

npm install react-native-truncated-text-view
# for yarn user
yarn add react-native-truncated-text-view

Run the Example

# 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

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

PropTypeRequiredDefaultDescription
textstringNoThe text to be displayed
styleStylePropNoStyle for the text
tailTextStyleStylePropNoStyle for the tail text
containerStyleStylePropNoStyle for the container
lineHeightnumberNo21The line height for the text
numberOfLinesnumberNo2The number of lines to be displayed
enableShowLessbooleanNotrueWhether to enable the show less functionality
collapsedTextstringNo.. See moreThe collapsed text to be displayed
expandedTextstringNo.. See LessThe expanded text to be displayed
enableOnPressTogglebooleanNotrueWhether to enable on press toggle functionality
enableLayoutAnimationbooleanNotrueWhether to enable layout animation
enableTailViewbooleanNotrueWhether to enable Tail View (See More & See Less)
textPropsRootTextPropsNoDefault ValueA property to apply native props to text.
textPropsChildTextPropsNoDefault ValueA property to apply native props to text.

Contributors

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

react-native-truncated-text-view is MIT licensed


Made with create-react-native-library

0.5.0

5 months ago

0.4.0

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago