@momo-kits/foundation 0.167.1-sizescale.1 → 0.167.2-beta.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,
@@ -160,7 +160,6 @@ export type NavigationContainerProps = {
160
160
  initialParams?: any;
161
161
  localize: LocalizeProps;
162
162
  features?: FeatureFlags;
163
- sizeScale?: number;
164
163
  };
165
164
 
166
165
  export type WidgetContainerProps = {
package/Text/utils.ts CHANGED
@@ -8,12 +8,12 @@ const MAX_FONT_SCALE = 1.5;
8
8
  const MAX_DEVICE_SCALE = 5;
9
9
 
10
10
  const useScaleSize = (size: number, scaleRate?: number) => {
11
+ const { width } = useWindowDimensions();
11
12
  const context = useContext<any>(MiniAppContext);
12
13
  if (context?.fontScale?.useOSScaleRate === false) {
13
14
  return size * (context.fontScale.userScaleRate ?? 1);
14
15
  }
15
16
  const fontScale = PixelRatio.getFontScale();
16
- const { width } = useWindowDimensions();
17
17
  const deviceScale = width / DEFAULT_SCREEN_SIZE;
18
18
 
19
19
  const maxScaleRate = scaleRate ?? MAX_FONT_SCALE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.167.1-sizescale.1",
3
+ "version": "0.167.2-beta.1",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},