Fix types for Radio Group

This commit is contained in:
Ed Moore 2018-07-23 12:01:42 +10:00 committed by 偏右
parent 007c7d0ef7
commit cd5cbafdf0
2 changed files with 5 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import shallowEqual from 'shallowequal'; import shallowEqual from 'shallowequal';
import Radio from './radio'; import Radio from './radio';
import { RadioGroupProps, RadioGroupState, RadioChangeEvent } from './interface'; import { RadioGroupProps, RadioGroupState, RadioChangeEvent, RadioGroupButtonStyle } from './interface';
function getCheckedValue(children: React.ReactNode) { function getCheckedValue(children: React.ReactNode) {
let value = null; let value = null;
@ -21,7 +21,7 @@ export default class RadioGroup extends React.Component<RadioGroupProps, RadioGr
static defaultProps = { static defaultProps = {
disabled: false, disabled: false,
prefixCls: 'ant-radio', prefixCls: 'ant-radio',
buttonStyle: 'outline', buttonStyle: 'outline' as RadioGroupButtonStyle,
}; };
static childContextTypes = { static childContextTypes = {

View File

@ -2,6 +2,8 @@ import * as React from 'react';
import { AbstractCheckboxGroupProps } from '../checkbox/Group'; import { AbstractCheckboxGroupProps } from '../checkbox/Group';
import { AbstractCheckboxProps } from '../checkbox/Checkbox'; import { AbstractCheckboxProps } from '../checkbox/Checkbox';
export type RadioGroupButtonStyle = 'outline' | 'solid';
export interface RadioGroupProps extends AbstractCheckboxGroupProps { export interface RadioGroupProps extends AbstractCheckboxGroupProps {
defaultValue?: any; defaultValue?: any;
value?: any; value?: any;
@ -12,7 +14,7 @@ export interface RadioGroupProps extends AbstractCheckboxGroupProps {
name?: string; name?: string;
children?: React.ReactNode; children?: React.ReactNode;
id?: string; id?: string;
buttonStyle?: 'outline' | 'solid'; buttonStyle?: RadioGroupButtonStyle;
} }
export interface RadioGroupState { export interface RadioGroupState {