Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to add spaces between Texts React Native

I’m very new to React Native. I have texts that are listed one below the other but I want the spaces between the list to be bigger but I have no idea how to do it. Any help would be very appreciated.

const CustomInput = () => {
      return (
         <View style={styles.container}>
         <Text>Book Titles</Text>
         <Text>Genre</Text>
        <Text>Author</Text>
        <Text>Number of pages</Text>
        </View>
    );
    
};


const styles = StyleSheet.create({
    container: {
        backgroundColor: 'white',
        width: '100%',
        height: '50%',

        borderColour: '#e8e8e8',
        borderWidth: 1,
        borderRadius: 5,

        paddingHorizontal: 10,
        marginVertical: 5,
    },

});

export default CustomInput;

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Vertically space added between your text

const CustomInput = () => {
      return (
         <View style={styles.container}>
         <Text>Book Titles</Text>
         <Text>Genre</Text>
        <Text>Author</Text>
        <Text>Number of pages</Text>
        </View>
    );
    
};


const styles = StyleSheet.create({
    container: {
        backgroundColor: 'white',
        width: '100%',
        height: '50%',

        borderColour: '#e8e8e8',
        borderWidth: 1,
        borderRadius: 5,
        justifyContent:'space-between',
        paddingHorizontal: 10,
        marginVertical: 5,
    },

});

export default CustomInput;

Horizontally space added between your text

const CustomInput = () => {
      return (
         <View style={styles.container}>
         <Text>Book Titles</Text>
         <Text>Genre</Text>
        <Text>Author</Text>
        <Text>Number of pages</Text>
        </View>
    );
    
};


const styles = StyleSheet.create({
    container: {
        backgroundColor: 'white',
        width: '100%',
        height: '50%',
        flexDirection:'row',
        borderColour: '#e8e8e8',
        borderWidth: 1,
        borderRadius: 5,
        justifyContent:'space-between',
        paddingHorizontal: 10,
        marginVertical: 5,
    },

});

export default CustomInput;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading