1.1.1 • Published 7 months ago

@gpbagga/react-native-read-more v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

react-native-read-more

import ReactNativeReadMore from '@gpbagga/react-native-read-more'

const App = () => {
  const TextComponent = useCallback(() => (
    <Text
    style={{
      margin: 30,
      fontSize: 16,
      fontFamily: 'sans-serif-condensed'
    }}>
      <Text
      style={{
        fontWeight: 'bold'
      }}
      >{SAMPLESTR.substring(0, 30)}</Text>
      {SAMPLESTR.substring(30, 100)}
      <Text
        style={{ fontSize: 20, fontWeight: 'bold' }} >{SAMPLESTR.substring(100, 110)}</Text>
      <Text style={{ fontSize: 30 }} >{SAMPLESTR.substring(110)}</Text>
    </Text>
  ), [])

  return (
    <ReactNativeReadMore
      TextComponent={TextComponent}
      numLinesForReadMore={3}
      ReadMoreComponent={<Text>...read more</Text>}
      ReadLessComponent={<Text>...read less</Text>}
    />
  )
}

export default App
  • Make sure that style of Parent View of ReactNativeReadMore component does NOT include flexDirection:'row' and flexWrap:'wrap'.
  • Keep TextComponent inside useCallback to not render the ReactNativeReadMore component again on rerender of the App when text inside it remains same.
1.1.1

7 months ago

1.1.0

7 months ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago