Skip to content

Portal not displayed when it's inside BottomSheetModal #43

@JonasHiltl

Description

@JonasHiltl

I have an App with a TabNavigator and in one of the Tab screens I display a BottomSheetModal. The provider for this BottomSheetModal is in the same screen, since I want the model to be displayed behind the TabBar.

But I also have a Portal in the model which I want to display above the TabBar, so I placed my PortalProvider and PortalHost outside of the screen above my TabNavigator, notably above the BottomSheetModalProvider.
When the Portal has no custom hostname it uses the BottomSheetModalProvider as the PortalProvider, which I expected, since BottomSheetModalProvider wraps a PortalProvider.

But when a hostName is specified (see example below) the Portal is not displayed at all, like the PortalHost couldn't be found. So it skips the BottomSheetModalProvider but does not find the PortalHost above it.

<App>
  <PortalProvider>
    <TabNavigator>
      <TabScreen/>
    <TabNavigator/>
    <PortalHost name="AboveTabBar" />

An example screen in the TabNavigator:

const TabScreen = () => {
  return (
    <BottomSheetModalProvider>
      <Portal hostName="AboveTabBar">
        <Text>test</Text>
      </Portal>
      <BottomSheetModal>
        ...
      </BottomSheetModal>
    </BottomSheetModalProvider>
  )
}

Could this be fixed by using a custom hostName inside BottomSheetModalProvider, so that custom portals don't use that as the host?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions