Default Image

Modal

Modal dialogs.

import { Modal } from '@redshank/native';

When To Use

When requiring users to interact with the application, but without jumping to a new page and interrupting the user's workflow, you can use Modal to create a new floating layer over the current page to get user feedback or display information. Additionally, if you need show a simple confirmation dialog, you can use Pop Confirm, and so on.

Examples

Modal

Default Modal element.

Position Top/Bottom

Position Modal element.

Scroll Modal

Scroll in Modal element.

Hidden StatusBar

Hidden StatusBar in iOS and Android.

Mask Closable

Closable modal when press outside Modal content.

With Extra Content

With extra content prop.

APIs

Api props extends from Modal

AttributeTypeAccepted valuesDescriptionDefault
animationTypeEnumfadeslidenone
buttonCloseStyleobjectStyleProp<ViewStyle>Style for close button-
childrenReactNodeComponent JSX.ELementContent for show in the modal-
closablebooleantrue falseShow or hidden close buttonfalse
closeIconPropsobjectIconPropsProps for Icon close, change name or type icon-
contentContainerStyleobjectStyleProp<ViewStyle>Style for scrollview in modal-
contentStyleobjectStyleProp<ViewStyle>Style of the scrollView-
extraReactNode JSX.ElementComponentExtra content in bottom modal-
fullScreenbooleantrue falseShow content in full screenfalse
hiddenBarbooleantrue falseShow or hidden statusbar in mobilesfalse
maskClosablebooleantrue falseAllow close modal when press outside modalfalse
maskComponentComponent FunctionComponentJSX.Element ComponentChange component mask modalView if maskClosable then TouchableOpacity
maskStyleobjectStyleProp<ViewStyle>Style of the mask component-
onClosefunction() => voidRequired function for close modal-
positionPositionTypetop center bottomPosition of the modal, when fullScreen is falsecenter
scrollablebooleantrue falseCan scroll in modal contentfalse
visiblebooleantrue falseRequired controller show or hidden modal-

useModal

Api for show or hidden modal with hook.

Basic use
const [visible, toggleModal] = Modal.useModal();
Completed use
const [
  visible,
  toggleModal,
  { onVisible, onHidden }
] = Modal.useModal();

Community:

We're excited to see the community adopt @redshank/native, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!

DiscordGithub

Contributing:

PR's on @redshank/native are always welcome, please see our contribution guidelines to learn how you can contribute to this project.

Copyright © 2023 @redshank.