Comments (5)
Hi,
this is kind of expected. A huge problem with rendering HTML with native components is wrapping View
inside Text
.
Since <img>
is a "block" element, the wrapper around your <p>
has to be one too to prevent rendering a View
without height and width inside a Text
, which would make react-native crash.
These View
wrappers rendered one after the other cause the line breaks.
A nice improvement to the renderer would be to flag some images that shuld be rendered inline, but sadly, until react-native improves, there is no way to render the HTML the way you'd like without changing your markup and adding some kind of prop to render your images inline.
I hope this enlightens you !
from react-native-render-html.
Oh I see now! I've managed to get it to look as I wanted tho. I just added flexDirection: 'row' and flexWrap: 'wrap' to the wrapping views and they r inline now.
Thanks for the tips and for this great package. Been very helpfull.
Thanks J.
from react-native-render-html.
I'm happy to see you've found a solution 😄 . The only problem is that we're relying on styling that wouldn't be needed on a browser, but heh, good enough I guess ¯_(ツ)_/¯
from react-native-render-html.
Ye that's true. I've now tried with different markups (that have different nested tags) and its working, so I guess its good for now.
from react-native-render-html.
The problem with flexDirection: 'row'
+ flexWrap: 'wrap'
is that when you have too many text before or after each image, the <Text>
box would wrap the text as well, making it unreadable. OP's example included very little text which is why it worked. Mine has more text, and I'm still trying to find a workaround... anybody has any suggestions?
from react-native-render-html.
Related Issues (20)
- 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) 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 36
- Can not render superscript <sup> tag 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.