@momo-kits/foundation 0.162.2-beta.21 → 0.162.2-beta.22

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.
@@ -16,7 +16,6 @@ import { DeviceEventEmitter } from 'react-native';
16
16
  import StackScreen from './StackScreen';
17
17
  import ModalScreen from './ModalScreen';
18
18
  import Navigator from './Navigator';
19
- import ScaleSizeProvider from './ScaleSizeProvider';
20
19
  import { getModalOptions, getStackOptions } from './utils';
21
20
  import { NavigationContainerProps } from './types';
22
21
  import { ApplicationContext, MiniAppContext } from '../Context';
@@ -65,17 +64,15 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
65
64
  return (
66
65
  <SafeAreaProvider>
67
66
  <MiniAppContext.Provider value={mergedContext}>
68
- <ScaleSizeProvider scaleSizeMaxRate={mergedContext?.scaleSizeMaxRate}>
69
- <Navigation
70
- screen={screen}
71
- theme={theme}
72
- options={options}
73
- maxApi={maxApi}
74
- setCurrentContext={setCurrentContext}
75
- initialParams={initialParams}
76
- localize={localize}
77
- />
78
- </ScaleSizeProvider>
67
+ <Navigation
68
+ screen={screen}
69
+ theme={theme}
70
+ options={options}
71
+ maxApi={maxApi}
72
+ setCurrentContext={setCurrentContext}
73
+ initialParams={initialParams}
74
+ localize={localize}
75
+ />
79
76
  </MiniAppContext.Provider>
80
77
  </SafeAreaProvider>
81
78
  );
@@ -81,12 +81,9 @@ const WidgetContainer: React.FC<WidgetContainerProps> = ({
81
81
  };
82
82
 
83
83
  return (
84
- <View style={{ height: height ?? '100%', minHeight:1 }}>
84
+ <View style={{ height: height ?? '100%', minHeight: 1 }}>
85
85
  <SafeAreaProvider>
86
86
  <MiniAppContext.Provider value={mergedContext}>
87
- <ScaleSizeProvider
88
- scaleSizeMaxRate={mergedContext?.scaleSizeMaxRate}
89
- >
90
87
  <ApplicationContext.Provider
91
88
  value={{
92
89
  navigator: navigator.current,
@@ -164,7 +161,6 @@ const WidgetContainer: React.FC<WidgetContainerProps> = ({
164
161
  </ReactNavigationContainer>
165
162
  </NavigationIndependentTree>
166
163
  </ApplicationContext.Provider>
167
- </ScaleSizeProvider>
168
164
  </MiniAppContext.Provider>
169
165
  </SafeAreaProvider>
170
166
  </View>
@@ -28,7 +28,12 @@ export interface IconButtonProps extends TouchableOpacityProps {
28
28
  /**
29
29
  * Optional. Defines the size of the IconButton.
30
30
  */
31
- size?: 'large' | 'small';
31
+ size?: 'large' | 'medium' | 'small';
32
+
33
+ /**
34
+ * Optional. Defines the shape of the IconButton.
35
+ */
36
+ shape?: 'circle' | 'square';
32
37
 
33
38
  /**
34
39
  * Optional. Params auto tracking component.
@@ -40,6 +45,7 @@ const IconButton: React.FC<IconButtonProps> = ({
40
45
  type = 'primary',
41
46
  icon,
42
47
  size,
48
+ shape = 'circle',
43
49
  params,
44
50
  ...rest
45
51
  }) => {
@@ -52,10 +58,21 @@ const IconButton: React.FC<IconButtonProps> = ({
52
58
  * get size icon button
53
59
  */
54
60
  const getSizeStyle = () => {
55
- if (size === 'small') {
56
- return styles.small;
61
+ switch (size) {
62
+ case 'small':
63
+ return styles.small;
64
+ case 'medium':
65
+ return styles.medium;
66
+ default:
67
+ return styles.large;
57
68
  }
58
- return styles.large;
69
+ };
70
+
71
+ /**
72
+ * get shape icon button
73
+ */
74
+ const getShapeStyle = () => {
75
+ return shape === 'square' ? styles.square : styles.circle;
59
76
  };
60
77
 
61
78
  /**
@@ -117,8 +134,13 @@ const IconButton: React.FC<IconButtonProps> = ({
117
134
  };
118
135
 
119
136
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
120
- const buttonStyle = StyleSheet.flatten([getTypeStyle(), getSizeStyle()]);
121
- const iconSize = size === 'small' ? 16 : 24;
137
+ const buttonStyle = StyleSheet.flatten([
138
+ getTypeStyle(),
139
+ styles.base,
140
+ getSizeStyle(),
141
+ getShapeStyle(),
142
+ ]);
143
+ const iconSize = size === 'small' || size === 'medium' ? 16 : 24;
122
144
 
123
145
  return (
124
146
  <ComponentContext.Provider
@@ -2,19 +2,27 @@ import { StyleSheet } from 'react-native';
2
2
  import { Radius, Colors } from '../Consts';
3
3
 
4
4
  export default StyleSheet.create({
5
+ base: {
6
+ justifyContent: 'center',
7
+ alignItems: 'center',
8
+ },
5
9
  large: {
6
10
  width: 48,
7
11
  height: 48,
8
- borderRadius: Radius.XL,
9
- justifyContent: 'center',
10
- alignItems: 'center',
12
+ },
13
+ medium: {
14
+ width: 36,
15
+ height: 36,
11
16
  },
12
17
  small: {
13
- width: 40,
14
- height: 40,
18
+ width: 28,
19
+ height: 28,
20
+ },
21
+ circle: {
15
22
  borderRadius: Radius.XL,
16
- justifyContent: 'center',
17
- alignItems: 'center',
23
+ },
24
+ square: {
25
+ borderRadius: Radius.S,
18
26
  },
19
27
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
20
28
  });
package/Layout/Screen.tsx CHANGED
@@ -166,6 +166,13 @@ export interface ScreenProps extends ViewProps {
166
166
  trackingParams?: ScreenTrackingParams;
167
167
  }
168
168
 
169
+ /**
170
+ * Scroll distance (px) over which the animated search header collapses from its
171
+ * expanded to its docked state — the input range consumed by `HeaderExtendHeader`
172
+ * and the settle threshold in `handleScrollEnd`.
173
+ */
174
+ const SEARCH_HEADER_COLLAPSE_DISTANCE = 100;
175
+
169
176
  const Screen = forwardRef(
170
177
  (
171
178
  {
@@ -195,7 +202,7 @@ const Screen = forwardRef(
195
202
  ref: any,
196
203
  ) => {
197
204
  const screenRef = useRef<View | ScrollView>(null);
198
- const { width: widthDevice } = useWindowDimensions();
205
+ const { width: widthDevice, height: heightDevice } = useWindowDimensions();
199
206
  const { theme } = useContext(ApplicationContext);
200
207
  const screen: any = useContext(ScreenContext);
201
208
  const insets = useSafeAreaInsets();
@@ -656,6 +663,17 @@ const Screen = forwardRef(
656
663
  ]}
657
664
  contentContainerStyle={[
658
665
  scrollable && !Footer && !isTab && { paddingBottom: bottomInset },
666
+ // The animated search header collapses as the body scrolls. When the
667
+ // body is short (e.g. no search history) the ScrollView is barely
668
+ // scrollable, so overscroll bounce feeds the scroll-driven animation
669
+ // and the input jitters on its way up to the header. A ScrollView
670
+ // frame can never exceed the window, so forcing the content to be at
671
+ // least one screen plus the collapse distance guarantees the animation
672
+ // always has room to complete smoothly, independent of body content.
673
+ scrollable &&
674
+ inputSearchProps && {
675
+ minHeight: heightDevice + SEARCH_HEADER_COLLAPSE_DISTANCE,
676
+ },
659
677
  scrollViewProps?.contentContainerStyle,
660
678
  ]}
661
679
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.162.2-beta.21",
3
+ "version": "0.162.2-beta.22",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -17,7 +17,7 @@
17
17
  "@react-navigation/stack": "7.4.2",
18
18
  "react-native-gesture-handler": "2.27.1",
19
19
  "react-native-linear-gradient": "git+https://oauth2:k_r5y_gV6sX9-TqQxgcd@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
20
- "react-native-reanimated": "4.2.2",
20
+ "react-native-reanimated": "4.1.3",
21
21
  "react-native-safe-area-context": "5.5.2",
22
22
  "@shopify/flash-list": "2.1.0",
23
23
  "lottie-react-native": "7.2.4"