@momo-kits/foundation 0.162.2-test.7 → 0.162.2-test.8
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.
|
@@ -48,10 +48,11 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
48
48
|
}) => {
|
|
49
49
|
const context = useContext<any>(MiniAppContext);
|
|
50
50
|
const [currentContext, setCurrentContext] = useState<any>({});
|
|
51
|
-
//
|
|
51
|
+
// Default = the host-seeded fontScaleConfig from MiniAppContext, so the first frame is already
|
|
52
|
+
// scaled (no flash). The observer below overwrites it on later host writes (live rate changes).
|
|
52
53
|
const [observerFontScaleConfig, setObserverFontScaleConfig] = useState<
|
|
53
54
|
FontScaleConfig | undefined
|
|
54
|
-
>(
|
|
55
|
+
>(context?.fontScaleConfig);
|
|
55
56
|
|
|
56
57
|
const mergedContext = {
|
|
57
58
|
...context,
|
|
@@ -63,11 +64,10 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
useEffect(() => {
|
|
66
|
-
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
const sub = maxApi.observer?.(
|
|
67
|
+
// The initial value is seeded by the host into MiniAppContext and used as this state's default
|
|
68
|
+
// above, so the first frame is already scaled (no flash). Here we only subscribe to later host
|
|
69
|
+
// writes so a rate change applies live while the miniapp is open.
|
|
70
|
+
const sub = maxApi?.observer?.(
|
|
71
71
|
FONT_SCALE_OBSERVER_KEY,
|
|
72
72
|
(data: FontScaleConfig) => {
|
|
73
73
|
setObserverFontScaleConfig(data ?? undefined);
|
|
@@ -82,7 +82,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
82
82
|
<SafeAreaProvider>
|
|
83
83
|
<MiniAppContext.Provider value={mergedContext}>
|
|
84
84
|
<ScaleSizeProvider
|
|
85
|
-
fontScaleConfig={observerFontScaleConfig
|
|
85
|
+
fontScaleConfig={observerFontScaleConfig}
|
|
86
86
|
>
|
|
87
87
|
<Navigation
|
|
88
88
|
screen={screen}
|