@momo-kits/foundation 0.167.1-sizescale.1 → 0.167.1
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.
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
TransitionPresets,
|
|
15
15
|
} from '@react-navigation/stack';
|
|
16
16
|
import { DeviceEventEmitter } from 'react-native';
|
|
17
|
-
import { runOnUI } from 'react-native-reanimated';
|
|
18
17
|
import StackScreen from './StackScreen';
|
|
19
18
|
import ModalScreen from './ModalScreen';
|
|
20
19
|
import Navigator from './Navigator';
|
|
@@ -36,17 +35,6 @@ import { type EdgeInsets } from 'react-native-safe-area-context';
|
|
|
36
35
|
|
|
37
36
|
const Stack = createStackNavigator();
|
|
38
37
|
|
|
39
|
-
const applySizeScale = (sizeScale: number) => {
|
|
40
|
-
if ((globalThis as any).__SIZE_SCALE__ === sizeScale) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
(globalThis as any).__SIZE_SCALE__ = sizeScale;
|
|
44
|
-
runOnUI((value: number) => {
|
|
45
|
-
'worklet';
|
|
46
|
-
(globalThis as any).__SIZE_SCALE__ = value;
|
|
47
|
-
})(sizeScale);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
38
|
const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
51
39
|
screen,
|
|
52
40
|
theme = defaultTheme,
|
|
@@ -60,15 +48,9 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
60
48
|
enableForceFoundationList: false,
|
|
61
49
|
enableHapticBottomTab: true,
|
|
62
50
|
},
|
|
63
|
-
sizeScale,
|
|
64
51
|
}) => {
|
|
65
52
|
const context = useContext<any>(MiniAppContext);
|
|
66
53
|
const [currentContext, setCurrentContext] = useState<any>({});
|
|
67
|
-
const platformSizeScale = context?.sizeScale ?? 1;
|
|
68
|
-
|
|
69
|
-
if (sizeScale != null) {
|
|
70
|
-
applySizeScale(sizeScale);
|
|
71
|
-
}
|
|
72
54
|
|
|
73
55
|
useEffect(() => {
|
|
74
56
|
const sub = maxApi?.observer?.('font_scale_config', (data: any) => {
|
|
@@ -77,25 +59,9 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
77
59
|
return () => sub?.remove?.();
|
|
78
60
|
}, [maxApi]);
|
|
79
61
|
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
if (sizeScale == null) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const sub = maxApi?.listen?.('onFocusApp', () => {
|
|
85
|
-
applySizeScale(sizeScale);
|
|
86
|
-
});
|
|
87
|
-
return () => {
|
|
88
|
-
sub?.remove?.();
|
|
89
|
-
if ((globalThis as any).__SIZE_SCALE__ === sizeScale) {
|
|
90
|
-
applySizeScale(platformSizeScale);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}, [maxApi, sizeScale, platformSizeScale]);
|
|
94
|
-
|
|
95
62
|
const mergedContext = {
|
|
96
63
|
...context,
|
|
97
64
|
...currentContext,
|
|
98
|
-
...(sizeScale != null && { sizeScale }),
|
|
99
65
|
features: {
|
|
100
66
|
...context?.features,
|
|
101
67
|
...features,
|
package/Application/types.ts
CHANGED