@umituz/react-native-design-system 2.6.30 → 2.6.32
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.32",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -18,6 +18,7 @@ export interface AtomicButtonProps {
|
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
loading?: boolean;
|
|
20
20
|
icon?: IconName;
|
|
21
|
+
iconPosition?: 'left' | 'right';
|
|
21
22
|
fullWidth?: boolean;
|
|
22
23
|
style?: StyleProp<ViewStyle>;
|
|
23
24
|
textStyle?: StyleProp<TextStyle>;
|
|
@@ -34,6 +35,7 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
34
35
|
disabled = false,
|
|
35
36
|
loading = false,
|
|
36
37
|
icon,
|
|
38
|
+
iconPosition = 'left',
|
|
37
39
|
fullWidth = false,
|
|
38
40
|
style,
|
|
39
41
|
textStyle,
|
|
@@ -197,19 +199,19 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
197
199
|
disabled={isDisabled}
|
|
198
200
|
testID={testID}
|
|
199
201
|
>
|
|
200
|
-
<View style={styles.content}>
|
|
202
|
+
<View style={[styles.content, iconPosition === 'right' && styles.rowReverse]}>
|
|
201
203
|
{loading ? (
|
|
202
204
|
<AtomicSpinner
|
|
203
205
|
size="sm"
|
|
204
206
|
color={iconColor as string}
|
|
205
|
-
style={styles.
|
|
207
|
+
style={iconPosition === 'right' ? styles.iconRight : styles.iconLeft}
|
|
206
208
|
/>
|
|
207
209
|
) : showIcon ? (
|
|
208
210
|
<AtomicIcon
|
|
209
211
|
name={icon}
|
|
210
212
|
customSize={config.iconSize}
|
|
211
213
|
customColor={iconColor as string | undefined}
|
|
212
|
-
style={styles.
|
|
214
|
+
style={iconPosition === 'right' ? styles.iconRight : styles.iconLeft}
|
|
213
215
|
/>
|
|
214
216
|
) : null}
|
|
215
217
|
|
|
@@ -233,6 +235,9 @@ const styles = StyleSheet.create({
|
|
|
233
235
|
alignItems: 'center',
|
|
234
236
|
justifyContent: 'center',
|
|
235
237
|
},
|
|
238
|
+
rowReverse: {
|
|
239
|
+
flexDirection: 'row-reverse',
|
|
240
|
+
},
|
|
236
241
|
fullWidth: {
|
|
237
242
|
width: '100%',
|
|
238
243
|
},
|
|
@@ -242,9 +247,12 @@ const styles = StyleSheet.create({
|
|
|
242
247
|
disabledText: {
|
|
243
248
|
opacity: 0.7,
|
|
244
249
|
},
|
|
245
|
-
|
|
250
|
+
iconLeft: {
|
|
246
251
|
marginRight: 8,
|
|
247
252
|
},
|
|
253
|
+
iconRight: {
|
|
254
|
+
marginLeft: 8,
|
|
255
|
+
},
|
|
248
256
|
});
|
|
249
257
|
|
|
250
258
|
export type { AtomicButtonProps as ButtonProps };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { TouchableOpacity } from "react-native";
|
|
2
3
|
import type { ParamListBase } from "@react-navigation/native";
|
|
3
4
|
import type {
|
|
4
5
|
BottomTabScreenProps,
|
|
5
6
|
BottomTabNavigationOptions,
|
|
7
|
+
BottomTabBarButtonProps,
|
|
6
8
|
} from "@react-navigation/bottom-tabs";
|
|
7
9
|
import type {
|
|
8
10
|
TabScreen,
|
|
@@ -13,7 +15,22 @@ import type {
|
|
|
13
15
|
import { LabelProcessor } from "./LabelProcessor";
|
|
14
16
|
import { IconRenderer } from "./IconRenderer";
|
|
15
17
|
|
|
18
|
+
const TabBarButton: React.FC<BottomTabBarButtonProps> = (props) => {
|
|
19
|
+
const { children, onPress, onLongPress, accessibilityState, style } = props;
|
|
16
20
|
|
|
21
|
+
return React.createElement(
|
|
22
|
+
TouchableOpacity,
|
|
23
|
+
{
|
|
24
|
+
onPress: onPress ?? undefined,
|
|
25
|
+
onLongPress: onLongPress ?? undefined,
|
|
26
|
+
activeOpacity: 0.7,
|
|
27
|
+
accessibilityRole: "button",
|
|
28
|
+
accessibilityState,
|
|
29
|
+
style: [{ flex: 1, alignItems: "center", justifyContent: "center" }, style],
|
|
30
|
+
},
|
|
31
|
+
children
|
|
32
|
+
);
|
|
33
|
+
};
|
|
17
34
|
|
|
18
35
|
export function createTabScreen<T extends ParamListBase = ParamListBase>(
|
|
19
36
|
screen: TabScreen<T>,
|
|
@@ -34,6 +51,7 @@ export function createTabScreen<T extends ParamListBase = ParamListBase>(
|
|
|
34
51
|
tabBarLabel: isFab ? "" : processedLabel,
|
|
35
52
|
title: isFab ? "" : processedLabel,
|
|
36
53
|
tabBarShowLabel: isFab ? false : undefined,
|
|
54
|
+
tabBarButton: (buttonProps) => React.createElement(TabBarButton, buttonProps),
|
|
37
55
|
tabBarIcon: ({ focused }: { focused: boolean }) => {
|
|
38
56
|
const iconName = IconRenderer.getIconName(
|
|
39
57
|
screen.name,
|