I'm using [email protected] 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?