-
Notifications
You must be signed in to change notification settings - Fork 20
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
Mixing hard coded and looped children causes error #6
Comments
Hey, @dave-irvine! Last weekend I got tired of problems like the one you described here and created react-native-controlled-picker. It is not the exact same solution, but it is the only 100% controlled and declarative picker I've found for RN so far :) Can you check if it solves your problem? I intend to deprecate react-native-picker-dropdown in favor of react-native-controlled-picker. |
Hi @danielweinmann, thanks for getting back to me and the advice. I'll give your other component a try, I'm sure it will solve the issue, but I will admit that I skipped over it originally because I'm not a big fan of the "controlled" pattern, i.e, having to pass the data to the component and not the children. On the other hand, if what you've got solves the problem then there is probably no good reason for me not to use it! |
I see 2 separate patterns:
I'm a huge fan of number 1 but have no strong opinion about number 2. The only reason I used the second pattern is that I use a FlatList and it receives a data prop. I'm going to leave this issue open just in case you or anyone else want to solve it on |
@danielweinmann Did you ditch the usage of ActionSheet in react-native-controlled-picker due to conflicts in the pattern or for more control over UI or something different altogether? |
@clintLandrum, I think I ditched it because I couldn't programmatically close the ActionSheet, and I needed to do so in order to make the dropdown work with react-native-stateless-form. But I'm not advocating for deprecating this module, I'm just not using it anymore :) If anyone wants to maintain it, I'll gladly welcome a new maintainer :) |
Hi,
Just stumbled across this issue where I want to provide children to the Picker by map()'ing an array to Picker.Items
This is causing an error here: https://github.com/danielweinmann/react-native-picker-dropdown/blob/master/Picker.js#L34 due to the 2nd element in the
children
array being an array of the 26 Picker.Item elements.If I remove the hard coded Picker.Item as follows, everything is fine, I'm just missing my default value Picker.Item
I can work around this by adding my default value to my
alphabet
array, but obviously that isn't a great solution.Or I can do:
but that seems like even more of a hack.
Any suggestions?
The text was updated successfully, but these errors were encountered: