@momo-kits/foundation 0.92.6-rc.24 → 0.92.6-rc.26
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/BottomTabBar.tsx +9 -13
- package/Application/BottomTab/index.tsx +14 -10
- package/Application/ModalScreen.tsx +14 -15
- package/Application/types.ts +1 -0
- package/Input/InputMoney.tsx +0 -1
- package/Input/common.tsx +0 -7
- package/Input/index.tsx +7 -0
- package/Layout/FloatingButton.tsx +1 -1
- package/package.json +1 -1
|
@@ -293,21 +293,19 @@ export default function BottomTabBar({
|
|
|
293
293
|
);
|
|
294
294
|
|
|
295
295
|
const renderCenterComponent = useCallback(() => {
|
|
296
|
-
const renderFloatingButton = () => {
|
|
297
|
-
if (typeof floatingButton?.icon == 'string') {
|
|
298
|
-
return <Icon source={floatingButton?.icon} size={32} color={'white'} />;
|
|
299
|
-
} else if (floatingButton?.icon) {
|
|
300
|
-
return floatingButton?.icon;
|
|
301
|
-
} else {
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
296
|
if (floatingButton?.icon && state.routes.length !== 4) {
|
|
306
297
|
console.warn(
|
|
307
298
|
"Can't render floating button with icon when routes length is not 4",
|
|
308
299
|
);
|
|
309
300
|
return null;
|
|
310
301
|
}
|
|
302
|
+
const renderFloatingButton = () => {
|
|
303
|
+
if (typeof floatingButton?.icon == 'string') {
|
|
304
|
+
return <Icon source={floatingButton?.icon} size={32} color={'white'} />;
|
|
305
|
+
}
|
|
306
|
+
return floatingButton?.icon;
|
|
307
|
+
};
|
|
308
|
+
|
|
311
309
|
return (
|
|
312
310
|
<View style={{flex: 1}}>
|
|
313
311
|
<TouchableOpacity
|
|
@@ -370,8 +368,6 @@ export default function BottomTabBar({
|
|
|
370
368
|
}),
|
|
371
369
|
},
|
|
372
370
|
],
|
|
373
|
-
// Absolutely position the tab bar so that the content is below it
|
|
374
|
-
// This is needed to avoid gap at bottom when the tab bar is hidden
|
|
375
371
|
position: isTabBarHidden ? 'absolute' : (null as any),
|
|
376
372
|
},
|
|
377
373
|
{
|
|
@@ -430,8 +426,8 @@ const styles = StyleSheet.create({
|
|
|
430
426
|
justifyContent: 'center',
|
|
431
427
|
height: 48,
|
|
432
428
|
width: 48,
|
|
433
|
-
borderRadius:
|
|
434
|
-
top: -
|
|
429
|
+
borderRadius: 24,
|
|
430
|
+
top: -10,
|
|
435
431
|
},
|
|
436
432
|
indicator: {
|
|
437
433
|
height: 2,
|
|
@@ -10,21 +10,26 @@ import {Text} from '../../Text';
|
|
|
10
10
|
import {ApplicationContext} from '../index';
|
|
11
11
|
import StackScreen from '../StackScreen';
|
|
12
12
|
import {BottomTabProps, NavigationScreenProps} from '../types';
|
|
13
|
-
import {getStackOptions} from '../utils';
|
|
13
|
+
import {getOptions, getStackOptions} from '../utils';
|
|
14
14
|
import BottomTabBar from './BottomTabBar';
|
|
15
15
|
|
|
16
16
|
const Tab = createBottomTabNavigator();
|
|
17
17
|
const Stack = createStackNavigator();
|
|
18
18
|
|
|
19
19
|
const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
|
|
20
|
+
const {theme} = useContext(ApplicationContext);
|
|
21
|
+
let options = {};
|
|
22
|
+
if (route.params?.options) {
|
|
23
|
+
options = getOptions(route.params?.options, theme);
|
|
24
|
+
}
|
|
20
25
|
if (route.params?.nested) {
|
|
21
26
|
return (
|
|
22
27
|
<Stack.Navigator>
|
|
23
28
|
<Stack.Screen
|
|
24
29
|
name="Stack"
|
|
25
30
|
component={StackScreen}
|
|
26
|
-
initialParams={{screen: route.params?.screen}}
|
|
27
|
-
options={{...getStackOptions()
|
|
31
|
+
initialParams={{screen: route.params?.screen, options}}
|
|
32
|
+
options={{...getStackOptions()}}
|
|
28
33
|
/>
|
|
29
34
|
</Stack.Navigator>
|
|
30
35
|
);
|
|
@@ -35,7 +40,7 @@ const TabScreen: React.FC<NavigationScreenProps> = ({route}) => {
|
|
|
35
40
|
<Stack.Screen
|
|
36
41
|
name="Stack"
|
|
37
42
|
component={StackScreen}
|
|
38
|
-
initialParams={{screen: route.params?.screen}}
|
|
43
|
+
initialParams={{screen: route.params?.screen, options}}
|
|
39
44
|
options={{...getStackOptions(), ...route.params?.options}}
|
|
40
45
|
/>
|
|
41
46
|
</Stack.Navigator>
|
|
@@ -83,6 +88,8 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
83
88
|
},
|
|
84
89
|
}}>
|
|
85
90
|
{tabs.map(item => {
|
|
91
|
+
const isNum = !isNaN(parseInt(`${item?.badgeLabel}`));
|
|
92
|
+
const isDot = typeof item?.badgeLabel == 'string' && !item?.badgeLabel;
|
|
86
93
|
return (
|
|
87
94
|
<Tab.Screen
|
|
88
95
|
key={item.name}
|
|
@@ -113,12 +120,9 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
113
120
|
fontWeight: 'bold',
|
|
114
121
|
alignSelf: 'center',
|
|
115
122
|
fontFamily: `${theme.font}-Bold`,
|
|
116
|
-
left:
|
|
117
|
-
top:
|
|
118
|
-
backgroundColor:
|
|
119
|
-
typeof item?.badgeLabel === 'string'
|
|
120
|
-
? Colors.orange_03
|
|
121
|
-
: Colors.red_03,
|
|
123
|
+
left: isDot ? 8 : 4,
|
|
124
|
+
top: isDot ? -2 : -6,
|
|
125
|
+
backgroundColor: isNum ? Colors.orange_03 : Colors.red_03,
|
|
122
126
|
},
|
|
123
127
|
tabBarIcon: ({color}) => (
|
|
124
128
|
<Icon source={item.icon} color={color} size={28} />
|
|
@@ -90,6 +90,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
90
90
|
options,
|
|
91
91
|
footerComponent,
|
|
92
92
|
flatListProps,
|
|
93
|
+
backgroundColor,
|
|
93
94
|
}: BottomSheetParams = props.route.params;
|
|
94
95
|
|
|
95
96
|
const navigation = new Navigation(props.navigation, theme);
|
|
@@ -127,6 +128,9 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
127
128
|
options?.title ?? options?.customTitle?.title ?? '',
|
|
128
129
|
handleClose,
|
|
129
130
|
)}
|
|
131
|
+
modalStyle={{
|
|
132
|
+
backgroundColor: backgroundColor ?? theme.colors.background.surface,
|
|
133
|
+
}}
|
|
130
134
|
FooterComponent={footerDefault(footerComponent)}>
|
|
131
135
|
<View style={styles.bottomSheetContainer}>
|
|
132
136
|
<Screen {...props} {...params} />
|
|
@@ -141,7 +145,7 @@ const headerDefault = (title: string, onClose: () => void) => {
|
|
|
141
145
|
<View style={styles.header}>
|
|
142
146
|
<Text
|
|
143
147
|
style={styles.textOption}
|
|
144
|
-
numberOfLines={
|
|
148
|
+
numberOfLines={1}
|
|
145
149
|
typography="header_default_bold">
|
|
146
150
|
{title ?? ''}
|
|
147
151
|
</Text>
|
|
@@ -154,14 +158,18 @@ const headerDefault = (title: string, onClose: () => void) => {
|
|
|
154
158
|
|
|
155
159
|
const footerDefault = (footerComponent: React.ReactNode) => {
|
|
156
160
|
const insets = useSafeAreaInsets();
|
|
157
|
-
if (!footerComponent) return;
|
|
158
161
|
return (
|
|
159
162
|
<View
|
|
160
163
|
style={{
|
|
161
|
-
marginBottom: Math.min(insets.bottom, 21)
|
|
164
|
+
marginBottom: Math.min(insets.bottom, 21),
|
|
162
165
|
paddingHorizontal: 12,
|
|
163
166
|
}}>
|
|
164
|
-
{footerComponent
|
|
167
|
+
{footerComponent && (
|
|
168
|
+
<>
|
|
169
|
+
{footerComponent}
|
|
170
|
+
<View style={{height: Spacing.S}} />
|
|
171
|
+
</>
|
|
172
|
+
)}
|
|
165
173
|
</View>
|
|
166
174
|
);
|
|
167
175
|
};
|
|
@@ -204,9 +212,6 @@ const styles = StyleSheet.create({
|
|
|
204
212
|
},
|
|
205
213
|
bottomSheetContainer: {
|
|
206
214
|
width: '100%',
|
|
207
|
-
backgroundColor: 'white',
|
|
208
|
-
borderTopRightRadius: 16,
|
|
209
|
-
borderTopLeftRadius: 16,
|
|
210
215
|
},
|
|
211
216
|
header: {
|
|
212
217
|
height: 50,
|
|
@@ -219,15 +224,9 @@ const styles = StyleSheet.create({
|
|
|
219
224
|
color: '#303233',
|
|
220
225
|
textAlign: 'center',
|
|
221
226
|
fontWeight: 'bold',
|
|
222
|
-
paddingHorizontal:
|
|
223
|
-
},
|
|
224
|
-
imageOption: {
|
|
225
|
-
height: 1,
|
|
226
|
-
backgroundColor: '#ebebeb',
|
|
227
|
-
width: '100%',
|
|
228
|
-
position: 'absolute',
|
|
229
|
-
bottom: 1,
|
|
227
|
+
paddingHorizontal: Spacing.L,
|
|
230
228
|
},
|
|
229
|
+
|
|
231
230
|
buttonClose: {
|
|
232
231
|
padding: 12,
|
|
233
232
|
position: 'absolute',
|
package/Application/types.ts
CHANGED
|
@@ -119,6 +119,7 @@ export interface ModalParams extends ScreenParams {
|
|
|
119
119
|
export interface BottomSheetParams extends ScreenParams {
|
|
120
120
|
[key: string]: any;
|
|
121
121
|
onDismiss?: () => void;
|
|
122
|
+
backgroundColor?: string;
|
|
122
123
|
footerComponent?: React.ReactNode;
|
|
123
124
|
flatListProps?: FlatListProps<any>;
|
|
124
125
|
}
|
package/Input/InputMoney.tsx
CHANGED
package/Input/common.tsx
CHANGED
|
@@ -16,13 +16,6 @@ type FloatingViewProps = {
|
|
|
16
16
|
style?: ViewStyle;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export interface InputRef {
|
|
20
|
-
focus: () => void;
|
|
21
|
-
blur: () => void;
|
|
22
|
-
clear: () => void;
|
|
23
|
-
setText: (text: string) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
19
|
export const DEFAULT_HEIGHT = scaleSize(104);
|
|
27
20
|
export const MAX_LENGTH = 300;
|
|
28
21
|
|
package/Input/index.tsx
CHANGED
|
@@ -6,6 +6,13 @@ import InputOTP from './InputOTP';
|
|
|
6
6
|
import InputSearch from './InputSearch';
|
|
7
7
|
import InputTextArea from './InputTextArea';
|
|
8
8
|
|
|
9
|
+
export interface InputRef {
|
|
10
|
+
focus: () => void;
|
|
11
|
+
blur: () => void;
|
|
12
|
+
clear: () => void;
|
|
13
|
+
setText: (text: string) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
export interface InputProps extends TextInputProps {
|
|
10
17
|
/**
|
|
11
18
|
* Optional. Defines the size of the Input component.
|
|
@@ -45,7 +45,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
45
45
|
if (!label) return;
|
|
46
46
|
|
|
47
47
|
const listener = animatedValue?.addListener(({value}) => {
|
|
48
|
-
if (value !== lastOffset.current) {
|
|
48
|
+
if (value !== lastOffset.current && value > 0) {
|
|
49
49
|
const direction = value > lastOffset.current ? 'down' : 'up';
|
|
50
50
|
lastOffset.current = value;
|
|
51
51
|
if (lastDirection.current !== direction) {
|