PR already exists but probably needs to be rebased at this point:
Currently there is no way to pass an
handler to
. There are many reasons why someone would want to do this, and I've found several people looking for this functionality on stackoverflow. For me personally, some of my
components are
s, and I want to be able to reset the stack when the drawer item is pressed.
I am aware of the ability to pass your drawer navigator a custom
where you can then pass it
s with
handlers, and I am already doing that for some things like my logout button. Trying to use that for screens seems pretty cumbersome though, since it seems like then you have to implement all of the navigation and focused logic as well as drawer open/close state. Additionally, you can only place them before or after all of your regular
s that are rendered via
I solved this by adding an optional
that gets passed the normal
handler. That way the user can do what they want, and call the default
before or after (or not at all?)
My best guess as for why this functionality does not currently exist is that it can allow the user to do things that conflict with what react-navigation is doing internally when you tap on a drawer item, which could lead to bugs. If this is the case, maybe it could be called
? That said, I have been using this without any issues.