Giter Club home page Giter Club logo

Comments (7)

Exilz avatar Exilz commented on July 21, 2024 1

Sorry I completely missed this issue. You should implement a custom rendered to support <br>.
You could render a view with a little height, this should do the trick !

from react-native-render-html.

jawinn avatar jawinn commented on July 21, 2024

What about replacing BRs within Text elements with \n?

from react-native-render-html.

Exilz avatar Exilz commented on July 21, 2024

Well, you wouldn't have much control on it. I still think a custom renderer would be better for most cases.

from react-native-render-html.

jawinn avatar jawinn commented on July 21, 2024

Thanks. This works and is what I ended up doing, for anyone else that may need:

const customRenderers = {
  br: (htmlAttribs, children, passProps) => {
    return (
      <Text style={passProps.htmlStyles.br} {...passProps}>{'\n'}</Text>
    )
  }
};

And:
<HTML htmlStyles={YOURSTYLES} html={YOURHTML} renderers={customRenderers}/>

In my custom styles for br, I just have the lineHeight set.

from react-native-render-html.

Exilz avatar Exilz commented on July 21, 2024

I guess I should add that to the default renderers, <br> is a rather common tag.

from react-native-render-html.

phil-homecu avatar phil-homecu commented on July 21, 2024

I tried this fix and got the error undefined is not an object (evaluating 'passProps.htmlStyles.br')

from react-native-render-html.

Exilz avatar Exilz commented on July 21, 2024

@phil-homecu please check out the 2.1.0 version

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.