0

Hi I am new to React Native. When I read the doc about react native about how to custom the style of a component, I found that we can just using a javascript script object to set to the style prop of the Component. But they are provide a Component named SheetSheet, which have a method create that can define the styles. But, if we use the StyleSheet object to set the Component style, we need to first access the SheetSheet object and the access the property of that object(e.g styles.redText) to set the style. So what is the point using SheetSheet? If we want to group all the styles value together we can also define a custom object which can do exactly what StyleSheet is doing. So I don't understand why this component is here or if I am missing something?

bufferoverflow76
  • 767
  • 1
  • 8
  • 23

1 Answers1

0

StyleSheet.create is a performance-minded API. It makes sure that styles are generated once and referenced by ID in the future instead of being instantiated every time something changes like a normal object would.

Juwan Wheatley
  • 527
  • 5
  • 9