Skip to content

Commit

Permalink
fix(DateInput): optional with portal
Browse files Browse the repository at this point in the history
  • Loading branch information
zouxuoz committed Apr 30, 2019
1 parent a699e1d commit 67683ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/DateInput/DateInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type DateInputProps = {
onChange: (value: ?string) => void,
value: ?string,
withTime?: boolean,
withPortal?: boolean,
stretch?: boolean,
clearable?: boolean,
placeholder?: string,
Expand All @@ -26,6 +27,7 @@ type DateInputState = {|
class DateInput extends React.Component<DateInputProps, DateInputState> {
static defaultProps = {
stretch: true,
withPortal: true,
};

constructor(props: DateInputProps) {
Expand Down Expand Up @@ -90,7 +92,7 @@ class DateInput extends React.Component<DateInputProps, DateInputState> {
};

collectProps() {
const { value, withTime, ...rest } = this.props;
const { value, withTime, withPortal, ...rest } = this.props;

const dateFormat = withTime ? utils.DATETIME_FORMAT : utils.DATE_FORMAT;

Expand Down Expand Up @@ -119,7 +121,7 @@ class DateInput extends React.Component<DateInputProps, DateInputState> {
render() {
const collectedProps = this.collectProps();

const { value, withTime, stretch, onChange, clearable, placeholder, ...rest } = this.props;
const { value, withTime, withPortal, stretch, onChange, clearable, placeholder, ...rest } = this.props;

const { textValue, isOpen } = this.state;
const mask = withTime ? utils.DATETIME_MASK : utils.DATE_MASK;
Expand All @@ -142,7 +144,7 @@ class DateInput extends React.Component<DateInputProps, DateInputState> {
clearable={ clearable }
/>
</Dropdown.Head>
<Dropdown.Body withPortal modifiers={{
<Dropdown.Body withPortal={ withPortal } modifiers={{
preventOverflow: {
boundariesElement: 'viewport',
},
Expand Down
1 change: 1 addition & 0 deletions src/components/DateInputField/DateInputField.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('<DateInputField />', () => {
onChange={[MockFunction]}
stretch={true}
value="2018-11-07"
withPortal={true}
/>
</FormField>
`);
Expand Down

0 comments on commit 67683ba

Please sign in to comment.