This repository was archived by the owner on Sep 13, 2020. It is now read-only.
Allow external toggle function#368
Open
traviisd wants to merge 1 commit intoKureev:masterfrom
traviisd:master
Open
Allow external toggle function#368traviisd wants to merge 1 commit intoKureev:masterfrom traviisd:master
traviisd wants to merge 1 commit intoKureev:masterfrom
traviisd:master
Conversation
Contributor
|
I've seen weird stuff where it triggers the event twice, but was able to get it to work without this using just the isOpen and onChange props. onChange just updates the state which is used as isOpen. Then I can just change the state to toggle the menu, but normal menu operation works just fine. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not sure if anyone else experiences this issue, but when the SideMenu is opened and closed via an external trigger, you have to tap the external button again in order for the toggle to work.
I thought this issue was related to facebook/react-native#12784, but everything I tried still resulted in the "toggle" button needing to be pressed twice after close. After debugging, I narrowed it down to this package. When I remove this package, buttons work just fine.
The behavior seems to only happen after the SideMenu is open. The menu closes, but any onPress function does not fire after, until it's pressed again. The internal state of the component updates the
isOpenprop on local state.This proposed change allows an externalToggle (function) be passed in, which fires when the "overlay" component is pressed.
Feedback is greatly appreciated as I don't know if this is a good workaround and/or update to the package. Additionally I'm not well versed with TypeScript.