๐ŸŽ‰ True Sheet 4.0 is out with a rewritten layout engine. Read the announcement ยท Migration guide
Guides

Global Methods

Bottom sheet's global methods that you can invoke from anywhere.

TrueSheet relies heavily on component methods to present and dismiss the sheet. However, this becomes challenging when the button is deep within the component tree.

To resolve this issue, TrueSheet provides global methods that allow you to present or dismiss any sheet from anywhere!

How?

Somewhere in your App, define the sheet with a name.

const App = () => {
  return (
    <TrueSheet name="my-sheet">
      <View />
    </TrueSheet>
  )
}

In your component, present the sheet using the present global method.

import { TrueSheet } from '@lodev09/react-native-true-sheet'

const SomeComponent = () => {
  const presentMySheet = () => {
    TrueSheet.present('my-sheet') // ๐ŸŽ‰
  }

  return (
    <Button onPress={presentMySheet} title="Present My Sheet" />
  )
}

Guess what? You can also dismiss it globally ๐Ÿคฉ.

TrueSheet.dismiss('my-sheet') // โœ…
Edit on GitHub

On this page