diff --git a/src/alf/index.tsx b/src/alf/index.tsx
index f9d93d4ca8..5d08722ff4 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() {
diff --git a/src/view/com/util/text/Text.tsx b/src/view/com/util/text/Text.tsx
index e16003507d..1d1c4d0488 100644
--- a/src/view/com/util/text/Text.tsx
+++ b/src/view/com/util/text/Text.tsx
@@ -44,8 +44,6 @@ export function Text({
...props
}: React.PropsWithChildren) {
const theme = useTheme()
- const typography = theme.typography[type]
- const lineHeightStyle = lineHeight ? lh(theme, type, lineHeight) : undefined
const {fonts} = useAlf()
if (IS_DEV) {
@@ -61,6 +59,9 @@ export function Text({
}
const textProps = React.useMemo(() => {
+ const typography = theme.typography[type]
+ const lineHeightStyle = lineHeight ? lh(theme, type, lineHeight) : undefined
+
const flattened = StyleSheet.flatten([
s.black,
typography,
@@ -80,25 +81,24 @@ export function Text({
)
}
- const shared = {
+ return {
uiTextView: selectable && isIOS,
selectable,
style: flattened,
dataSet: Object.assign({tooltip: title}, dataSet || {}),
...props,
}
-
- return shared
}, [
dataSet,
fonts.family,
fonts.scaleMultiplier,
- lineHeightStyle,
+ lineHeight,
props,
selectable,
style,
+ theme,
title,
- typography,
+ type,
])
if (selectable && isIOS) {