Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DatePicker): make appendTo back working #4215

Merged
merged 3 commits into from
Oct 10, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/react/src/components/DatePicker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ export default class DatePicker extends Component {
]),

/**
* The DOM element or selector the Flatpicker should be inserted into. `<body>` by default.
* The DOM element the Flatpicker should be inserted into. `<body>` by default.
*/
appendTo: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
appendTo: PropTypes.object,

/**
* The `change` event handler.
Expand Down Expand Up @@ -321,6 +321,7 @@ export default class DatePicker extends Component {

componentDidMount() {
const {
appendTo,
datePickerType,
dateFormat,
locale,
Expand All @@ -334,13 +335,11 @@ export default class DatePicker extends Component {
this.updateClassNames(instance);
};

let appendToNode;

// inputField ref might not be set in enzyme tests
if (this.inputField) {
this.cal = new flatpickr(this.inputField, {
defaultDate: value,
appendTo: appendToNode,
appendTo,
mode: datePickerType,
allowInput: true,
dateFormat: dateFormat,
Expand Down