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

<Tabs> backToInitial and tabBarOnPress interaction #2932

Closed
blah1234 opened this issue Mar 13, 2018 · 5 comments
Closed

<Tabs> backToInitial and tabBarOnPress interaction #2932

blah1234 opened this issue Mar 13, 2018 · 5 comments

Comments

@blah1234
Copy link

blah1234 commented Mar 13, 2018

Version

  • react-native-router-flux v4.0.0-beta.28
  • react-native v0.53.0

Actual behaviour

I've found that if the "backToInitial" property is set for Tabs, then any function defined for the "tabBarOnPress" property is not called.

Expected behaviour

After browsing through the source code a bit, I see that "backToInitial" itself is implemented as a function set to "tabBarOnPress". I would have expected that any function users pass into the "tabBarOnPress" property be chained together with the "backToInitial" function if both "backToInitial" and "tabBarOnPress" are set for Tabs.

At the very least, the API documentation should notify users of the current behavior.

@aaron25mt
Copy link

Created a fix for this, will make a PR.
See my repo here if you need the fix ASAP.

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

Please try to reproduce it with Example project and latest version 4.0.0-beta.40. Feel free to open if the issue still exists

@aksonov aksonov closed this as completed Aug 8, 2018
@og24715
Copy link

og24715 commented Sep 7, 2018

@aksonov Still happen on v4.0.1 😡
Do you mean what this issue was solved on only beta40, but pending on v4.0.1? I was tried v4.0.1 and v4.0.2-dev. However, both not work for me.
You can try reproduce this issue by add tabBarOnPress with backToInitial in your Example project.

@daviscabral
Copy link
Collaborator

PR for better documentation to avoid this confusion for other users is welcome. But yeah, looking at the code I saw that if you define backToInitial - it's not possible to define tabBarOnPress - and keeping both handlers might be even worst (and harder to debug). I believe a warning would be fine - telling the user that the tabBarOnPress defined will be overwritten due the backToInitial flag defined.

@daviscabral
Copy link
Collaborator

I am pushing a PR with this change - I believe it does not hurt. :-)

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

5 participants