@momo-kits/foundation 0.81.1-beta.6 → 0.81.1-optimize.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.
Files changed (67) hide show
  1. package/Application/BottomTab.tsx +76 -23
  2. package/Application/Components.tsx +243 -198
  3. package/Application/ModalScreen.tsx +20 -65
  4. package/Application/Navigation.ts +15 -4
  5. package/Application/NavigationContainer.tsx +20 -20
  6. package/Application/Navigator.ts +61 -28
  7. package/Application/StackScreen.tsx +41 -23
  8. package/Application/index.ts +16 -6
  9. package/Application/types.ts +34 -19
  10. package/Application/utils.tsx +26 -0
  11. package/Assets/icon.json +83 -5
  12. package/Assets/icon_bank.json +506 -0
  13. package/Assets/language.json +3 -1
  14. package/Badge/Badge.tsx +56 -0
  15. package/Badge/BadgeDot.tsx +11 -0
  16. package/Badge/BadgeRibbon.tsx +125 -0
  17. package/Badge/Shape.tsx +29 -0
  18. package/Badge/index.tsx +7 -0
  19. package/Badge/styles.ts +58 -0
  20. package/Badge/types.ts +63 -0
  21. package/Button/index.tsx +26 -9
  22. package/Button/styles.ts +19 -0
  23. package/CheckBox/index.tsx +1 -2
  24. package/Consts/colors+spacing+radius.ts +3 -3
  25. package/Icon/index.tsx +7 -3
  26. package/Icon/types.ts +3 -3
  27. package/IconButton/index.tsx +0 -1
  28. package/Image/index.tsx +39 -49
  29. package/Image/styles.ts +1 -9
  30. package/Image/types.ts +3 -1
  31. package/Input/Input.tsx +37 -16
  32. package/Input/InputDropDown.tsx +5 -14
  33. package/Input/InputMoney.tsx +28 -11
  34. package/Input/InputOTP.tsx +169 -145
  35. package/Input/InputSearch.tsx +9 -13
  36. package/Input/InputTextArea.tsx +6 -12
  37. package/Input/common.tsx +5 -3
  38. package/Input/index.tsx +15 -9
  39. package/Input/styles.ts +1 -4
  40. package/Layout/Card.tsx +20 -11
  41. package/Layout/GridSystem.tsx +1 -2
  42. package/Layout/Item.tsx +0 -1
  43. package/Layout/ItemList.tsx +39 -40
  44. package/Layout/ItemSectionList.tsx +39 -0
  45. package/Layout/Screen.tsx +96 -45
  46. package/Layout/Section.tsx +17 -19
  47. package/Layout/index.ts +2 -1
  48. package/Layout/styles.ts +16 -15
  49. package/Layout/types.ts +2 -5
  50. package/Pagination/PaginationNumber.tsx +1 -1
  51. package/Pagination/PaginationScroll.tsx +0 -1
  52. package/Popup/PopupNotify.tsx +71 -14
  53. package/Popup/PopupPromotion.tsx +43 -6
  54. package/Popup/types.ts +12 -3
  55. package/Radio/index.tsx +1 -2
  56. package/Skeleton/index.tsx +1 -1
  57. package/Switch/index.tsx +0 -1
  58. package/Tag/index.tsx +2 -4
  59. package/Text/index.tsx +3 -2
  60. package/Text/styles.ts +38 -0
  61. package/Text/types.ts +25 -13
  62. package/Title/index.tsx +82 -38
  63. package/Title/styles.ts +16 -10
  64. package/Title/types.ts +2 -1
  65. package/index.ts +2 -0
  66. package/package.json +6 -6
  67. package/verify.js +15 -0
@@ -1,44 +1,95 @@
1
- import React, {useContext} from 'react';
2
- import {View} from 'react-native';
3
- import {BottomTabProps} from './types';
1
+ import React, {useContext, useEffect} from 'react';
2
+ import {Platform} from 'react-native';
3
+ import {BottomTabProps, NavigationScreenProps} from './types';
4
4
  import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
5
+ import {createStackNavigator} from '@react-navigation/stack';
6
+ import {useSafeAreaInsets} from 'react-native-safe-area-context';
7
+ import {NavigationContainer} from '@react-navigation/native';
5
8
  import {Icon} from '../Icon';
6
9
  import {Text} from '../Text';
7
10
  import {ApplicationContext} from './index';
11
+ import {getStackOptions} from './utils';
12
+ import StackScreen from './StackScreen';
8
13
 
9
14
  const Tab = createBottomTabNavigator();
15
+ const Stack = createStackNavigator();
10
16
 
11
- const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners, navigation}) => {
17
+ const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
18
+ if (route.params?.nested) {
19
+ return (
20
+ <Stack.Navigator>
21
+ <Stack.Screen
22
+ name="Stack"
23
+ component={StackScreen}
24
+ initialParams={{screen: route.params?.screen}}
25
+ options={{...getStackOptions(), ...route.params?.options}}
26
+ />
27
+ </Stack.Navigator>
28
+ );
29
+ }
30
+ return (
31
+ <NavigationContainer independent={true}>
32
+ <Stack.Navigator>
33
+ <Stack.Screen
34
+ name="Stack"
35
+ component={StackScreen}
36
+ initialParams={{screen: route.params?.screen}}
37
+ options={{...getStackOptions(), ...route.params?.options}}
38
+ />
39
+ </Stack.Navigator>
40
+ </NavigationContainer>
41
+ );
42
+ };
43
+ const BottomTab: React.FC<BottomTabProps> = ({
44
+ nested,
45
+ tabs,
46
+ listeners,
47
+ navigation,
48
+ initialRouteName,
49
+ }) => {
12
50
  const {theme} = useContext(ApplicationContext);
51
+ const insets = useSafeAreaInsets();
13
52
 
14
- const defaultListener = {
15
- focus: (item: any) => {
16
- const focusItem = tabs.find(i => item.target.includes(i.name));
17
- if (focusItem?.options) {
18
- navigation?.setOptions?.(focusItem.options);
19
- }
20
- },
21
- };
53
+ useEffect(() => {
54
+ navigation?.setOptions({
55
+ headerShown: false,
56
+ headerTransparent: true,
57
+ headerBackground: undefined,
58
+ });
59
+ }, []);
22
60
 
23
61
  return (
24
- <Tab.Navigator backBehavior={'firstRoute'}>
62
+ <Tab.Navigator
63
+ initialRouteName={initialRouteName}
64
+ backBehavior={'firstRoute'}
65
+ tabBarOptions={{
66
+ style: {
67
+ height: 68 + Math.min(insets.bottom, 21),
68
+ },
69
+ tabStyle: {
70
+ height: 68,
71
+ paddingVertical: 8,
72
+ },
73
+ }}>
25
74
  {tabs.map(item => {
26
75
  return (
27
76
  <Tab.Screen
28
77
  key={item.name}
29
78
  name={item.name}
30
- component={item.screen}
31
- listeners={listeners ?? defaultListener}
79
+ component={TabScreen}
80
+ initialParams={{...item, nested}}
81
+ listeners={listeners}
32
82
  options={{
33
83
  tabBarLabel: ({color, focused}) => {
34
84
  return (
35
- <View style={{paddingHorizontal: 16}}>
36
- <Text
37
- typography={focused ? 'label_xs' : 'description_xs'}
38
- color={color}>
39
- {item.label}
40
- </Text>
41
- </View>
85
+ <Text
86
+ numberOfLines={1}
87
+ typography={
88
+ focused ? 'label_xs_medium' : 'description_xs_regular'
89
+ }
90
+ color={color}>
91
+ {item.label}
92
+ </Text>
42
93
  );
43
94
  },
44
95
  tabBarBadge: item?.badgeLabel,
@@ -46,10 +97,12 @@ const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners, navigation}) => {
46
97
  borderColor: 'white',
47
98
  borderWidth: 2,
48
99
  fontSize: 10,
49
- lineHeight: 14,
100
+ lineHeight: Platform.OS === 'android' ? 17 : 14,
50
101
  fontWeight: 'bold',
51
102
  alignSelf: 'center',
52
103
  fontFamily: `${theme.font}-Bold`,
104
+ left: item?.showDot ? 8 : 4,
105
+ top: item?.showDot ? -2 : -6,
53
106
  },
54
107
  tabBarIcon: ({color}) => (
55
108
  <Icon source={item.icon} color={color} size={28} />