Why use StyleSheet.create
? When starting a new project ( react-native init test
, the project comes with style
as follows.
const styles = StyleSheet.create({
container: {
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
Imagem: {
resizeMode: 'contain',
width: 50,
height: 50
}
});
But if I do the following, style
will work the same way, so what's the difference?
const styles = {
container: {
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
Imagem: {
resizeMode: 'contain',
width: 50,
height: 50
}
}