vitalets / react-native-extended-stylesheet

Extended StyleSheets for React Native
MIT License
2.93k stars 132 forks source link

Shall I memoize() the sheet if the only vars changing are media-queries related. How to do it? #11

Closed amarchen closed 7 years ago

amarchen commented 8 years ago

I have zero global variables for stylesheets, yet quite some changes depending on the device orientation and thus on media queries.

Therefore I am calling create() on every rotation. How should I memoize() stylesheets in such a situation not to recalculate same sheet many times or is it possible at all?

vitalets commented 8 years ago

After implementing orientation support in #9 portrait/landscape styles will be cached automatically. Memoize is intended for cases when you create components dynamically with set of styles.