From 008faf1ae0d3503a128b1afa4ac4df7b9dc09ef4 Mon Sep 17 00:00:00 2001 From: Ben Howell Date: Fri, 15 Mar 2024 13:00:29 -0700 Subject: [PATCH] Only register styles on first use --- .../src/styling/makeStyles.native.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/react-components/react-platform-adapter/src/styling/makeStyles.native.ts b/packages/react-components/react-platform-adapter/src/styling/makeStyles.native.ts index 4745578a6be84..dfe383b6c3934 100644 --- a/packages/react-components/react-platform-adapter/src/styling/makeStyles.native.ts +++ b/packages/react-components/react-platform-adapter/src/styling/makeStyles.native.ts @@ -19,11 +19,14 @@ export function makeStyles( classNameMap[slotName] = className; } + let registered = false; const useStyles = () => { + if (!registered) { + registerStyles(styles); + registered = true; + } return classNameMap; }; - registerStyles(styles); - return useStyles; }