Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add space between button

Tags:

react-native

I wanted to add space between button but it's not working below is my code. What do I need to add in my code?

render(){
    return (
        <View>
            <Text>Home</Text>
            <Button style={styles.button}
                title='Add '
            />
            <Button style={styles.button}
                title='Search/Update'
            />
        </View>


    )
}

}

const styles = StyleSheet.create({
    button: {
        marginBottom: 20,
        padding: 30
    },
})
like image 454
Merndev Avatar asked Sep 07 '26 21:09

Merndev


1 Answers

Easiest way is to add a spacing view between your two buttons:

<View>
  <Text>Home</Text>
  <Button style={styles.button} title='Add' />
  <View style={styles.space} /> // <------------------------- right here
  <Button style={styles.button} title='Search/Update' />
</View>

const styles = StyleSheet.create({
  button: {
    marginBottom: 20,
    padding: 30
  },
  space: {
    width: 20, // or whatever size you need
    height: 20,
  },
})
like image 159
samzmann Avatar answered Sep 11 '26 01:09

samzmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!