react-native-markdown-display icon indicating copy to clipboard operation
react-native-markdown-display copied to clipboard

Configuring numberOfLines for the whole markdown

Open gregoripolak opened this issue 1 year ago • 2 comments

Issue Description

Hello, I am working on integrating the react-native-markdown-display into our application to display Markdown content. We have a global requirement to limit the number of visible lines across all Markdown-rendered content. Currently, I see that we can apply styles or rules to individual Markdown elements, but there does not seem to be a way to set a maxNumberOfLines for the entire content block universally.

Expected Behavior

I would like to be able to pass a numberOfLines prop to the Markdown component that applies this limit to the entire content, not just specific elements. Here's a conceptual API I am looking for:

const ContentViewer = ({ content, numberOfLines }) => {
  return <Markdown style={styles} numberOfLines={numberOfLines}>
    {content}
  </Markdown>;
};

Current Behavior

Currently, the library allows styling individual elements, but applying a global numberOfLines restriction requires custom implementation for each element type.

Environment

Package Version: 7.0.2 React Native Version: 0.74.3 Platform: iOS & Android

Question

Is there a workaround or potential update that could support this feature? If not, could this be considered for a future release? Any guidance or suggestions on how I might implement this feature myself would also be greatly appreciated.

Thank you for your work on this package and for considering this feature request.

gregoripolak avatar Feb 02 '25 11:02 gregoripolak

Any news on this?

robertontiu avatar Aug 15 '25 09:08 robertontiu

In general passing e.g. text props & view props would be big! Example for me is maxFontSizeMultiplier, but generally being able to pass props would be good.

ZinoM21 avatar Sep 22 '25 10:09 ZinoM21