How can I merge styles when using withUnistyles? #472
-
I'm trying to merge styles when using const UniInput = withUnistyles(TextInput);
const Input = ({ style, ...otherProps }) => {
// Attempt 1: Array of styles
// return <UniInput style={[styles.input, style]} {...otherProps} />;
// Attempt 2: Object spread
// return <UniInput style={{ ...styles.input, ...style }} {...otherProps} />;
return <UniInput style={styles.input} {...otherProps} />;
};
const styles = StyleSheet.create((theme) => ({
input: {
// some styles
},
})) I'm trying to merge additional styles with the base styles defined in component. Here's what I've tried and the errors I'm getting:
Therefore, I'm unable to merge additional styles with the styles defined in component by |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey, we removed this limitation in the PR. Will land in |
Beta Was this translation helpful? Give feedback.
Hey, we removed this limitation in the PR. Will land in
beta.5
. For now on you should simply use array syntax. Unistyles won't throw errors anymore.