react native create stylesheet code example
Example 1: react native generate stylesheet with function
styleFunction (option) {
return {
borderWidth: 2,
margin: option,
}
}
<View style={this.styleFunction(15)}>
//things
</View>
Example 2: styles in react native
//Import
import { StyleSheet} from 'react-native';
//Add style in React native component this way
<View style={styles.container}>
</View>
//create your style this way
const styles = StyleSheet.create({
container: {
marginTop: 50,
},
});