Skip to content

Commit

Permalink
fix: correct types
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed May 19, 2020
1 parent f5b99b4 commit d023594
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/ui/src/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react";
import React, { ReactNode } from "react";
import classNames from "classnames";
import { TabBar } from "@rmwc/tabs";
import { Tab, TabProps } from "./Tab";
Expand All @@ -11,7 +11,7 @@ export type TabsProps = {
/**
* A collection of tabs that needs to be rendered.
*/
children: ((props: TabsRenderProps) => React.ReactElement) | React.ReactElement;
children: ((props: TabsRenderProps) => ReactNode) | ReactNode;

/**
* Append a class name.
Expand Down Expand Up @@ -110,10 +110,9 @@ export class Tabs extends React.Component<TabsProps, State> {

render() {
let children = this.props.children;
if (typeof children === "function") {
children = children({
switchTab: this.switchTab.bind(this)
});
if (typeof this.props.children === "function") {
// @ts-ignore
children = this.props.children({ switchTab: this.switchTab.bind(this) });
}

return this.renderChildren(children);
Expand Down

0 comments on commit d023594

Please sign in to comment.