Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for picker #17

Merged
merged 1 commit into from
May 26, 2018
Merged

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.

None yet

2 participants