Comments (12)
@yjb94 @enguerranws please try the v3.5.1
branch, and specifically this commit.
I guess it should fix it in a clean way.
from react-native-render-html.
I guess it comes form the HTML I provide.
I did a simple test:
<HTML
html={`
<ul>
<li>Easy</li>
<li>Peasy</li>
<li><div style="background-color:red;width:50px;height:50px;"></div></li>
<li>Lemon</li>
<li>Squeezy</li>
</ul>
`}
tagsStyles={ HTMLStyles }
/>
This throws the error.
When I replace the content with :
<HTML
html={'<p>test</p>'}
tagsStyles={ HTMLStyles }
/>
or :
<HTML
html={'<p>Here is an <em>ul with <i>li</i></em> tag</p>'}
tagsStyles={ HTMLStyles }
/>
There's no error.
from react-native-render-html.
I don't know if this is a good way to solve this, anyway, I did a workaround by adding a simple check in HTML.js:
if(typeof(attribs) !== 'undefined') {
if (!attribs.style) {
child.attribs.style = cssObjectToString(textChildrenInheritedStyles);
} else {
child.attribs.style = cssObjectToString({
...textChildrenInheritedStyles,
...cssStringToObject(child.attribs.style)
});
}
}
From what I see, it works and doesn't break everything. But I'm pretty sure this is not a clean solution to this issue :)
from react-native-render-html.
Thanks for the workaround. I need some time to dive more into this because attribs
should never really be undefined. An empty object, at least.
I'll keep you posted once I know more about this issue.
from react-native-render-html.
@Exilz Thanks! Let me know if I can help you.
from react-native-render-html.
+1
from react-native-render-html.
if(attribs) { if (!attribs.style) { child.attribs.style = cssObjectToString(textChildrenInheritedStyles); } else { child.attribs.style = cssObjectToString({ ...textChildrenInheritedStyles, ...cssStringToObject(child.attribs.style) }); } }
i just managed to add a temporal code for exception..
In my case, the html code was
<p><img src='~~~~~'>SOME_TEXT</p>
//didn't work
<p><img src='~~~~~'></p><p>SOME_TEXT</p>
//worked
can this help? @Exilz
from react-native-render-html.
Yeah, your example did help me figure out what's going on.
I think it's just a minor issue, I should be releasing a fix later today.
from react-native-render-html.
Great! it's fixed! thx @Exilz
from react-native-render-html.
Yeah, thanks @Exilz, I'll test it asap!
from react-native-render-html.
@Exilz From what I see, it fixes the issue. When will it be available in master?
from react-native-render-html.
It's now available on master and on npm. I was waiting for your input. :)
from react-native-render-html.
Related Issues (20)
- Style is not working in img tags
- use a custom component for rendering HOT 4
- tagsStyles not working with custom font HOT 2
- Adjust the height container when inject a custom component in renders (image)
- 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)
- 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
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.