In this example, I have shared how to use React Native style sheet? In react native, a style sheet is created by initiating a constant, assigning it to a styleSheet.
Here is an example of how to use React Native stylesheet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import * as React from 'react'; import { Text, View, StyleSheet, Button, TextInput } from 'react-native'; export default function App() { return ( <View style={styles.box}> <View style={styles.container}> <TextInput style={styles.myinput} /> <Button title="GO" /> </View> </View> ); } const styles = StyleSheet.create({ box: { padding: 50, }, container: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', }, myinput: { Width: '80%', borderBottomColor: 'black', padding: 10, borderBottomWidth: 1, }, }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.