AdelRedaa97 / react-native-select-dropdown

react-native-select-dropdown is a highly customized dropdown | select | picker | menu for react native that works for andriod and iOS platforms.
MIT License
320 stars 137 forks source link

Add selectItem method #72

Closed 360macky closed 1 year ago

360macky commented 2 years ago

Description of the PR

This Pull Request adds the selectItem method to the list of methods accessible from the ref of the component. This modification allows developers to change the selected value of the selector component from outside the component.

Purpose

I'm bringing this method because I'm in a situation where I need to set a value for this selector from outside the selector. And I think adding it from the ref would be much easier.

I look forward to reading your thoughts on whether this feature helps, or how to improve this feature.

Regards!

Closes #71.

sbozzella commented 1 year ago

Hi, how can i set "buttonTextAfterSelection" externally in Select Dropdown? I mean i can correctly set selectItem externally but then the text of the button is empty.

Thank you :)

360macky commented 1 year ago

Hi @sbozzella. I've been searching and currently there is no feature that can achieve that 😥.

AdelRedaa97 commented 1 year ago

You can select an item from outside the component using ref.current.selectIndex(index) it's added in v3.0.0 https://github.com/AdelRedaa97/react-native-select-dropdown/issues/71

360macky commented 1 year ago

Awesome. Thanks @AdelRedaa97! 👏