Reputation: 135
when go from category to productList for the first time everything is right but after i came back and try to go for second time list screen won't rerender or refresh what ever you call. is there anyone has suggestions
Upvotes: 0
Views: 883
Reputation: 1280
The list Screen gets data on mount and that's it. If you want it to gets a new data every time the category name changes you have to add it to the useEffect dependencies like so.
const categoryName = navigation.route.params.categoryName;
useEffect(() => {
getData();
},[categoryName]);
Now every time categoryName changes getData gets called.
Upvotes: 2
Reputation: 6646
if you are using tabs just add unmountOnBlur: true,
in the <Tab.Screen/> of the screen you are in
Upvotes: 0