Skip to content

Add controlled mode to select #198

Closed

Description

@Anon-136

Is your feature request related to a problem? Please describe.
I run to this problem where I want to have a confirm modal popping up after an option is selected.
But after I select the state has changed already and I have no way to control it and change it back if the user choose to cancel it.

Describe the solution you'd like
I want to have a control of the internal state: selectedOptionIndex, selectedOption, or else.
A nice react Select library should have 2 mode: uncontrolled and controlled.
It can be like
<Select value={...} options={[...]}>

Additional context
Some hacky solution: I remount the component by setting the new key and set default option to be the other one.

Activity

  1. kkaplinski commented on Mar 3, 2023

    @kkaplinski
    Contributor

    Hey @Anon-136 , thank you for your comment. Can you try to change it back with clear method called on cancel ? https://mobilereality.github.io/react-native-select-pro/docs/api/select#methods.

  2. locked and limited conversation to collaborators on Mar 3, 2023
  3. converted this issue into a discussion #199 on Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or requestquestionFurther information is requested

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions