Skip to content

How to pass data back to previous screen in react native navigation v5?

I just updated to react native navigation version 5. Now I am trying to send data back to previous screen on goBack() call.

I push next view with

const onSelectCountry = item => {
navigation.navigate('SelectionScreen', {
        onSelect: onSelectCountry});

And making move back after selecting item from FlatList with call:

function onSelectedItem(item) {

But by sending function over with params I get a warning: Non-serializable valuse were found in the navigation state…

Can someone please tell me correct way to do this.


navigation send data to screens.

onPress={() => {
          // Pass params back to home screen
          navigation.navigate('Home', { post: postText });

follow official documentation React Native