Skip to content

Commit

Permalink
window is undefined in native
Browse files Browse the repository at this point in the history
  • Loading branch information
camray committed Jul 8, 2022
1 parent 4275f7c commit fccddb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/victory-core/src/victory-util/textsize.ts
Expand Up @@ -321,9 +321,9 @@ export const _approximateTextSizeInternal = {
// Attempt to first measure the element in DOM. If there is no DOM, fallback
// to the less accurate approximation algorithm.
const isClient =
window !== undefined &&
window.document !== undefined &&
window.document.createElement !== undefined;
typeof window !== "undefined" &&
typeof window.document !== "undefined" &&
typeof window.document.createElement !== "undefined";

if (isClient && !approximate) {
return _measureWithDOM(text, style);
Expand Down

0 comments on commit fccddb7

Please sign in to comment.