@momo-kits/foundation 0.92.8-rc.5 → 0.92.9-beta.0

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.
@@ -29,7 +29,6 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
29
29
  snapPoint = 'content',
30
30
  draggable = true,
31
31
  dragOnContent = false,
32
- useBottomInset = true,
33
32
  }: BottomSheetParams = props.route.params;
34
33
  const [modalVisible, setModalVisible] = useState(false);
35
34
  const animatedHeight = useRef(new Animated.Value(0)).current;
@@ -59,8 +58,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
59
58
  },
60
59
  }),
61
60
  ).current;
62
- const [estimate, setEstimate] = useState(0.9);
63
- const timeoutMount = useRef<any>();
61
+ const estimate = useRef(0.9);
64
62
 
65
63
  let backgroundColor = theme.colors.background.default;
66
64
  if (surface) {
@@ -71,32 +69,27 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
71
69
  * handle open & emit dismiss event
72
70
  */
73
71
  useEffect(() => {
74
- clearTimeout(timeoutMount.current);
75
- timeoutMount.current = setTimeout(() => {
72
+ setTimeout(() => {
76
73
  const mapSnapPoint: any = {
77
74
  '30%': 0.3,
78
75
  '50%': 0.5,
79
76
  '70%': 0.7,
80
77
  '90%': 0.9,
81
78
  };
82
- const point = mapSnapPoint[snapPoint] ?? estimate;
79
+ const point = mapSnapPoint[snapPoint] ?? estimate.current;
83
80
  setModalVisible(true);
84
81
  Animated.timing(animatedHeight, {
85
82
  useNativeDriver: false,
86
83
  toValue: heightDevice * point,
87
- duration: 150,
84
+ duration: 300,
88
85
  }).start();
89
- }, 50);
90
- }, [estimate]);
86
+ }, 100);
91
87
 
92
- /**
93
- * emit dismiss event
94
- */
95
- useEffect(() => {
96
88
  return () => {
97
89
  props.route.params?.onDismiss?.();
98
90
  };
99
91
  }, []);
92
+
100
93
  /**
101
94
  * handler dismiss
102
95
  */
@@ -170,9 +163,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
170
163
  </View>
171
164
  )}
172
165
  <Screen {...props} {...props.route.params} />
173
- {useBottomInset && (
174
- <View style={{height: Math.min(insets.bottom, 21)}} />
175
- )}
166
+ <View style={{height: Math.min(insets.bottom, 21)}} />
176
167
  </Animated.View>
177
168
  </KeyboardAvoidingView>
178
169
  </Modal>
@@ -180,15 +171,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
180
171
  <View
181
172
  style={styles.estimate}
182
173
  onLayout={e => {
183
- const current = (e.nativeEvent.layout.height + 72) / heightDevice;
184
- if (current != estimate) {
185
- setEstimate(current);
186
- }
174
+ estimate.current =
175
+ (e.nativeEvent.layout.height + 68) / heightDevice;
187
176
  }}>
188
177
  <Screen {...props} {...props.route.params} />
189
- {useBottomInset && (
190
- <View style={{height: Math.min(insets.bottom, 21)}} />
191
- )}
178
+ <View style={{height: Math.min(insets.bottom, 21)}} />
192
179
  </View>
193
180
  )}
194
181
  </>
@@ -26,6 +26,7 @@ type Props = BottomTabBarProps & {
26
26
  activeTintColor?: string;
27
27
  inactiveTintColor?: string;
28
28
  floatingButton?: FloatingButtonProps;
29
+ accessibilityLabel?: string;
29
30
  };
30
31
 
31
32
  const getPaddingBottom = (insets: EdgeInsets) => {
@@ -64,7 +65,7 @@ export default function BottomTabBar({
64
65
  */
65
66
  const renderTabItem = useCallback(
66
67
  (data: any[]) => {
67
- return data?.map((route, _) => {
68
+ return data?.map((route, index) => {
68
69
  const focused = route.params.name === focusedTab;
69
70
  const {options} = descriptors[route?.key] as any;
70
71
  const onPress = () => {
@@ -89,7 +90,19 @@ export default function BottomTabBar({
89
90
  });
90
91
  };
91
92
 
92
- const label = options.tabBarLabel || options.title || route.name;
93
+ const label =
94
+ options.tabBarLabel !== undefined
95
+ ? options.tabBarLabel
96
+ : options.title !== undefined
97
+ ? options.title
98
+ : route.name;
99
+
100
+ const accessibilityLabel =
101
+ options.tabBarAccessibilityLabel !== undefined
102
+ ? options.tabBarAccessibilityLabel
103
+ : typeof label === 'string'
104
+ ? `${label}, tab, ${index + 1} of ${routes.length}`
105
+ : undefined;
93
106
 
94
107
  return (
95
108
  <NavigationContext.Provider
@@ -102,7 +115,7 @@ export default function BottomTabBar({
102
115
  horizontal={false}
103
116
  onPress={onPress}
104
117
  onLongPress={onLongPress}
105
- accessibilityLabel={`tab_item_${route.name}`}
118
+ accessibilityLabel={accessibilityLabel}
106
119
  to={buildLink(route.name, route.params)}
107
120
  testID={options.tabBarTestID}
108
121
  allowFontScaling={allowFontScaling}
@@ -219,7 +232,7 @@ export default function BottomTabBar({
219
232
  style,
220
233
  ]}
221
234
  pointerEvents={'auto'}>
222
- <View style={styles.content} accessibilityLabel={'bottom_tab_bar'}>
235
+ <View style={styles.content}>
223
236
  {useFloating && floatingButton?.container}
224
237
  <Animated.View
225
238
  style={{
@@ -22,18 +22,13 @@ const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
22
22
  if (route.params?.options) {
23
23
  options = getOptions(route.params?.options, theme);
24
24
  }
25
-
26
25
  if (route.params?.nested) {
27
26
  return (
28
27
  <Stack.Navigator>
29
28
  <Stack.Screen
30
29
  name="Stack"
31
30
  component={StackScreen}
32
- initialParams={{
33
- screen: route.params?.screen,
34
- options,
35
- initialParams: route.params?.initialParams,
36
- }}
31
+ initialParams={{screen: route.params?.screen, options}}
37
32
  options={{...getStackOptions()}}
38
33
  />
39
34
  </Stack.Navigator>
@@ -45,11 +40,7 @@ const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
45
40
  <Stack.Screen
46
41
  name="Stack"
47
42
  component={StackScreen}
48
- initialParams={{
49
- screen: route.params?.screen,
50
- options,
51
- initialParams: route.params?.initialParams,
52
- }}
43
+ initialParams={{screen: route.params?.screen, options}}
53
44
  options={{...getStackOptions(), ...route.params?.options}}
54
45
  />
55
46
  </Stack.Navigator>
@@ -81,7 +72,11 @@ const BottomTab: React.FC<BottomTabProps> = ({
81
72
  initialRouteName={initialRouteName}
82
73
  backBehavior={'firstRoute'}
83
74
  tabBar={props => (
84
- <BottomTabBar {...props} floatingButton={floatingButton} />
75
+ <BottomTabBar
76
+ {...props}
77
+ accessibilityLabel={'BottomTabBar'}
78
+ floatingButton={floatingButton}
79
+ />
85
80
  )}
86
81
  tabBarOptions={{
87
82
  style: {
@@ -50,7 +50,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
50
50
  * tracking for screen
51
51
  */
52
52
  useEffect(() => {
53
- Alert.alert(screenName);
53
+ if (__DEV__ && (!screenName || screenName == 'Invalid')) {
54
+ Alert.alert('Design system', `Unvalidated screen name "${screenName}" !`);
55
+ }
54
56
 
55
57
  navigator?.maxApi?.of?.({screenName});
56
58
 
@@ -102,14 +102,14 @@ export type ScreenParams = {
102
102
 
103
103
  export type ModalParams = {
104
104
  [key: string]: any;
105
- screen: React.ComponentType;
105
+ screen: Screen;
106
106
  onDismiss?: () => void;
107
107
  barrierDismissible?: boolean;
108
108
  };
109
109
 
110
110
  export type BottomSheetParams = {
111
111
  [key: string]: any;
112
- screen: React.ComponentType;
112
+ screen: Screen;
113
113
  options: {
114
114
  title: string;
115
115
  surface?: boolean;
@@ -120,7 +120,6 @@ export type BottomSheetParams = {
120
120
  barrierDismissible?: boolean;
121
121
  draggable?: boolean;
122
122
  dragOnContent?: boolean;
123
- useBottomInset?: boolean;
124
123
  };
125
124
 
126
125
  export type NavigationButtonProps = {
@@ -198,7 +197,6 @@ export type BottomTabItemProps = {
198
197
  badgeLabel?: string | number;
199
198
  screen: Screen;
200
199
  options: NavigationOptions;
201
- initialParams?: any;
202
200
  };
203
201
 
204
202
  export type BottomTabProps = {
@@ -4,7 +4,7 @@ import {ApplicationContext, ComponentContext} from '../Application';
4
4
  import {Styles} from '../Consts';
5
5
  import {Icon} from '../Icon';
6
6
  import {Loader} from '../Loader';
7
- import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
7
+ import {ErrorView, FloatingView, getSizeStyle} from './common';
8
8
  import {InputDropDownProps} from './index';
9
9
  import styles from './styles';
10
10
 
@@ -61,7 +61,7 @@ const InputDropDown = ({
61
61
  styles.inputWrapper,
62
62
  {backgroundColor: theme.colors.background.surface},
63
63
  getSizeStyle(size),
64
- getBorderColor(theme, false, errorMessage, disabled),
64
+ // getBorderColor(theme, false, errorMessage, disabled),
65
65
  ]}>
66
66
  <FloatingView
67
67
  floatingValue={floatingValue}
package/Layout/Card.tsx CHANGED
@@ -144,7 +144,6 @@ const Card: React.FC<CardProps> = ({
144
144
  <GridContext.Provider value={gridContext}>
145
145
  <View
146
146
  {...props}
147
- onLayout={undefined}
148
147
  style={[
149
148
  {backgroundColor: theme.colors.background.surface},
150
149
  style,
package/Layout/Screen.tsx CHANGED
@@ -296,8 +296,7 @@ const Screen = forwardRef(
296
296
  style={{
297
297
  marginTop: space,
298
298
  flex: item.props?.expanded ? 1 : undefined,
299
- }}
300
- onLayout={item.props?.onLayout}>
299
+ }}>
301
300
  {item}
302
301
  </View>
303
302
  );
@@ -315,8 +314,7 @@ const Screen = forwardRef(
315
314
  style={{
316
315
  marginTop: space,
317
316
  flex: item?.props?.expanded ? 1 : undefined,
318
- }}
319
- onLayout={item?.props?.onLayout}>
317
+ }}>
320
318
  {children}
321
319
  </View>
322
320
  );
@@ -151,7 +151,6 @@ const Section: React.FC<SectionProps> = ({
151
151
  }}>
152
152
  <View
153
153
  {...props}
154
- onLayout={undefined}
155
154
  style={[
156
155
  style,
157
156
  styles.protectedStyle,
package/Loader/index.tsx CHANGED
@@ -1,6 +1,4 @@
1
1
  import Loader from './Loader';
2
2
  import ProgressBar from './ProgressBar';
3
- import {LoaderProps, ProgressBarProps} from './types';
4
3
 
5
4
  export {Loader, ProgressBar};
6
- export type {LoaderProps, ProgressBarProps};
@@ -188,7 +188,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
188
188
 
189
189
  return (
190
190
  <View
191
- accessibilityLabel={'popup_notify'}
191
+ accessibilityLabel={'PopupNotify'}
192
192
  style={[
193
193
  styles.container,
194
194
  {backgroundColor: theme.colors.background.surface},
@@ -79,7 +79,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
79
79
  };
80
80
 
81
81
  return (
82
- <View accessibilityLabel={'popup_promotion'}>
82
+ <View accessibilityLabel={'PopupPromotion'}>
83
83
  <Image
84
84
  source={{
85
85
  uri: image,
package/Popup/types.ts CHANGED
@@ -18,7 +18,7 @@ export type PopupNotifyProps = {
18
18
  /**
19
19
  * `description`: Represents the description text to be displayed in the PopupNotify component.
20
20
  */
21
- description?: string | React.ReactNode;
21
+ description: string | React.ReactNode;
22
22
 
23
23
  /**
24
24
  * `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.8-rc.5",
3
+ "version": "0.92.9-beta.0",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -43,4 +43,4 @@
43
43
  },
44
44
  "author": "@momo-kits/foundation",
45
45
  "license": "ISC"
46
- }
46
+ }
package/publish.sh CHANGED
@@ -1,23 +1,23 @@
1
1
  #!/bin/bash
2
+
3
+ # Prepare dist files
2
4
  rm -rf dist
3
5
  mkdir dist
4
-
5
- cp . ./dist
6
-
7
-
8
- # GET VERSION from mck_package.json
9
- VERSIONSTRING=( v$(jq .version package.json) )
10
- VERSION=(${VERSIONSTRING//[\"]/})
11
- echo VERSION: $VERSION
12
-
13
- rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
14
-
6
+ rsync -r --exclude=/dist ./* dist
15
7
  cd dist
16
- npm publish --tag latest --access=public
17
8
 
18
- #clear dist and package json
9
+ PACKAGE_NAME=$(npm pkg get name)
10
+ if [ "$1" == "beta" ]; then # Publish beta
11
+ npm version $(npm view "$PACKAGE_NAME@beta" version)
12
+ npm version prepatch --preid=beta
13
+ npm publish --tag beta --access=public
14
+ else # Publish latest
15
+ npm version $(npm view $PACKAGE_NAME version)
16
+ npm version patch
17
+ npm publish --tag latest --access=public
18
+ fi
19
+ NEW_PACKAGE_VERSION=$(npm pkg get version)
20
+
21
+ # Clean up
19
22
  cd ..
20
23
  rm -rf dist
21
-
22
-
23
- #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/core new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/foundation"}'