From 89c93313a3fc3123a2e53856f53cc8cea8e693fa Mon Sep 17 00:00:00 2001 From: Hailey Date: Sat, 9 Nov 2024 16:24:51 -0800 Subject: android scroll performance fixes pt. 1 (#6196) --- src/alf/index.tsx | 53 +++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) (limited to 'src/alf/index.tsx') diff --git a/src/alf/index.tsx b/src/alf/index.tsx index f9d93d4ca..5d08722ff 100644 --- a/src/alf/index.tsx +++ b/src/alf/index.tsx @@ -103,35 +103,32 @@ export function ThemeProvider({ }) }, []) - return ( - ( - () => ({ - themes, - themeName: themeName, - theme: themes[themeName], - fonts: { - scale: fontScale, - scaleMultiplier: fontScaleMultiplier, - family: fontFamily, - setFontScale: setFontScaleAndPersist, - setFontFamily: setFontFamilyAndPersist, - }, - flags: {}, - }), - [ - themeName, - themes, - fontScale, - setFontScaleAndPersist, - fontFamily, - setFontFamilyAndPersist, - fontScaleMultiplier, - ], - )}> - {children} - + const value = React.useMemo( + () => ({ + themes, + themeName: themeName, + theme: themes[themeName], + fonts: { + scale: fontScale, + scaleMultiplier: fontScaleMultiplier, + family: fontFamily, + setFontScale: setFontScaleAndPersist, + setFontFamily: setFontFamilyAndPersist, + }, + flags: {}, + }), + [ + themeName, + themes, + fontScale, + setFontScaleAndPersist, + fontFamily, + setFontFamilyAndPersist, + fontScaleMultiplier, + ], ) + + return {children} } export function useAlf() { -- cgit 1.4.1