Intrinsic element "div" should produce a newline
See original GitHub issueFor example, a component like this currently renders all of the items on a single line. Like HTML makes the div have a block-level display (implicitly has a 100% width), perhaps ink’s could do something similar?
const Things = ({ things }) => (
<div>
{things.map(item => (
<div>
<Indent size={2} indent={' '}>{item.text}</Indent>
</div>
))}
</div>
);
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:12 (7 by maintainers)
Top Results From Across the Web
How do I prevent DIV tag starting a new line? - Stack Overflow
The div tag is a block element, causing that behavior. You should use a span element instead, which is inline. If you really...
Read more >Injecting a Line Break | CSS-Tricks
I had a little situation where I had a header with a span in it, and I wanted to make sure to put...
Read more ><br><br> versus </div><div> - HTML & CSS - SitePoint
In answer to the original question as Tommy said a div is a neutral element and has no intrinsic styling so produces nothing...
Read more >line-break - CSS: Cascading Style Sheets - MDN Web Docs
The line-break CSS property sets how to break lines of Chinese, Japanese, or Korean (CJK) text when working with punctuation and symbols.
Read more >Alignment, font styles, and horizontal rules in HTML documents
Another attribute, defined for the BR element, controls text flow around floating objects. ... Deprecated. Specifies where the next line should appear in...
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 Free
Top 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
As a meta comment, given you are not actually constructing HTML here, you’d be better off taking the React Native approach of using View instead of div. then your textual output is just another rendering engine, rather than being confused with ReactDOM, which treats all lower case components as pass through dumb items to render
This is probably going to be the right way to go.
@xdave Your TS bindings would also work with this approach, I assume.