I'm new to React and React Native. At the moment for each component I'm breaking the code into 2 separate files:
index.js
for all the React code, and;styles.js
for the StyleSheet
Is there a way to pass props into the external StyleSheet?
Example:
index.js
:
render() {
const iconColor = this.props.color || '#000';
const iconSize = this.props.size || 25;
return (
<Icon style={styles.icon} />
);
}
See Question&Answers more detail:os