Recently, I upgraded to react native navigation version 5 and now I am facing an issue with sending data back to the previous screen when making a goBack() call.
To navigate to the next view, I use:
const onSelectCountry = item => {
console.log(item);
};
navigation.navigate('SelectionScreen', {
onSelect: onSelectCountry});
After selecting an item from FlatList, I try to go back by using:
function onSelectedItem(item) {
route.params.onSelect(item);
navigation.goBack();
}
However, I get a warning about non-serializable values in the navigation state when sending functions as params. Can someone guide me on the correct way to achieve this?