Skip to content

Commit

Permalink
fix(TabItem): add missing @flow annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
evenchange4 committed Dec 10, 2018
1 parent 6f76e9a commit 88bb814
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"eslint": "5.10.0",
"flow-bin": "0.87.0",
"github-changes": "1.1.2",
"hsu-scripts": "0.2.1",
"hsu-scripts": "0.2.2",
"husky": "1.2.0",
"jest": "23.6.0",
"jest-specific-snapshot": "1.0.0",
Expand Down
1 change: 1 addition & 0 deletions src/TabItem/TabItem.example.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
import * as React from 'react';
import PropTypes from 'prop-types';
import { storiesOf } from '@storybook/react';
Expand Down
4 changes: 3 additions & 1 deletion src/TabItem/TabItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Item } from './styled-components';

export type Props = {
value: any,
active: boolean,
active?: boolean,
onClick?: (e: any, value: any) => void,
color?: Color,
};
Expand All @@ -21,13 +21,15 @@ export type InnerProps = {
class TabItem extends React.PureComponent<Props> {
static propTypes = {
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
active: PropTypes.bool,
onClick: PropTypes.func, // (e, value) => void
color: PropTypes.string,
};

static defaultProps = {
onClick: emptyFunction,
color: 'primary',
active: false,
};

onClick = (e: any) => {
Expand Down
6 changes: 6 additions & 0 deletions src/TabItem/__snapshots__/TabItem.example.storyshot
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,19 @@ exports[`Storyshots TabItem API 1`] = `

<div>
<TabItem
active={false}
color="primary"
onClick={[Function]}
value="key"
>
<styled-components__Item
active={false}
color="primary"
onClick={[Function]}
value="key"
>
<StyledComponent
active={false}
color="primary"
forwardedComponent={
Object {
Expand Down Expand Up @@ -315,16 +318,19 @@ exports[`Storyshots TabItem With color props 1`] = `

<div>
<TabItem
active={false}
color="warning"
onClick={[Function]}
value={1}
>
<styled-components__Item
active={false}
color="warning"
onClick={[Function]}
value={1}
>
<StyledComponent
active={false}
color="warning"
forwardedComponent={
Object {
Expand Down
1 change: 1 addition & 0 deletions src/TabItem/__tests__/TabItem.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
import * as React from 'react';
import { mount } from 'enzyme';
import { ThemeProvider } from 'styled-components';
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5299,10 +5299,10 @@ hosted-git-info@^2.1.4:
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047"
integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==

[email protected].1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/hsu-scripts/-/hsu-scripts-0.2.1.tgz#088f08fa408c133a17cd99f2b464b38a46658c55"
integrity sha512-ksaA2/tP9ng3gBOL6EeHwZO9CirstCjBw+UAUQh6z/Bhen/X/P/Q1dEZ1rffzVS6lwDJKbOnFnBuG4NYbMpTFw==
[email protected].2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/hsu-scripts/-/hsu-scripts-0.2.2.tgz#9c2916672788c9f25c2aab8022e978764fe4b106"
integrity sha512-NeW1F3J45wZK/tdKrfux070IEymyg6j2qabvN7+RYzXMr5pfjzPTuZy01nxyJtp7PUn8T4/px697WSr630kyoA==
dependencies:
"@babel/cli" "^7.2.0"
"@babel/core" "^7.2.0"
Expand Down

0 comments on commit 88bb814

Please sign in to comment.