fawaz-ahmed / react-native-read-more

React native library to show text in a condensed way and expand when needed. Drop in replacement for Text component and highly customizable. Can be used with expo or native cli for react native.
https://www.npmjs.com/package/@fawazahmed/react-native-read-more
MIT License
275 stars 37 forks source link

onReady callback never called when text have less lines than `numberOfLines` #68

Closed matziol closed 2 years ago

matziol commented 2 years ago

When passed text is shorter and evaluating to less lines than numberOfLines. This is how it looks with example app and numberOfLines={3}:

<ReadMore
  numberOfLines={3}
  style={styles.textStyle}
  onReady={() => Alert.alert('onReady Called')}>
  {
    "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
  }
</ReadMore>

https://user-images.githubusercontent.com/73690392/176875170-faeb27b6-523c-41fb-8284-f0d19eb98d95.mp4

AND

<ReadMore
  numberOfLines={3}
  style={styles.textStyle}
  onReady={() => Alert.alert('onReady Called')}>
  {'Lorem Ipsum is simply dummy text'}
</ReadMore>

https://user-images.githubusercontent.com/73690392/176875337-d5079adf-7326-4580-b6e7-686339a04fef.mp4

fawaz-ahmed commented 2 years ago

@matziol thanks for bringing this up. I'll debug this.

fawaz-ahmed commented 2 years ago

@matziol fix released in ver 2.3.7

matziol commented 2 years ago

Working well, thank you!