iamacup / react-native-markdown-display

React Native 100% compatible CommonMark renderer
MIT License
590 stars 169 forks source link

Incremental rendering for large markdowns #164

Closed pke closed 10 months ago

pke commented 2 years ago

Would it somehow be possible to render large markdown documents incrementally? Like a virtual list view but with markdown blocks in it?

anisimov74 commented 2 years ago

@pke i did using stringToTokens and tokensToAST together and regulating how many nodes you want to render.

pke commented 2 years ago

Could you maybe please provide a code snippet here. Maybe we could add such functionality into the library.

anisimov74 commented 2 years ago

@pke sure. You can find it here. This is not a perfect solution, but it fixes performance problems for the most cases. And you can also try to render AST in a FlatList to get virtualizing.