OneScript

fullScreenCover

Present content that covers the whole screen.

fullScreenCover(options) takes the same options as sheet, but the content covers the whole screen and can't be swiped away, so provide a close button inside it.

import { Button, Modifier, Text, useState, VStack } from "onescript/views"

function Onboarding() {
  const [shown, setShown] = useState(true)

  return (
    <Text modifier={Modifier.fullScreenCover({
      isPresented: shown,
      onDismiss: () => setShown(false),
      content: (
        <VStack spacing={16}>
          <Text>Welcome</Text>
          <Button action={() => setShown(false)}>Get Started</Button>
        </VStack>
      ),
    })}>
      Home
    </Text>
  )
}
OptionTypeDescription
isPresentedbooleanWhether the cover is shown.
onDismiss() => voidCalled when the system dismisses the cover; set isPresented to false here.
contentViewChildThe presented content.

How is this guide?

Last updated on