Giter VIP home page Giter VIP logo

lohenyumnam / react-native-truncated-text-view Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 2.0 16.61 MB

Effortlessly truncate and expand text in React Native with react-native-truncated-text-view

Home Page: https://www.npmjs.com/package/react-native-truncated-text-view

License: MIT License

JavaScript 15.55% TypeScript 84.45%
reactnative seemore truncate seeless seemorebutton textviewtruncation truncatedtextview

react-native-truncated-text-view's Introduction

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

Prop Type Required Default Description
text string No The text to be displayed
style StyleProp No Style for the text
tailTextStyle StyleProp No Style for the tail text
containerStyle StyleProp 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 No Default Value A property to apply native props to text.
textPropsChild TextProps No Default Value A 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

react-native-truncated-text-view's People

Contributors

blockmaterial avatar lohenyumnam avatar younes0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-truncated-text-view's Issues

enableShowMore

I am suggesting that a "enableShowMore" property should be added to disable the "Show More" button. Currently, i am using a card product title to limit the number of lines shown in the title. I've successfully disabled the "Show Less" button, but the "Show More" button is still being displayed in the title.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.