Giter Club home page Giter Club logo

Comments (5)

Exilz avatar Exilz commented on July 21, 2024

Hi,
this is kind of expected. A huge problem with rendering HTML with native components is wrapping View inside Text.
Since <img> is a "block" element, the wrapper around your <p> has to be one too to prevent rendering a View without height and width inside a Text, which would make react-native crash.
These View wrappers rendered one after the other cause the line breaks.

A nice improvement to the renderer would be to flag some images that shuld be rendered inline, but sadly, until react-native improves, there is no way to render the HTML the way you'd like without changing your markup and adding some kind of prop to render your images inline.

I hope this enlightens you !

from react-native-render-html.

jotamimoso avatar jotamimoso commented on July 21, 2024

Oh I see now! I've managed to get it to look as I wanted tho. I just added flexDirection: 'row' and flexWrap: 'wrap' to the wrapping views and they r inline now.
Thanks for the tips and for this great package. Been very helpfull.

Thanks J.

from react-native-render-html.

Exilz avatar Exilz commented on July 21, 2024

I'm happy to see you've found a solution 😄 . The only problem is that we're relying on styling that wouldn't be needed on a browser, but heh, good enough I guess ¯_(ツ)_/¯

from react-native-render-html.

jotamimoso avatar jotamimoso commented on July 21, 2024

Ye that's true. I've now tried with different markups (that have different nested tags) and its working, so I guess its good for now.

from react-native-render-html.

harrisonlo avatar harrisonlo commented on July 21, 2024

The problem with flexDirection: 'row' + flexWrap: 'wrap' is that when you have too many text before or after each image, the <Text> box would wrap the text as well, making it unreadable. OP's example included very little text which is why it worked. Mine has more text, and I'm still trying to find a workaround... anybody has any suggestions?

from react-native-render-html.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.