From ddbca53a72cdeb6040987663edafcf0cf1677cbc Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 14 Jun 2023 11:15:40 +0800 Subject: [PATCH] Safe to reuse getComputedStyle --- src/utils/safe-bounding-box-padding.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/safe-bounding-box-padding.jsx b/src/utils/safe-bounding-box-padding.jsx index ef7a5485..b16b7468 100644 --- a/src/utils/safe-bounding-box-padding.jsx +++ b/src/utils/safe-bounding-box-padding.jsx @@ -1,10 +1,10 @@ import mem from 'mem'; const root = document.documentElement; +const style = getComputedStyle(root); const defaultBoundingBoxPadding = 8; function _safeBoundingBoxPadding() { // Get safe area inset variables from root - const style = getComputedStyle(root); const safeAreaInsetTop = style.getPropertyValue('--sai-top'); const safeAreaInsetRight = style.getPropertyValue('--sai-right'); const safeAreaInsetBottom = style.getPropertyValue('--sai-bottom');