@expo/react-native-read-more-text

1.1.0 • Public • Published

@expo/react-native-read-more-text

Try it on Expo

Example

Installation

npm i @expo/react-native-read-more-text --save

Usage

export class DescriptionCard extends React.Component {
  render() {
    let { text } = this.props;

    return (
      <View>
        <View style={styles.cardLabel}>
          <BoldText style={styles.cardLabelText}>
            Description
          </BoldText>
        </View>

        <View style={styles.card}>
          <View style={styles.cardBody}>
            <ReadMore
              numberOfLines={3}
              renderTruncatedFooter={this._renderTruncatedFooter}
              renderRevealedFooter={this._renderRevealedFooter}
              onReady={this._handleTextReady}>
              <RegularText style={styles.cardText}>
                {text}
              </RegularText>
            </ReadMore>
          </View>
        </View>
      </View>
    );
  }

  _renderTruncatedFooter = (handlePress) => {
    return (
      <RegularText style={{color: Colors.tintColor, marginTop: 5}} onPress={handlePress}>
        Read more
      </RegularText>
    );
  }

  _renderRevealedFooter = (handlePress) => {
    return (
      <RegularText style={{color: Colors.tintColor, marginTop: 5}} onPress={handlePress}>
        Show less
      </RegularText>
    );
  }

  _handleTextReady = () => {
    // ...
  }
}

/@expo/react-native-read-more-text/

    Package Sidebar

    Install

    npm i @expo/react-native-read-more-text

    Weekly Downloads

    75

    Version

    1.1.0

    License

    MIT

    Last publish

    Collaborators

    • schestakov
    • janicduplessis
    • wkozyra
    • barthec
    • quinlanj
    • sjchmiela
    • tsapeta
    • dsokal
    • esamelson
    • expoadmin
    • ide
    • brentvatne
    • nikki93
    • ccheever
    • terribleben
    • jesseruder
    • fson
    • evanbacon