@momo-kits/foundation 0.162.1-beta.1 → 0.162.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -31,6 +31,27 @@ const Stack = createStackNavigator();
|
|
|
31
31
|
|
|
32
32
|
const FONT_SCALE_OBSERVER_KEY = 'font_scale_config';
|
|
33
33
|
|
|
34
|
+
// AI-GENERATED START: parse the font_scale_config first-frame seed read straight from async storage (string | {response} | object)
|
|
35
|
+
const parseSeedFontScaleConfig = (raw: any): FontScaleConfig | undefined => {
|
|
36
|
+
let data = raw;
|
|
37
|
+
if (typeof data === 'string') {
|
|
38
|
+
try {
|
|
39
|
+
data = JSON.parse(data);
|
|
40
|
+
} catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
data = data?.response ?? data;
|
|
45
|
+
if (!data || (data.useOSFontScale === undefined && data.userScaleRate === undefined)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
useOSFontScale: data.useOSFontScale,
|
|
50
|
+
userScaleRate: data.userScaleRate,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
// AI-GENERATED END: parse the font_scale_config first-frame seed read straight from async storage (string | {response} | object)
|
|
54
|
+
|
|
34
55
|
const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
35
56
|
screen,
|
|
36
57
|
theme = defaultTheme,
|
|
@@ -47,9 +68,11 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
47
68
|
}) => {
|
|
48
69
|
const context = useContext<any>(MiniAppContext);
|
|
49
70
|
const [currentContext, setCurrentContext] = useState<any>({});
|
|
71
|
+
// AI-GENERATED START: self-seed first-frame font scale by reading font_scale_config straight from async storage
|
|
50
72
|
const [observerFontScaleConfig, setObserverFontScaleConfig] = useState<
|
|
51
73
|
FontScaleConfig | undefined
|
|
52
|
-
>(context?.fontScaleConfig);
|
|
74
|
+
>(() => parseSeedFontScaleConfig(maxApi?.getItem?.(FONT_SCALE_OBSERVER_KEY)) ?? context?.fontScaleConfig);
|
|
75
|
+
// AI-GENERATED END: self-seed first-frame font scale by reading font_scale_config straight from async storage
|
|
53
76
|
|
|
54
77
|
const mergedContext = {
|
|
55
78
|
...context,
|
package/Layout/Screen.tsx
CHANGED
|
@@ -650,7 +650,14 @@ const Screen = forwardRef(
|
|
|
650
650
|
onScroll={handleScroll}
|
|
651
651
|
onScrollEndDrag={handleScrollEnd}
|
|
652
652
|
scrollEventThrottle={16}
|
|
653
|
-
style={
|
|
653
|
+
style={[
|
|
654
|
+
Styles.flex,
|
|
655
|
+
!scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
656
|
+
]}
|
|
657
|
+
contentContainerStyle={[
|
|
658
|
+
scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
|
|
659
|
+
scrollViewProps?.contentContainerStyle,
|
|
660
|
+
]}
|
|
654
661
|
>
|
|
655
662
|
{renderAnimatedHeader()}
|
|
656
663
|
|