Simulate display: inline in React Native

前端 未结 4 1987
孤街浪徒
孤街浪徒 2020-12-13 08:37

React Native doesn\'t support the CSS display property, and by default all elements use the behavior of display: flex (no inline-flex

4条回答
  •  自闭症患者
    2020-12-13 08:56

    You can get this effect by wrapping text elements in other text elements the way you would wrap a span in a div or another element:

    
      This writing should fill most of the container This writing should fill most of the container       
    
    

    You can also get this effect by declaring a flexDirection:'row' property on the parent along with a flexWrap: 'wrap'. The children will then display inline:

    
      onetwoThreeFourFive
    
    

    Check out this example.

    https://rnplay.org/apps/-rzWGg

提交回复
热议问题