Reputation: 667
I have two buttons below which are placed one above other:
<Button
onPress = {() =>{this.toggleModal(); }}
color="#512D67"
title="Submit"
/>
<Button
onPress = {() =>{this.toggleModal(); }}
color="#c0c0c0"
title="Cancel"
/>
These are placed without any space between them. How can I put space between them( margin and padding not working)?
Thank You!
Upvotes: 0
Views: 416
Reputation: 67
you can try this code below, it should solve your problem.
<View style={{ marginVertical: 20 }}>
<Button color="#512D67" title="Submit" />
</View>
<View>
<Button color="#c0c0c0" title="Cancel" />
</View>
Basically you just add margin vertically to the button with the help of View wrap.
Upvotes: 0
Reputation: 16354
Button in react native doesnt take a style prop, you will have to wrap it with a View and add the styles to the view
<View style={{paddingBottom:20}}>
<Button
onPress = {() =>{this.toggleModal(); }}
color="#512D67"
title="Submit"
/>
</View>
Upvotes: 1