-
Notifications
You must be signed in to change notification settings - Fork 957
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
Select component mutating props #804
Comments
Hi @saby1101 |
If you use immerjs, it will use Object.freeze internally on the objects to ensure immutability. Also, as far as I understand props of a component should not be modified. Quoting from a StackOverflow answer: "A component should manage its own state, but it should not manage its own props. props is essentially "state that is managed by the component owner." That's why props are immutable." https://stackoverflow.com/questions/47471131/why-are-react-props-immutable |
Got it. Let's keep it open so we can back to this in the nearest future. Thanks for reporting 👍 |
Currently, I am making a copy of the object and then assigning it to props. |
🐛 Bug Report
Passing read-only array to Select component (Multi-select mode) causes crash.
"selectedOption is readonly"
To Reproduce
Steps to reproduce the behavior:
Object.freeze([array])
toselectedOption
propIssue is at
react-native-ui-kitten/src/components/ui/select/selection.strategy.ts
Line 83 in f5f13d7
Expected behavior
No crash
Link to runnable example or repository (highly encouraged)
UI Kitten and Eva version
Environment information
The text was updated successfully, but these errors were encountered: