Full width button w/ flex-box in react-native

后端 未结 4 1077
长情又很酷
长情又很酷 2021-02-03 17:36

I\'m new to flexbox and am unable to produce a full width button in react-native. I\'ve been trying to figure this out myself for over a day and have read every related article

4条回答
  •  花落未央
    2021-02-03 18:12

    I came here looking for the same question. Having experimented further, I've found the simplest way is to use alignSelf: 'stretch'. This forces the individual element to take up the full width available e.g.

     button: {
        alignSelf: 'stretch'
     }
    

    Nader's answer does work of course, but this would seem to be the correct way using Flexbox.

提交回复
热议问题