question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intrinsic element "div" should produce a newline

See original GitHub issue

For 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:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
shaneosullivancommented, Jul 9, 2017

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

1reaction
vadimdemedescommented, Jul 16, 2017

This is probably going to be the right way to go.

@xdave Your TS bindings would also work with this approach, I assume.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found