eslint-plugin-react-native
eslint-plugin-react-native copied to clipboard
no-unused-styles doesn't support conditional styles
I often add conditional styles to my components and no-unused-styles doesn't see that the style is actually used in the code.
const styles = StyleSheet.create({
container: {
padding: 1,
},
'container--critical': {
backgroundColor: MY_RED_CONST,
},
});
const Component = ({ shouldBeRed }) => (
<View style={[styles.container].concat(shouldBeRed ? styles['container--critical'] : [])}>
<Text>This is some text</Text>
</View>
);
Thanks for reporting, feel free to open a PR or wait until I have time to look into it :)