IonPicker using react

Hi,
I don’t find any react example in ion-picker documentation. Is there any sample for it ? how can I present it in react? any property for that ?

imports…

import {  IonPicker } from "@ionic/react";
import { PickerColumn } from "@ionic/core";

functions…

  const getFirstColumn = () => {
    return {
      name: "First",
      options: [
        { text: "Aaron", value: "Aaron" },
        { text: "Andrea", value: "Andrea" }
      ]
    } as PickerColumn;
  };
  const getSecondColumn = () => {
    return {
      name: "Second",
      options: [
        { text: "Saunders", value: "Saunders" },
        { text: "Smith", value: "Smith" }
      ]
    } as PickerColumn;
  };

in render…

<IonPicker
  isOpen={true}
  columns={[getFirstColumn(),getSecondColumn()]}
  buttons={[
    {
      text: "Cancel",
      role: "cancel"
    },
    {
      text: "Confirm",
      handler: value => {
        console.log(value);
      }
    }
  ]}
></IonPicker>

1 Like

flushed this out abit more with a blog post a a full project
Ionic React Picker Example - DEV Community :woman_technologist::man_technologist: https://buff.ly/2vrYRLq

1 Like

wow Thank you so much aaronksaunders.