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

[SwipeableDrawer] Allow custom style #11805

Merged
merged 1 commit into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class SwipeableDrawer extends React.Component {
ModalProps: { BackdropProps, ...ModalPropsProp } = {},
onOpen,
open,
PaperProps,
PaperProps = {},
swipeAreaWidth,
variant,
...other
Expand All @@ -355,7 +355,10 @@ class SwipeableDrawer extends React.Component {
}}
PaperProps={{
...PaperProps,
style: { pointerEvents: variant === 'temporary' && !open ? 'none' : '' },
style: {
pointerEvents: variant === 'temporary' && !open ? 'none' : '',
...PaperProps.style,
},
ref: this.handlePaperRef,
}}
{...other}
Expand Down
15 changes: 15 additions & 0 deletions packages/material-ui/src/SwipeableDrawer/SwipeableDrawer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ describe('<SwipeableDrawer />', () => {
wrapper.unmount();
});

it('should accept user custom style', () => {
const customStyle = { style: { backgroundColor: 'hotpink' } };
const wrapper = mount(
<SwipeableDrawerNaked
onOpen={() => {}}
onClose={() => {}}
open={false}
theme={createMuiTheme()}
PaperProps={customStyle}
/>,
);

assert.strictEqual(wrapper.props().PaperProps, customStyle);
});

describe('swipe to open', () => {
let wrapper;
let instance;
Expand Down