Skip to content

Why Picker.prompt can't setting value? #5249

Answered by GOWxx
cksal0805 asked this question in Q&A
Discussion options

You must be logged in to vote

I think this works

        const [pickerState, setPickerState] = useState([]);

        onClick={async () => {
          await Picker.prompt({
            columns: [
              [
                { label: "Foo", value: "foo" },
                { label: "Bar", value: "bar" }
              ]
            ],
            onConfirm: (value) => setPickerState(value),
            value: pickerState
          });
        }}

I fork your codesandbox and make changes

// line: 5
const [pickerState, setPickerState] = useState([]);
// line: 21
value: pickerState

you can check the code here

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@cksal0805
Comment options

Comment options

You must be logged in to vote
3 replies
@cksal0805
Comment options

@GOWxx
Comment options

@cksal0805
Comment options

Answer selected by awmleer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants