Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: expose animateOnMount for modals #943

Merged
merged 1 commit into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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