React Native doesn't support the CSS display
property, and by default all elements use the behavior of display: flex
(no inline-flex
either). Most non-flex layouts can be simulated with flex properties, but I'm flustered with inline text.
My app has a container that contains several words in text, some of which need formatting. This means I need to use spans to accomplish the formatting. In order to achieve wrapping of the spans, I can set the container to use flex-wrap: wrap
, but this will only allow wrapping at the end of a span rather than the traditional inline behavior of wrapping at word breaks.
The problem visualized (spans in yellow):
(via http://codepen.io/anon/pen/GoWmdm?editors=110)
Is there a way to get proper wrapping and true inline simulation using flex properties?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…