Skip to content

[Bug?] ModalBottomSheet loses contexts #61

Description

@deniz-blue

ModalBottomSheet (when not nativeOverlay) seems to use a custom in-library Portal implementation that reparents the sheet into a different tree, this makes child components/tree unable to use existing context from the tree.

// psuedocode
const Cx = createContext();

const SheetUser = () => {
  return (
    <Cx value={1}>
      <ModalBottomSheet ...>
         <Inner />
      </ModalBottomSheet>
    </Cx>
  )
}

const Inner = () => {
  const value = useContext(Cx)
  // value is always undefined
  return ...
}

This should either be documented on the documentation or it could be solved by using a library such as react-native-teleport

PS. I came across this issue while trying to add keyboard avoidance to a nativeOverlay modal sheet, and it does not seem to be really possible - keyboard state is undetectable inside the sheet. Should I make another issue for that?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions