Comments (3)
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.
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.
This feature landed in 3.6.0. Thanks for the constructive feedback.
from react-native-render-html.
Related Issues (20)
- other fonts don't work for children tags if you set font for parent HOT 1
- Failed prop type: Invalid prop `textDecorationColor` supplied to `Text`
- Render Error, maximum call stack size exceeded (native stack depth) HOT 2
- `<img>` embeds possibly not making use of `srcset` attribute resulting in blurry images HOT 3
- It is slow, it takes to import the components around 2 seconds
- Need Help for Break Lines Implementation HOT 1
- webView props mediaPlaybackRequiresUserAction not work HOT 2
- Not working android Realme device HOT 1
- defaultTextProps style overwrites renderers HOT 1
- Email or text is not showing proper way
- Slow navigate to a screen contains 12k words (including table) HOT 1
- RTL is not working on p or div tag HOT 1
- the app crashes while rendering the table on Android. `table-plugin`
- How to disable Font Scaling in react-native-render-html v6 HOT 1
- Font family not working HOT 2
- React Native 0.74 (Bridgeless) Support HOT 1
- Bullet didn't move with text when add padding to list item
- React 0.74 - Update defaultProps to JavaScript default parameters. HOT 41
- Can not render superscript <sup> tag HOT 1
- Lots of warnings logged in tests with fake timers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-render-html.