3.3.4 • Published 4 years ago

react-drag-drawer v3.3.4

Weekly downloads
1,270
License
MIT
Repository
github
Last release
4 years ago

react-drag-drawer

npm package

Mobile draggable drawer that falls back to modals on desktop

Live demo!

Install

$ npm install react-drag-drawer --save

Usage

import Drawer from 'react-drag-drawer'

..

toggle = () => {
  let { toggle } = this.state

  this.setState({ toggle: !toggle })
}

render () {
  const { open } = this.state

  return (
    <Drawer
      open={open}
      onRequestClose={this.toggle}
    >
      <div>Hey Im inside the drawer!</div>
    </Drawer>
  )
}

npm.io

API

ParamTypefunctionalityrequired
openBooleannulltrue
childrenNodenulltrue
onRequestCloseFunctionnulltrue
onDragFunctioninvoked on dragfalse
onOpenFunctioninvoked on drawer focusfalse
notifyWillCloseFunctionnotify consumer if the drawer will close at touch releasefalse
allowCloseBooleanblock closing if allowClose={false}, default is truefalse
modalElementClassStringclassName to be applied to top elementfalse
containerElementClassStringclassName to be applied to the drawer container elementfalse
parentElementrefblock scrolls on element if you're not using body scrollingfalse
directionStringdirection to translate drawerfalse
dontApplyListenersBooleanskip applying internal event listeners to the domfalse
inViewportChangeFunctiondetect when drawer is at top of viewportfalse
getModalRefFunctionget modal (draggable element) reffalse
getContainerRefFunctionget container (overlay) reffalse

Example modal style

.modal {
  outline: none;
  background: white;
  font-size: 1.6rem;
  width: 76rem;
  max-width: 90%;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  z-index: 15;
  min-height: 47rem;

  will-change: transform;
  transform: translate3d(0, 0, 0);
}

@media (max-width: 768px) {
  .modal {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
}

License

MIT © Jack Hanford

3.3.4

4 years ago

3.3.3

4 years ago

3.3.2

4 years ago

3.3.1

5 years ago

3.3.0

6 years ago

3.2.0

6 years ago

3.1.2

6 years ago

3.1.1

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.1.1-17

6 years ago

2.1.1-16

6 years ago

2.1.1-15

6 years ago

2.1.1-14

6 years ago

2.1.1-13

6 years ago

2.1.1-12

6 years ago

2.1.1-11

6 years ago

2.1.1-10

6 years ago

2.1.1-9

6 years ago

2.1.1-8

6 years ago

2.1.1-7

6 years ago

2.1.1-6

6 years ago

2.1.1-5

6 years ago

2.1.1-4

6 years ago

2.1.1-3

6 years ago

2.1.1-1

6 years ago

2.1.1-0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.1.0-beta.1

6 years ago

2.1.0-beta.0

6 years ago

2.0.0

6 years ago

2.0.0-beta.4

6 years ago

2.0.0-beta.3

6 years ago

2.0.0-beta.2

6 years ago

2.0.0-beta.1

6 years ago

2.0.0-beta.0

6 years ago

1.12.1

7 years ago

1.12.0

7 years ago

1.11.8

7 years ago

1.11.7

7 years ago

1.11.6

7 years ago

1.11.5

7 years ago

1.11.4

7 years ago

1.11.3

7 years ago

1.11.2

7 years ago

1.11.1

7 years ago

1.11.0

7 years ago

1.10.0

7 years ago

1.9.0

7 years ago

1.8.5

7 years ago

1.8.4

7 years ago

1.8.3

7 years ago

1.8.2

7 years ago

1.8.1

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.0

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.4

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago