Skip to content
Docs
Components
DraggableModal

DraggableModal

Component to render a draggable modal, based on react-native-bottom-sheet

https://github.com/gorhom/react-native-bottom-sheet (opens in a new tab)

Import

import { DraggableModal } from 'react-native-ficus-ui';

Usage

EDITABLE EXAMPLE
const TestModal = () => {
  const { isOpen, onOpen, onClose } = useDisclosure();
  
  return (
    <ThemeProvider>
      <Box h={500} bg="gray.50" p="xl">
        <Button
          colorScheme={!isOpen ? 'green' : 'red'}
          onPress={() => {
            if (!isOpen) {
              onOpen();
            } else {
              onClose();
            }
          }}
        >
          {!isOpen ? 'Show Modal' : 'Hide Modal'}
        </Button>

        <DraggableModal
          isOpen={isOpen}
          onClose={onClose}
          snapPoints={['30%', '80%']}
          p="xl"
        >
          <Text fontSize="4xl" fontWeight="bold">
            Settings
          </Text>

          <Text mt="xl">Your settings</Text>
        </DraggableModal>
      </Box>
    </ThemeProvider>
  );
}
render(<TestModal />)

Props

Extends every Box props and BottomSheetModalProps from react-native-bottom-sheet

isOpen

Boolean to indicate if modal is opened or not.

TypeRequiredDefault
booleanNofalse

onClose

Method called when modal is closed by user.

TypeRequired
() => voidNo