Git Product home page Git Product logo

Comments (3)

Exilz avatar Exilz commented on August 16, 2024

Hi, I started working on this issue and I think I have a decent solution.

You'd be able to declare your custom tags like so :

            renderers: {
                mytag: { renderer: myTagRenderer, wrapper: 'Text' }, // new way
                myothertag: myOtherTagRenderer // old regular way (still valid)
            }

If you supply a function, it behaves as it used to. If you use an object, your function must be in the renderer key so you can add other options.

I added the wrapper key, so you can set the wrapper you want for you custom component yourself.

Please note that the wrapper is not a react-native component per-se, it's either "View" or "Text". It's only used by the plugin to make sure views aren't nested inside texts to prevent crashes.

The following renderers behave like this

Please tell me what you think about this solution, and I'll try to add it to the next version.

from react-native-render-html.

rhysforyou avatar rhysforyou commented on August 16, 2024

Sorry for the delayed response @Exilz, I've been off on vacation! I think this is probably the best solution in terms of API design. The only other solution I can think of is checking whether the returned node has an inline prop that's been set to true, but that feels a little too 'magical; to me.

from react-native-render-html.

Exilz avatar Exilz commented on August 16, 2024

This feature landed in 3.6.0. Thanks for the constructive feedback.

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.