Skip to content

Conversation

@markterence
Copy link

This is a fix for issue #16 and #12.

The code causes the error. picker/index.js#L27

Object.assign(styles.pickerMainAndroid, {
 backgroundColor: theme.pickerBgColor,
 borderBottomColor: theme.inputBorderColor,
 borderBottomWidth: theme.borderWidth,
})

I found two ways to prevent this error.

Error : You attempted to set the key backgroundcolor with the value "transparent"
on an object that is meant to be immutables and has been frozen.

A. Using Spread Operator (...) (This is what i used)

<View
  style={{...styles.pickerMainAndroid, ...{
    backgroundColor: theme.pickerBgColor,
    borderBottomColor: theme.inputBorderColor,
    borderBottomWidth: theme.borderWidth,
 }}}
>

B. Using Object.assign()

  • The first parameter should be an empty object.
<View
 style={Object.assign({}, styles.pickerMainAndroid, {
   backgroundColor: theme.pickerBgColor,
   borderBottomColor: theme.inputBorderColor,
   borderBottomWidth: theme.borderWidth,
})}
>

@bietkul bietkul merged commit 4bf0d1c into bietkul:master May 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants