问题
I'm running expo web build which uses react-native-web. I noticed it generates inline styles so if I render a list of items, the styles get repeated for each item. Is there a way to make it generate a unique className instead and add to the head like styled-components?
回答1:
Revisited this and realized it's because the components I was using did not use the StyleSheet.create
api call internally, which WILL generate atomic css classes on react-native-web. Setting a regular object as the style property will just generate inline styles. For more info, see the issue I posted here:
https://github.com/akveo/react-native-ui-kitten/issues/1266
来源:https://stackoverflow.com/questions/63585152/how-to-generate-class-names-instead-of-inline-styles-for-react-native-web