What are the disadvantages of StyleSheet.create?

Technology CommunityCategory: React NativeWhat are the disadvantages of StyleSheet.create?
VietMX Staff asked 3 years ago
  • The key tradeoff with StyleSheet.create method is that recomputing styles based on external criteria (like screen rotation or even a user-selected viewing mode) needs some infrastructure built to determine which styles to use. If objects were passed in “raw” they could be recomputed on the fly every time, based on arbitrary criteria.
  • You cannot make a comparison like this styles.myNiceComponent.backgroundColor === 'blue'. (Need to flatten it first.)