lwansbrough / react-native-markdown

Markdown component for React Native
MIT License
277 stars 80 forks source link

Current problems with rendering native views #3

Closed lwansbrough closed 9 years ago

lwansbrough commented 9 years ago

One of the difficult problems for this module will be deciding how to render the markdown. Currently I'm using native views (a mix of Text and View) however this has already proven to be quite limiting due to React Native's inability to render anything other than Text inside a Text element. This module uses the Text element for layout out blocks, which is currently the limiting factor in being able to implement non-Text based elements. I'm using Text for blocks because it supports word wrapping. I believe that if at some point css-layout is updated to support row wrapping, then we may be able to layout the Text elements inside a View. If we can layout Text elements inside a View in such a way that they wrap like they would in a Text element then I think this would solve the rendering issue.

Maybe @vjeux can comment on whether or not this can be done.

Alternatively, we can use a transparent WebView and render the Markdown as HTML - but this comes with other caveats such as HTML sanitation and layout.

lwansbrough commented 9 years ago

Turns out there is indeed a flexWrap property. I've updated the module and should now be able to support more elements!