Project React Native Reanimated Modal

Type Aliases§

Source§

type ModalAnimation = "fade" | "slide" | "scale"

Source§

type ModalAnimationConfig<T> = T extends "fade"
    ? FadeAnimationConfig
    : T extends "slide"
        ? SlideAnimationConfig
        : T extends "scale" ? ScaleAnimationConfig : never

Generic type for animation config based on animation type.

Source§

type ModalAnimationConfigUnion = FadeAnimationConfig | SlideAnimationConfig | ScaleAnimationConfig

Union of all animation configuration types.

Source§

type SwipeDirection = "up" | "down" | "left" | "right"

Variables§

Source§

const DEFAULT_MODAL_ANIMATION_CONFIGS: {
    fade: FadeAnimationConfig;
    scale: ScaleAnimationConfig;
    slide: SlideAnimationConfig;
} = ...

Default animation configurations.

Source§

const DEFAULT_MODAL_ANIMATION_DURATION: 300 = [object Object]

Default values and configurations.

Source§

const DEFAULT_MODAL_BACKDROP_CONFIG: ModalBackdropConfig = ...

Default backdrop configuration.

Source§

const DEFAULT_MODAL_BOUNCE_OPACITY_THRESHOLD: 0.05 = [object Object]

Source§

const DEFAULT_MODAL_BOUNCE_SPRING_CONFIG: SpringConfig = ...

Source§

const DEFAULT_MODAL_SCALE_FACTOR: 0.8 = [object Object]

Source§

const DEFAULT_MODAL_SWIPE_CONFIG: ModalSwipeConfig = ...

Default swipe configuration.

Source§

const DEFAULT_MODAL_SWIPE_DIRECTION: SwipeDirection = 'down'

Source§

const DEFAULT_MODAL_SWIPE_THRESHOLD: 100 = [object Object]

Source§

const Modal: FC<ModalProps> = ...

Modal component with smooth, customizable animations and gesture support. Built on top of React Native's Modal, Reanimated, and Gesture Handler.

props

Props for the modal component.

Functions§

Source§

getSlideInDirection(
    animationConfig: ModalAnimationConfigUnion,
    fallback?: SwipeDirection,
): SwipeDirection

Gets the slide-in direction from animation config.

Source§

getSwipeDirections(
    swipeConfig: ModalSwipeConfig,
    animationConfig?: ModalAnimationConfigUnion,
    fallback?: SwipeDirection | SwipeDirection[],
): SwipeDirection[]

Extracts swipe directions from swipe config or animation config fallback.

Source§

normalizeAnimationConfig(
    config?: undefined | ModalAnimation | Partial<ModalAnimationConfigUnion>,
): ModalAnimationConfigUnion

Normalizes animation configuration by providing defaults for missing properties.

Source§

normalizeBackdropConfig(
    backdrop?: ModalBackdropConfig | ReactNode,
): {
    config: ModalBackdropConfig;
    customRenderer?: ReactNode;
    enabled: boolean;
    isCustom: boolean;
}

Normalizes backdrop configuration by providing defaults for missing properties.

Source§

normalizeSwipeConfig(config?: false | ModalSwipeConfig): ModalSwipeConfig

Normalizes swipe configuration by providing defaults for missing properties.

Interfaces§

FadeAnimationConfig

Configuration for fade animation.

ModalBackdropConfig

Configuration for modal backdrop.

ModalProps

Props for the Modal component.

ModalSwipeConfig

Configuration for modal swipe.

ScaleAnimationConfig

Configuration for scale animation.

SlideAnimationConfig

Configuration for slide animation.