Error when creating new object from existing one using `…`: In this environment the sources for assign MUST be an object

As @PitaJ pointed out, my issue was that StyleSheet.create doesn’t return a plain javascript object, so the ... operator can’t be applied.

I only want to add a solution to my original problem as well, that was to derive two different style objects from one basic one where only one property is added.

The docs for the StyleSheet API indicate that the method flatten can be used for this:

const amountBorderColor = this.state.isClaim ? 'green' : 'red'
const amountStyles = StyleSheet.flatten([styles.amountSection, {borderColor: amountBorderColor}])

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)