@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.
- package/Application/BottomTab.tsx +76 -23
- package/Application/Components.tsx +243 -198
- package/Application/ModalScreen.tsx +20 -65
- package/Application/Navigation.ts +15 -4
- package/Application/NavigationContainer.tsx +20 -20
- package/Application/Navigator.ts +61 -28
- package/Application/StackScreen.tsx +41 -23
- package/Application/index.ts +16 -6
- package/Application/types.ts +34 -19
- package/Application/utils.tsx +26 -0
- package/Assets/icon.json +83 -5
- package/Assets/icon_bank.json +506 -0
- package/Assets/language.json +3 -1
- package/Badge/Badge.tsx +56 -0
- package/Badge/BadgeDot.tsx +11 -0
- package/Badge/BadgeRibbon.tsx +125 -0
- package/Badge/Shape.tsx +29 -0
- package/Badge/index.tsx +7 -0
- package/Badge/styles.ts +58 -0
- package/Badge/types.ts +63 -0
- package/Button/index.tsx +26 -9
- package/Button/styles.ts +19 -0
- package/CheckBox/index.tsx +1 -2
- package/Consts/colors+spacing+radius.ts +3 -3
- package/Icon/index.tsx +7 -3
- package/Icon/types.ts +3 -3
- package/IconButton/index.tsx +0 -1
- package/Image/index.tsx +39 -49
- package/Image/styles.ts +1 -9
- package/Image/types.ts +3 -1
- package/Input/Input.tsx +37 -16
- package/Input/InputDropDown.tsx +5 -14
- package/Input/InputMoney.tsx +28 -11
- package/Input/InputOTP.tsx +169 -145
- package/Input/InputSearch.tsx +9 -13
- package/Input/InputTextArea.tsx +6 -12
- package/Input/common.tsx +5 -3
- package/Input/index.tsx +15 -9
- package/Input/styles.ts +1 -4
- package/Layout/Card.tsx +20 -11
- package/Layout/GridSystem.tsx +1 -2
- package/Layout/Item.tsx +0 -1
- package/Layout/ItemList.tsx +39 -40
- package/Layout/ItemSectionList.tsx +39 -0
- package/Layout/Screen.tsx +96 -45
- package/Layout/Section.tsx +17 -19
- package/Layout/index.ts +2 -1
- package/Layout/styles.ts +16 -15
- package/Layout/types.ts +2 -5
- package/Pagination/PaginationNumber.tsx +1 -1
- package/Pagination/PaginationScroll.tsx +0 -1
- package/Popup/PopupNotify.tsx +71 -14
- package/Popup/PopupPromotion.tsx +43 -6
- package/Popup/types.ts +12 -3
- package/Radio/index.tsx +1 -2
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +0 -1
- package/Tag/index.tsx +2 -4
- package/Text/index.tsx +3 -2
- package/Text/styles.ts +38 -0
- package/Text/types.ts +25 -13
- package/Title/index.tsx +82 -38
- package/Title/styles.ts +16 -10
- package/Title/types.ts +2 -1
- package/index.ts +2 -0
- package/package.json +6 -6
- package/verify.js +15 -0
|
@@ -1,44 +1,95 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {
|
|
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
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
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={
|
|
31
|
-
|
|
79
|
+
component={TabScreen}
|
|
80
|
+
initialParams={{...item, nested}}
|
|
81
|
+
listeners={listeners}
|
|
32
82
|
options={{
|
|
33
83
|
tabBarLabel: ({color, focused}) => {
|
|
34
84
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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} />
|