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

Touch drag to close drawer #251

Open
sood03 opened this issue Dec 30, 2016 · 2 comments
Open

Touch drag to close drawer #251

sood03 opened this issue Dec 30, 2016 · 2 comments

Comments

@sood03
Copy link

sood03 commented Dec 30, 2016

I am able to close the drawer with back button press, tapping on the non-drawer area. I am looking for a way to drag the open area of drawer horizontally leftwards and close it. Is there any prop I need to set?

My Drawer definition looks like:

                <Drawer
                    type="overlay"
                    ref={(_drawer) => this.drawer = _drawer}
                    onOpen={this.openDrawer.bind(this)}
                    onClose={this.closeDrawer.bind(this)}
                    tapToClose={true}
                    open={this.state.drawerOpen}
                    openDrawerOffset={0.2}
                    panCloseMask={0.2}
                    panOpenMask={0.15}
                    acceptPan={true}
                    negotiatePan={true}
                    closedDrawerOffset={-3}
                    tweenEasing="easeInOutCirc"
                    tweenHandler={(ratio) => ({
                        main: {opacity: (2 - ratio) / 2}
                    })}
                >
@naiyt
Copy link

naiyt commented Feb 1, 2017

Try this:

panCloseMask={0.9}
captureGestures={'closed'}

Increasing the panCloseMask gives you more space in which you can pan the drawer closed. Setting captureGestures to closed means that you can still interact with things inside of the drawer.

The only problem I've run into with that is if I also have a view behind the drawer that responds to horizontal pans when captureGestures is set to closed. Since the drawer is no longer capturing those gestures, if I start the pan from outside of the drawer it will pan the backing view...

My compromise was setting panCloseMask to something like 0.4.

@tuyennguyen266
Copy link
Contributor

I added a PR to solve this issue here: #270.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants