expo / react-native-read-more-text

583 stars 114 forks source link

ReadMore is not working with HTML children using react-native-render-html #37

Open muhammadashfaq opened 3 years ago

muhammadashfaq commented 3 years ago

I am using react-native-render-html within ReadMore but not working.

<ReadMore
              numberOfLines={3}
              renderTruncatedFooter={renderTruncatedFooter}
              renderRevealedFooter={renderRevealedFooter}
              onReady={handleTextReady}>
              <HTML
                html={serviceDetail?.post_content}
                baseFontStyle={{
                  fontFamily: family.Montserrat_Regular,
                }}
              />
            </ReadMore>

Any solution ?

rockia commented 3 years ago

I was also exploring a solution for this, but I don't think this lib supports it as the child component is wrapped inside a <Text> component: https://github.com/expo/react-native-read-more-text/blob/master/index.js#L51-L59

Update: I ended up just use a simple component state to show expanded full html view or collapsed version. It's not something fancy but it works. I could use animation library to show smooth transition later if the project requires such feature.

fawaz-ahmed commented 3 years ago

@muhammadashfaq can you try out this library

XamBoy commented 3 years ago

Any Update on this issue .. I'm also facing the same