@birdwingo/react-native-swipe-modal
Version:
A versatile and smooth swipeable modal component for React Native applications.
43 lines (39 loc) • 1.34 kB
text/typescript
import { ReactNode, RefObject } from 'react';
import { ViewProps, ViewStyle } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
import { SharedValue } from 'react-native-reanimated';
import { AnimatedModalProps } from './animatedModalDTO';
export type SwipeModalProps = AnimatedModalProps & {
bg?: string;
showBar?: boolean;
barColor?: string;
barContainerStyle?: ViewStyle | ViewStyle[];
maxHeight?: 'max' | 'auto' | number;
defaultHeight?: number;
fixedHeight?: boolean;
style?: ViewStyle | ViewStyle[];
closeTrigger?: 'swipeDown' | 'minHeight';
closeTriggerValue?: number;
scrollEnabled?: boolean;
scrollContainerStyle?: ViewStyle | ViewStyle[];
scrollContainerProps?: ScrollView['props'];
headerComponent?: ReactNode;
footerComponent?: ReactNode;
disableSwipe?: boolean;
topOffset?: number;
containerProps?: ViewProps;
wrapInGestureHandlerRootView?: boolean;
};
export type SwipeModalPublicMethods = {
show: () => void;
hide: () => void;
};
export interface ModalScrollContainerProps {
children: ReactNode;
scrollRef: RefObject<ScrollView>;
style?: SwipeModalProps['scrollContainerStyle'];
props?: SwipeModalProps['scrollContainerProps'];
scrollY: SharedValue<number>;
isScrollHandled: SharedValue<boolean>;
scrollEnabled: SharedValue<boolean>
}