Refresh previous screen on goBack()

前端 未结 11 1827
天命终不由人
天命终不由人 2020-12-13 09:34

I am new to React Native. How can we refresh/reload previous screen when returning to it by calling goBack()?

Lets say we have 3 screens A, B, C:

<
11条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 10:07

    For react-navigation 5.x use

    5.x

    use

    componentDidMount() {
            this.startData();
    
            this.focusListener = this.props.navigation.addListener('focus', () => {
                this.startData();
                //Put your Data loading function here instead of my this.LoadData()
            });
    }

提交回复
热议问题