Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Swipe menu manual open #161

Merged
merged 6 commits into from
Jul 31, 2017
Merged

Swipe menu manual open #161

merged 6 commits into from
Jul 31, 2017

Conversation

alburdette619
Copy link
Contributor

@alburdette619 alburdette619 commented Apr 28, 2017

This PR includes functions following the close prop architecture to open the right and left menus programmatically. In order for this to work the PanResponder handling had to be worked on such that inside views could still have touch events. The wrong pan methods were being used for the sensitivity to work. Also, onClose and onOpen were only called on a pan so they were moved such that they are called in _close() and _openRight/Left.

Adam Burdette added 5 commits April 24, 2017 18:23
Added a manual open that follows the current architecture for close.  By setting openRight or openLeft, componentWillReceiveProps will call the corresponding function and open the menu appropriately.
The gesture eventing was not setup correctly such that touchables could still get events inside of the swipeable view.

Using the view’s Capture functions instead of the PanResponder dosn’t give as much info so those props were removed and moved to the PanResponders create method.  onStartShouldSetPanResponderCapture did not seem necessary.  onMoveShouldSetPanResponder seemed to never be called and its logic was moved to onMoveShouldSetPanResponderCapture that IS called when a touchable is pressed/gestured inside the swipable view such that sensitivity can be taken into account.
The _openLeft function set tweenContent based on the right buttons.
Attempting to fix state problem with removing Promises from openRight and openLeft and instead using the setState callback to call the tweenContent and set the final state.

Currently the issue is that if an open button is used to open the swipe menu, the swipe state is now tied together with other swipe menus on swipe.
onClose and onOpen were only being called on swipe.  This ensures that they are called in all cases.
@silentcloud
Copy link
Collaborator

@alburdette619 Thanks for your PR. Please resolve conflicts

@alburdette619
Copy link
Contributor Author

Sorry it took me so long to get back to you on this. It should be good to merge in if you're happy with the way I merged it all.

@cjcheshire
Copy link

This sounds very interesting as I would like to do this on my screen to suggest to users there are swipe controls. @silentcloud are you happy with this.

Is there an example of how this works once merged?

@cjcheshire
Copy link

@alburdette619 any progress?

@lyndsey-ferguson
Copy link

I am also interested in getting this functionality.

@katmlee
Copy link

katmlee commented Jul 24, 2017

I'm also interested in this functionality +1 Thanks @alburdette619! @silentcloud any update?

@silentcloud
Copy link
Collaborator

This PR is still a little problem, please consider componentDidMount

@rtman
Copy link

rtman commented Jul 25, 2017

@alburdette619 @silentcloud I'd like to use this as well to open the right and left via onPress or long press, anyway we can get it finished?

@lyndsey-ferguson
Copy link

@silentcloud can you add the ability to open the swipeout manually if you're not happy with this approach?

@silentcloud
Copy link
Collaborator

@lyndsey-ferguson Ok, I will approve this PR, If someone has problems using openLeft/openRight, welcome PR.

@silentcloud silentcloud merged commit e8fb800 into dancormier:master Jul 31, 2017
@silentcloud
Copy link
Collaborator

version 2.2.0

@maximromanyuk
Copy link

@silentcloud maybe add some info to README?

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants