react-native-select-dropdown icon indicating copy to clipboard operation
react-native-select-dropdown copied to clipboard

Add selectItem method

Open marcelo-earth opened this issue 3 years ago • 2 comments

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.

marcelo-earth avatar Jun 16 '22 02:06 marcelo-earth

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 :)

sbozzella avatar Oct 14 '22 08:10 sbozzella

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

marcelo-earth avatar Oct 14 '22 14:10 marcelo-earth

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

AdelRedaa97 avatar Oct 21 '22 15:10 AdelRedaa97

Awesome. Thanks @AdelRedaa97! 👏

marcelo-earth avatar Oct 21 '22 16:10 marcelo-earth