'Navigation error: Null is not an object (evaluating '_navigation$getParam.id')

I don't know why my navigation isn't working properly, it throws me the following error every time I want to navigate back to my EventAssistants screen from my UserProfile screen:

TypeError: Null is not an object (evaluating '_navigation$getParam.id')

I have my stack navigators defined as follows:

const SearchStack = createStackNavigator(
  {
    Map: Map,
    Search: Search,
    SearchPeople: SearchPeople,
    FollowerProfile: Profile, // <- This is where I try to go back to the EventAssistants screen
    ...
  },
  {
    initialRouteName: 'Map',
    ...
  },
);

const EventEditStack = createStackNavigator(
  {
    View: EventView,
    EditEvent: EditEventView,
    EventAssistants: EventAssistants, // <- This is where I try to go back
    ...
  },
  {
    initialRouteName: 'EventView',
    ...
  },
);

And over here I have the script of the button that should navigate to the EventAssistants screen, it is defined on the UserProfileScreen:

const {returnToScreen, imHostOrCoHost} = eventAssistantsItem;
item = itemEvent.id;
navigation.navigate('EventAssistants', {item, returnToScreen, imHostOrCoHost});

As you can see, the EventAssistants screen takes some parameters, and testing with console.log()s on the EventAssistants gives me the expected parameters when navigating from any screen to it, including UserProfile. So, how can I solve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source