React-Native Button style not work

前端 未结 9 1078
傲寒
傲寒 2020-12-24 10:33

Import_this

import {AppRegistry, Text, View, Button, StyleSheet} from \'react-native\';

This my

9条回答
  •  执笔经年
    2020-12-24 10:59

    I know this is necro-posting, but I found a real easy way to just add the margin-top and margin-bottom to the button itself without having to build anything else.

    When you create the styles, whether inline or by creating an object to pass, you can do this:

    var buttonStyle = {
       marginTop: "1px",
       marginBottom: "1px"
    }
    

    It seems that adding the quotes around the value makes it work. I don't know if this is because it's a later version of React versus what was posted two years ago, but I know that it works now.

提交回复
热议问题