I want to update the screen when I return with react-native react-navigation.

Asked 2 years ago, Updated 2 years ago, 143 views

We are performing a screen transition with react-native react-navigation.
How do I refresh my screen when I return with ←?

The screen configurations are List and Detail.
"When the ""List"" screen is displayed, the ""Trigger from outside of a certain app"" will transition to the ""Details"" screen."
I'd like to update the list when I get back from there.

I wonder if any event will happen in the list when I return.
StackNavigator's onNavigationStateChange can also capture screen transitions, but
It might be nice to get an instance of "list" there, but
How can I get it?

react-native

2022-09-30 21:41

1 Answers

The focus event is available.

The focus event fires when the focus returns to the stacked "list" screen.

There are three ways to do it.

Detailed code samples are provided in the official document.

https://reactnavigation.org/docs/function-after-focusing-screen/


2022-09-30 21:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.