1
Why use the StyleSheet.create
? When starting a new project (react-native init test
, the project comes with the 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 it this way, the 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
}
}