Nested Img and Iframe
See original GitHub issueIs this a bug report or a feature request?
Seems like a Bug.
Have you read the guidelines regarding bug report?
Yes
Have you read the documentation in its entirety?
Yes
Have you made sure that your issue hasn’t already been reported/solved?
I did
Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?
Noth Platforms
Is the bug reproductible in a production environment (not a debug one)?
Yes
Have you been able to reproduce the bug in the provided example?
I didn’t try
Environment
Environment: React: 16.2.0 React native: 0.52.0 react-native-render-html: 3.9.3
The Error
I have this HTML Content
<p style="text-align: center;">Notre Collection Made in France propose des modèles fabriqués dans les Vosges, ayant obtenu le label "<strong>Origine France Garantie</strong>"</p>
<p style="text-align: center;"> </p>
<div class="videoEmbed" style="text-align: center;"><iframe allowfullscreen="" frameborder="0" height="349" src="https://www.youtube.com/embed/8wpozmL-TRE?color=white&iv_load_policy=3&rel=0&autoplay=1&showinfo=0&modestbranding=1&theme=light&showsearch=0" width="560"></iframe></div>
<p style="text-align: center;"> </p>
<p style="text-align: center;"><img alt="" src="https://hivency-staging.s3.amazonaws.com/uploads/ckeditor/pictures/2/content_Visuel.png" style="width: 659px; height: 800px;"></p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"><strong>Vous souhaitez tester nos lunettes ? Rien de plus simple</strong> :</p>
By encapsulating its iframe
and img
inside a p
tag, the staticContentMaxWidth
and imagesMaxWidth
are ignored and oversize the width of my screen.
Also, i’ve had to ignore textAlign
styling, it throws an error on Android.
I’ve tried to ignore also height
and width
, without success.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
What tags can be nested inside an iframe? - Stack Overflow
Element 'div' cannot be nested inside element 'iframe'. I also tried with <p> and <span> with the same results. I also try to...
Read more >iframe – nested browsing context (inline frame) - HTML5
Instructs the UA that the iframe element's browsing context is to be rendered in a manner that makes it appear to be part...
Read more ><iframe>: The Inline Frame element - HTML - MDN Web Docs
The <iframe> HTML element represents a nested browsing context, embedding another HTML page into the current one.
Read more >Save loaded images in nested iframe pages - GitHub
Detects all images loaded on the current web page (even if they're nested iframes); Filters images by file size, dimension, URL, or type...
Read more >HTML Iframes - W3Schools
HTML Iframe Syntax. The HTML <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, the
height
andwidth
styles passed as HTML attributes take precedence overstaticContentMaxWidth
. I know this is controversial, it might be useful to add a prop to configure this behavior… So your image will be 659px wide anyway.imagesMaxWidth
seems to be resizing your image properly, whether it’s in a<p>
or not.ignoredStyles={['width']}
also seems to be working on the demo.The only problem I see here is that the
width
attribute of your<iframe>
, it’s not being ignored byignoredStyles
since it’s not inside thestyle
attribute.You should be able to circumvent this by using something like this :
I’ve tried on iOS and Android.
Hello! I have the same problem, with
staticContentMaxWidth
not working for an<iframe>
. My<iframe>
has width attribute, so the solutions seems legit. Being a starter in react-native and javascript, I don’t really get where should that code be applied. Can you enlighten me, please? My code for rendering HTML:LE: Worked for me like this: