Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rn-read-more

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-read-more

## Show Case

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rn-read-more

Show Case

showcase

Getting Started

Installation

npm i rn-read-more --save

or

yarn add rn-read-more

Usage

Props
  • text(string)(*required): Text.

  • numberOfLines(number)(*required): Number of lines to be displayed.

  • renderViewMore((onPress: () => void) => ReactNode): Render view-more component.

  • renderViewLess((onPress: () => void) => ReactNode): Render view-less component.

  • onChangeTextVisibility((v: boolean) => void): Callback after change text visibility.

  • containerStyle(ViewStyle): Container style with text

  • textStyle(TextStyle): Text style.

  • textVisibility(boolean): Controls text visibility.

Example
import {
  TouchableOpacity,
  View,
  Text,
} from 'react-native';
import ReadMore from 'rn-read-more';

const Example = () => {
  const renderViewLess = onPress => {
    return (
      <View>
        <TouchableOpacity onPress={onPress}>
          <Text>View less</Text>
        </TouchableOpacity>
      </View>
    );
  };

  const renderViewMore = onPress => {
    return (
      <View>
        <TouchableOpacity onPress={onPress}>
          <Text>Read more</Text>
        </TouchableOpacity>
      </View>
    );
  };

  const onChangeTextVisibility = () => {
    console.log('onChangeTextVisibility fire!');
  };

  return (
    <ReadMore
      textStyle={{
        fontSize: 16,
      }}
      numberOfLines={3}
      text={TEXT}
      renderViewLess={renderViewLess}
      renderViewMore={renderViewMore}
      onChangeTextVisibility={onChangeTextVisibility}
    />
  );
};

License

MIT

FAQs

Package last updated on 25 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc