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

TypeError: In this environment the sources for assign MUST be an object. This error is a performance optimization and not spec compliant. #140

Closed
johanquiroga opened this issue Jan 30, 2019 · 0 comments

Comments

@johanquiroga
Copy link

Describe the bug

When either one of item or value changes the component re-renders and the method getDerivedStateFromProps runs. In this method at the return the following validation is made:

return {
  ...(itemsChanged && { items }),
  ...(selectedItemChanged && { selectedItem }),
};

This form of validation is causing me the following error:
screenshot_20190130-165252_punga

To Reproduce

Steps to reproduce the behavior:

In my case I'm setting the items values from a data stored in redux, whenever this data is updated and the items change, but value doesn't, the error occurs.

Expected behavior

Not crash if only one of itemsChanged or selectedItemChanged changes.

According to this comment only had to change the return to the following to prevent the error:

return {
  ...(itemsChanged ? { items } : {}),
  ...(selectedItemChanged ? { selectedItem } : {}),
};

Screenshots

If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: Samsung Galaxy S8 - Any iPhone Simulator
  • OS: Android 8 - iOS 12
  • react-native-picker-select version: 5.2.2
  • react-native version: 0.55.4
  • react version: 16.3.2

Reproduction and/or code sample

Provide a link to a reproduction of this issue on https://snack.expo.io or a good explanation on why you can not. Not including a link will result in a significant delay in our ability to address this issue.

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

No branches or pull requests

2 participants