Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

fix element existence check (#309)

Jacob Clynefba1634c681c
diff --git a/src/helpers.ts b/src/helpers.ts
index f72f32e..c008d6e 100644
--- a/src/helpers.ts
+++ b/src/helpers.ts
@@ -70,6 +70,9 @@ export const isVertical = (direction: DrawerDirection) => {
};
export function getTranslate(element: HTMLElement, direction: DrawerDirection): number | null {
+ if (!element) {
+ return null;
+ }
const style = window.getComputedStyle(element);
const transform =
// @ts-ignore