Skip to main content

Overlays

Centered dialog.

npx midestic-rn-library add modal
<Modal visible={visible} onClose={() => setVisible(false)} title="Delete account">
<View className="gap-[16px]">
<ThemedText>This action cannot be undone.</ThemedText>
<Button title="Delete" variant="danger" fullWidth onPress={remove} />
</View>
</Modal>
PropTypeDefaultDescription
visibleboolean-Show/hide
onClose() => void-Backdrop press, close button and Android back
childrenReactNode-Dialog body
titlestring-Header text
showCloseButtonbooleantrueRenders the header close button
closeOnBackdropPressbooleantrueDismiss on backdrop press
classNamestring""Classes on the sheet
contentClassNamestring""Classes on the content row

Drawer​

Bottom sheet version of Modal with the same prop set.

npx midestic-rn-library add drawer
<Drawer visible={visible} onClose={() => setVisible(false)} title="Filters">
<View className="gap-[8px] px-[16px] pb-[24px]">
<ThemedText>Only rides with AC</ThemedText>
</View>
</Drawer>

DraggableDrawer​

Multi step, gesture driven bottom sheet. Steps are React components that receive step helpers.

npx midestic-rn-library add draggable-drawer
const StepOne = ({ nextStep, onClose }: DrawerStepProps) => (
<View className="gap-[16px] px-[20px] pb-[24px]">
<ThemedTitle>Cancel this trip?</ThemedTitle>
<Button title="Yes, cancel" variant="danger" fullWidth onPress={onClose} />
<Button title="Next" variant="outline" fullWidth onPress={nextStep} />
</View>
);

<DraggableDrawer
visible={visible}
onClose={() => setVisible(false)}
title="Cancel trip"
steps={[StepOne, StepTwo]}
initialMaxHeight="70%"
/>;
PropTypeDefaultDescription
visibleboolean-Show/hide
onClose() => void-Backdrop/close button handler
stepsComponentType<DrawerStepProps>[]-One component per step
titlestring-Header text
showCloseButtonbooleantrueHeader close button
closeOnBackdropPressbooleantrueTap outside to close
peekHeightResponsiveHeight91Height when collapsed
minHeight / maxHeightResponsiveHeight- / 100%Bounds for the drag
initialMaxHeightResponsiveHeight62%Opening height
initialStep / stepnumber0Step on open / controlled step
onStepChange(step: number) => void-Step change callback
stepPropsRecord<string, any>{}Extra props passed to every step
overlayContentReactNode | (props: DrawerStepProps) => ReactNode-Content behind the sheet

ResponsiveHeight is number | `${number}%` | `${number}vh`.

DrawerStepProps​

Every step receives currentStep, nextStep(), previousStep(), goToStep(index), onClose() and setDrawerHeight(height | null), plus anything passed through stepProps.

Calendar​

Date picker dialog.

npx midestic-rn-library add calendar
<Calendar
visible={visible}
value={date}
onClose={() => setVisible(false)}
onApply={(next) => {
setDate(next);
setVisible(false);
}}
/>
PropTypeDescription
visiblebooleanShow/hide
valueDate | nullSelected day
onClose() => voidCancel handler
onApply(date: Date | null) => voidConfirm handler

CelebrationShower​

Animated confetti overlay for success screens.

npx midestic-rn-library add celebration-shower
<View className="flex-1 items-center justify-center">
<ThemedTitle>Ride completed!</ThemedTitle>
<CelebrationShower count={40} duration={2500} />
</View>
PropTypeDefaultDescription
countnumber35Number of particles
durationnumber2500Animation length in ms