`componentDidMount()` function is not called after navigation

后端 未结 9 1833
旧巷少年郎
旧巷少年郎 2020-12-09 03:38

I am using stackNavigator for navigating between screens. I am calling two API\'s in componentDidMount() function in my second activity. When i loa

9条回答
  •  温柔的废话
    2020-12-09 04:04

    If anyone coming here in 2019, try this:

    import {NavigationEvents} from 'react-navigation';
    

    Add the component to your render:

     console.log('I am triggered')} />
    

    Now, this onDidFocus event will be triggered every time when the page comes to focus despite coming from goBack() or navigate.

提交回复
热议问题