digidem / comapeo-mobile

The next version of Mapeo mobile
GNU General Public License v3.0
5 stars 1 forks source link

navigation error in ProjectInviteBottomSheet #391

Closed achou11 closed 3 months ago

achou11 commented 4 months ago

When responding to a project invite that results in a navigation action, I get the following error:

 ERROR  Error: Couldn't find a navigation object. Is your component inside NavigationContainer?

This error is located at:
    in InviteSuccessBottomSheetContent (at ProjectInviteBottomSheet/index.tsx:81)

This is because the ProjectInviteBottomSheet is trying to access the react-navigation hooks, but it can only do so if it's a child of a navigator (not just a navigation container). Right now, it lives as a child of the app navigation container, but as a sibling of the DrawerNavigator.

See https://github.com/digidem/comapeo-mobile/blob/7cda44ed6f099781c485898887f39e27e56d43c1/src/frontend/AppNavigator.tsx for an example of how to fix it.