Answer the question
In order to leave comments, you need to log in
Why use StyleSheet.create() in React Native?
Why use StyleSheet.create(...) when you can do without it?
What's the difference between
<View style={styles.container}>
...
</View>
var styles = {
container: {
// some styles
}
};
<View style={styles.container}>
...
</View>
var styles = StyleSheet.create({
container: {
// some styles
}
});
Answer the question
In order to leave comments, you need to log in
Also asked this question.
Did you manage to find out, if not a secret?
The line from the documentation says that then you won't create
a new style object every time. Making a stylesheet from a style object makes it possible to refer to it by ID instead of creating a new style object every time.
https://facebook.github.io/react-native/docs/style...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question