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

Drawer default prop warning fix #3382

Merged
merged 2 commits into from
Feb 27, 2019
Merged
Changes from all commits
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
5 changes: 3 additions & 2 deletions packages/core/src/components/drawer/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class Drawer extends AbstractPureComponent<IDrawerProps, {}> {
public static displayName = `${DISPLAYNAME_PREFIX}.Drawer`;
public static defaultProps: IDrawerProps = {
canOutsideClickClose: true,
isCloseButtonShown: true,
isOpen: false,
style: {},
vertical: false,
Expand Down Expand Up @@ -115,7 +114,9 @@ export class Drawer extends AbstractPureComponent<IDrawerProps, {}> {
}

private maybeRenderCloseButton() {
if (this.props.isCloseButtonShown) {
// `isCloseButtonShown` can't be defaulted through default props because of props validation
// so this check actually defaults it to true (fails only if directly set to false)
if (this.props.isCloseButtonShown !== false) {
return (
<Button
aria-label="Close"
Expand Down