1 year ago
#203751
gkeenley
React Navigation: addListener('didFocus') called over and over
I'm using react-navigation@4.0.10
in my React Native app, and I want to trigger a function whenever the user switches tabs in my tab navigator. I tried this:
componentDidMount() {
this.props.navigation.addListener('didFocus', () => {
<call function>
})
}
The problem is this now gets called rapidly over and over, and never stops.
Is there a better way to approach this problem?
reactjs
react-native
react-navigation
tabnavigator
react-native-tabnavigator
0 Answers
Your Answer