How are styles mapped to numbers in React Native?
The idea of StyleSheet.create
is to reduce the number of times the stylesheet object is created to one. Since the object will always have the same values, it makes sense to do that and it is a very simple way of saving some processing time. The number that you get is simply a reference to the created StyleSheet object.
Something similar happens with static images as well. If you console.log
the value of require('./myImage.png')
, you will also get a number. Again, for the same optimization reasons.