Skip to content

Commit

Permalink
refactor: expose animateOnMount for modals (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom authored May 14, 2022
1 parent 8a3d138 commit df3b180
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/bottomSheetModal/BottomSheetModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const BottomSheetModalComponent = forwardRef<
index = 0,
snapPoints,
enablePanDownToClose = true,
animateOnMount = true,

// callbacks
onChange: _providedOnChange,
Expand All @@ -70,7 +71,7 @@ const BottomSheetModalComponent = forwardRef<

//#region refs
const bottomSheetRef = useRef<BottomSheet>(null);
const currentIndexRef = useRef(-1);
const currentIndexRef = useRef(!animateOnMount ? index : -1);
const restoreIndexRef = useRef(-1);
const minimized = useRef(false);
const forcedDismissed = useRef(false);
Expand Down Expand Up @@ -375,6 +376,7 @@ const BottomSheetModalComponent = forwardRef<
index={index}
snapPoints={snapPoints}
enablePanDownToClose={enablePanDownToClose}
animateOnMount={animateOnMount}
containerHeight={containerHeight}
containerOffset={containerOffset}
onChange={handleBottomSheetOnChange}
Expand Down
5 changes: 1 addition & 4 deletions src/components/bottomSheetModal/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export interface BottomSheetModalPrivateMethods {
export type BottomSheetModalStackBehavior = keyof typeof MODAL_STACK_BEHAVIOR;

export interface BottomSheetModalProps
extends Omit<
BottomSheetProps,
'animateOnMount' | 'containerHeight' | 'onClose'
> {
extends Omit<BottomSheetProps, 'containerHeight' | 'onClose'> {
/**
* Modal name to help identify the modal for later on.
* @type string
Expand Down

0 comments on commit df3b180

Please sign in to comment.