aksonov / aksonov/react-native-router-flux
How to get active tab from component?
- Langage dominant
- JavaScript
- Étoiles
- 8.9k
- Forks
- 2.1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
actions.currentScene() is great when the scene is not a part of a tab navigator. Is there a good way to tell which tab I am on from anywhere in my app?
My use case is I have an auto sliding carousel on my home screen, but I only want it to autoPlay when the user is on that tab.
I have tried to wrap a TouchableOpacity to each tab icon and dispatch an action on each press to keep track of which tab is active - I thought this would for sure work but when trying to change tabs they no longer receive the `props.focused` prop and do not change tabs on press (but it did keep track of the active tab from the press).
Has anyone come across this and solved it in a clean way, or am I just totally missing something?
Cheers.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.