Skip to content

Children is required but docs show no children in example code #17897

Closed

Description

@o-t-w

Bug Report

Ionic version:
"@ionic/react": "0.0.5",

Current behavior:
Typescript is telling me that children is required for IonActionSheet.

Property 'children' is missing in type '{ isOpen: boolean; onDidDismiss: () => void; buttons: ({ text: string; role: string; icon: string; handler: () => void; } | { text: string; icon: string; handler: () => void; })[]; }' but required in type 'Readonly<IonActionSheetAttributes & { children: ReactNode; isOpen: boolean; onDidDismiss: (event: CustomEvent<OverlayEventDetail<any>>) => void; }>'.

Expected behavior:
The docs example code shows the IonActionSheet with no children.

Related code:

import React, { useState } from "react";

import { IonActionSheet } from "@ionic/react";

const Actionsheet = () => {
  const [showing, setShowing] = useState(false);

  return (
    <IonActionSheet
      isOpen={showing}
      onDidDismiss={() => setShowing(false)}
      buttons={[
        {
          text: "Delete",
          role: "destructive",
          icon: "trash",
          handler: () => {
            console.log("Delete clicked");
          }
        },
        {
          text: "Share",
          icon: "share",
          handler: () => {
            console.log("Share clicked");
          }
        },
        {
          text: "Play (open modal)",
          icon: "arrow-dropright-circle",
          handler: () => {
            console.log("Play clicked");
          }
        },
        {
          text: "Favorite",
          icon: "heart",
          handler: () => {
            console.log("Favorite clicked");
          }
        },
        {
          text: "Cancel",
          icon: "close",
          role: "cancel",
          handler: () => {
            console.log("Cancel clicked");
          }
        }
      ]}
    />
  );
};

export default Actionsheet;

Ionic info:

Ionic:

   ionic (Ionic CLI) : 4.12.0

System:

   NodeJS : v10.15.2
   npm    : 6.4.1
   OS     : macOS Mojave```

Activity

  1. added
    package: react
    on Apr 4, 2019
  2. elylucas commented on Jun 6, 2019

    @elylucas
    Contributor

    Fixes for this will be coming up in the next beta release

  3. ionitron-bot commented on Jul 6, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  4. locked and limited conversation to collaborators on Jul 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: react

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions