react-native-mantine 0.5.0 → 0.6.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.
- package/README.md +0 -357
- package/lib/commonjs/components/Button/Button.styles.js +4 -4
- package/lib/commonjs/components/Button/Button.styles.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +15 -14
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Chip/index.js.map +1 -1
- package/lib/commonjs/components/CloseButton/index.js +5 -30
- package/lib/commonjs/components/CloseButton/index.js.map +1 -1
- package/lib/commonjs/components/Collapse/index.js +10 -2
- package/lib/commonjs/components/Collapse/index.js.map +1 -1
- package/lib/commonjs/components/Dialog/index.js +51 -8
- package/lib/commonjs/components/Dialog/index.js.map +1 -1
- package/lib/commonjs/components/Drawer/index.js +4 -13
- package/lib/commonjs/components/Drawer/index.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js +53 -0
- package/lib/commonjs/components/Icon/index.js.map +1 -0
- package/lib/commonjs/components/List/index.js.map +1 -1
- package/lib/commonjs/components/Menu/index.js +11 -10
- package/lib/commonjs/components/Menu/index.js.map +1 -1
- package/lib/commonjs/components/Modal/index.js +10 -16
- package/lib/commonjs/components/Modal/index.js.map +1 -1
- package/lib/commonjs/components/Notification/index.js +12 -5
- package/lib/commonjs/components/Notification/index.js.map +1 -1
- package/lib/commonjs/components/NumberInput/index.js +2 -1
- package/lib/commonjs/components/NumberInput/index.js.map +1 -1
- package/lib/commonjs/components/PasswordInput/index.js +5 -6
- package/lib/commonjs/components/PasswordInput/index.js.map +1 -1
- package/lib/commonjs/components/PinInput/index.js +7 -2
- package/lib/commonjs/components/PinInput/index.js.map +1 -1
- package/lib/commonjs/components/Popover/index.js +8 -7
- package/lib/commonjs/components/Popover/index.js.map +1 -1
- package/lib/commonjs/components/RingProgress/index.js +49 -7
- package/lib/commonjs/components/RingProgress/index.js.map +1 -1
- package/lib/commonjs/components/SegmentedControl/index.js +7 -4
- package/lib/commonjs/components/SegmentedControl/index.js.map +1 -1
- package/lib/commonjs/components/Slider/index.js +28 -3
- package/lib/commonjs/components/Slider/index.js.map +1 -1
- package/lib/commonjs/components/Stepper/index.js.map +1 -1
- package/lib/commonjs/components/Table/index.js +22 -20
- package/lib/commonjs/components/Table/index.js.map +1 -1
- package/lib/commonjs/components/TextInput/index.js +2 -2
- package/lib/commonjs/components/TextInput/index.js.map +1 -1
- package/lib/commonjs/components/Timeline/index.js +12 -5
- package/lib/commonjs/components/Timeline/index.js.map +1 -1
- package/lib/commonjs/components/Tooltip/index.js +12 -11
- package/lib/commonjs/components/Tooltip/index.js.map +1 -1
- package/lib/commonjs/components/TransferList/index.js +3 -8
- package/lib/commonjs/components/TransferList/index.js.map +1 -1
- package/lib/commonjs/components/Transition/index.js +4 -0
- package/lib/commonjs/components/Transition/index.js.map +1 -1
- package/lib/commonjs/components/UnstyledButton/UnstyledButton.js +4 -0
- package/lib/commonjs/components/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/commonjs/components/index.js +22 -22
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/theme/functions/attach-functions.js +3 -0
- package/lib/commonjs/theme/functions/attach-functions.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/helpers.js +12 -1
- package/lib/commonjs/theme/functions/fns/helpers.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/index.js +4 -0
- package/lib/commonjs/theme/functions/fns/index.js.map +1 -1
- package/lib/commonjs/theme/functions/fns/rgba.js +50 -0
- package/lib/commonjs/theme/functions/fns/rgba.js.map +1 -0
- package/lib/commonjs/theme/functions/fns/size.js +19 -0
- package/lib/commonjs/theme/functions/fns/size.js.map +1 -0
- package/lib/module/components/Button/Button.styles.js +4 -4
- package/lib/module/components/Button/Button.styles.js.map +1 -1
- package/lib/module/components/Button/index.js +15 -14
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Chip/index.js.map +1 -1
- package/lib/module/components/CloseButton/index.js +6 -31
- package/lib/module/components/CloseButton/index.js.map +1 -1
- package/lib/module/components/Collapse/index.js +10 -2
- package/lib/module/components/Collapse/index.js.map +1 -1
- package/lib/module/components/Dialog/index.js +52 -9
- package/lib/module/components/Dialog/index.js.map +1 -1
- package/lib/module/components/Drawer/index.js +4 -13
- package/lib/module/components/Drawer/index.js.map +1 -1
- package/lib/module/components/Icon/index.js +48 -0
- package/lib/module/components/Icon/index.js.map +1 -0
- package/lib/module/components/List/index.js.map +1 -1
- package/lib/module/components/Menu/index.js +9 -8
- package/lib/module/components/Menu/index.js.map +1 -1
- package/lib/module/components/Modal/index.js +10 -16
- package/lib/module/components/Modal/index.js.map +1 -1
- package/lib/module/components/Notification/index.js +12 -5
- package/lib/module/components/Notification/index.js.map +1 -1
- package/lib/module/components/NumberInput/index.js +2 -1
- package/lib/module/components/NumberInput/index.js.map +1 -1
- package/lib/module/components/PasswordInput/index.js +5 -6
- package/lib/module/components/PasswordInput/index.js.map +1 -1
- package/lib/module/components/PinInput/index.js +7 -2
- package/lib/module/components/PinInput/index.js.map +1 -1
- package/lib/module/components/Popover/index.js +9 -8
- package/lib/module/components/Popover/index.js.map +1 -1
- package/lib/module/components/RingProgress/index.js +51 -9
- package/lib/module/components/RingProgress/index.js.map +1 -1
- package/lib/module/components/SegmentedControl/index.js +7 -4
- package/lib/module/components/SegmentedControl/index.js.map +1 -1
- package/lib/module/components/Slider/index.js +28 -3
- package/lib/module/components/Slider/index.js.map +1 -1
- package/lib/module/components/Stepper/index.js.map +1 -1
- package/lib/module/components/Table/index.js +22 -19
- package/lib/module/components/Table/index.js.map +1 -1
- package/lib/module/components/TextInput/index.js +2 -2
- package/lib/module/components/TextInput/index.js.map +1 -1
- package/lib/module/components/Timeline/index.js +12 -5
- package/lib/module/components/Timeline/index.js.map +1 -1
- package/lib/module/components/Tooltip/index.js +11 -10
- package/lib/module/components/Tooltip/index.js.map +1 -1
- package/lib/module/components/TransferList/index.js +4 -9
- package/lib/module/components/TransferList/index.js.map +1 -1
- package/lib/module/components/Transition/index.js +5 -1
- package/lib/module/components/Transition/index.js.map +1 -1
- package/lib/module/components/UnstyledButton/UnstyledButton.js +4 -0
- package/lib/module/components/UnstyledButton/UnstyledButton.js.map +1 -1
- package/lib/module/components/index.js +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/theme/functions/attach-functions.js +3 -0
- package/lib/module/theme/functions/attach-functions.js.map +1 -1
- package/lib/module/theme/functions/fns/helpers.js +10 -0
- package/lib/module/theme/functions/fns/helpers.js.map +1 -1
- package/lib/module/theme/functions/fns/index.js +4 -0
- package/lib/module/theme/functions/fns/index.js.map +1 -1
- package/lib/module/theme/functions/fns/rgba.js +46 -0
- package/lib/module/theme/functions/fns/rgba.js.map +1 -0
- package/lib/module/theme/functions/fns/size.js +15 -0
- package/lib/module/theme/functions/fns/size.js.map +1 -0
- package/lib/typescript/commonjs/src/components/Button/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/CloseButton/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Collapse/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Dialog/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Drawer/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Icon/index.d.ts +26 -0
- package/lib/typescript/commonjs/src/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Modal/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Notification/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/NumberInput/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/PinInput/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Popover/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/RingProgress/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SegmentedControl/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Slider/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Stepper/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Table/index.d.ts +16 -7
- package/lib/typescript/commonjs/src/components/Table/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/TextInput/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Timeline/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Tooltip/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/TransferList/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Transition/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/UnstyledButton/UnstyledButton.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/UnstyledButton/UnstyledButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/attach-functions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/helpers.d.ts +7 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/helpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/theme/functions/fns/rgba.d.ts +8 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/rgba.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/size.d.ts +6 -0
- package/lib/typescript/commonjs/src/theme/functions/fns/size.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Button/index.d.ts +1 -0
- package/lib/typescript/module/src/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/CloseButton/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Collapse/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Dialog/index.d.ts +2 -0
- package/lib/typescript/module/src/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Drawer/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Icon/index.d.ts +26 -0
- package/lib/typescript/module/src/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Menu/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Modal/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Notification/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/NumberInput/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/PinInput/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Popover/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/RingProgress/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SegmentedControl/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Slider/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Stepper/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Table/index.d.ts +16 -7
- package/lib/typescript/module/src/components/Table/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/TextInput/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Timeline/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Tooltip/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/TransferList/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Transition/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/UnstyledButton/UnstyledButton.d.ts +2 -0
- package/lib/typescript/module/src/components/UnstyledButton/UnstyledButton.d.ts.map +1 -1
- package/lib/typescript/module/src/components/index.d.ts +1 -1
- package/lib/typescript/module/src/components/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/attach-functions.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/helpers.d.ts +7 -0
- package/lib/typescript/module/src/theme/functions/fns/helpers.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/index.d.ts +7 -0
- package/lib/typescript/module/src/theme/functions/fns/index.d.ts.map +1 -1
- package/lib/typescript/module/src/theme/functions/fns/rgba.d.ts +8 -0
- package/lib/typescript/module/src/theme/functions/fns/rgba.d.ts.map +1 -0
- package/lib/typescript/module/src/theme/functions/fns/size.d.ts +6 -0
- package/lib/typescript/module/src/theme/functions/fns/size.d.ts.map +1 -0
- package/package.json +12 -9
- package/src/components/Button/Button.styles.ts +3 -3
- package/src/components/Button/index.tsx +56 -61
- package/src/components/Chip/index.tsx +3 -3
- package/src/components/CloseButton/index.tsx +2 -23
- package/src/components/Collapse/index.tsx +11 -2
- package/src/components/Dialog/index.tsx +54 -9
- package/src/components/Drawer/index.tsx +7 -13
- package/src/components/Icon/index.tsx +74 -0
- package/src/components/List/index.tsx +1 -1
- package/src/components/Menu/index.tsx +13 -10
- package/src/components/Modal/index.tsx +11 -16
- package/src/components/Notification/index.tsx +10 -2
- package/src/components/NumberInput/index.tsx +57 -15
- package/src/components/PasswordInput/index.tsx +2 -2
- package/src/components/PinInput/index.tsx +24 -9
- package/src/components/Popover/index.tsx +13 -10
- package/src/components/RingProgress/index.tsx +51 -8
- package/src/components/SegmentedControl/index.tsx +6 -4
- package/src/components/Slider/index.tsx +14 -3
- package/src/components/Stepper/index.tsx +5 -4
- package/src/components/Table/index.tsx +73 -36
- package/src/components/TextInput/index.tsx +93 -66
- package/src/components/Timeline/index.tsx +19 -12
- package/src/components/Tooltip/index.tsx +13 -10
- package/src/components/TransferList/index.tsx +1 -5
- package/src/components/Transition/index.tsx +14 -2
- package/src/components/UnstyledButton/UnstyledButton.tsx +5 -1
- package/src/components/index.tsx +1 -1
- package/src/theme/functions/attach-functions.ts +3 -0
- package/src/theme/functions/fns/helpers.ts +19 -7
- package/src/theme/functions/fns/index.ts +4 -0
- package/src/theme/functions/fns/rgba.ts +45 -0
- package/src/theme/functions/fns/size.ts +14 -0
- package/lib/commonjs/components/Portal/index.js +0 -69
- package/lib/commonjs/components/Portal/index.js.map +0 -1
- package/lib/module/components/Portal/index.js +0 -62
- package/lib/module/components/Portal/index.js.map +0 -1
- package/lib/typescript/commonjs/src/components/Portal/index.d.ts +0 -10
- package/lib/typescript/commonjs/src/components/Portal/index.d.ts.map +0 -1
- package/lib/typescript/module/src/components/Portal/index.d.ts +0 -10
- package/lib/typescript/module/src/components/Portal/index.d.ts.map +0 -1
- package/src/components/Portal/index.tsx +0 -75
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import type { TextStyle } from 'react-native';
|
|
3
|
+
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
|
4
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
5
|
+
|
|
6
|
+
export interface IconProps {
|
|
7
|
+
/** Icon name from FontAwesome */
|
|
8
|
+
name: string;
|
|
9
|
+
|
|
10
|
+
/** Icon size in pixels */
|
|
11
|
+
size?: number;
|
|
12
|
+
|
|
13
|
+
/** Icon color */
|
|
14
|
+
color?: string;
|
|
15
|
+
|
|
16
|
+
/** Additional styles */
|
|
17
|
+
style?: TextStyle;
|
|
18
|
+
|
|
19
|
+
/** Whether to use theme color */
|
|
20
|
+
useThemeColor?: boolean;
|
|
21
|
+
|
|
22
|
+
/** Allow font scaling */
|
|
23
|
+
allowFontScaling?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const defaultProps: Partial<IconProps> = {
|
|
27
|
+
size: 16,
|
|
28
|
+
allowFontScaling: false,
|
|
29
|
+
useThemeColor: false,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Icon component using react-native-vector-icons with FontAwesome
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Icon name="heart" size={24} color="red" />
|
|
38
|
+
* <Icon name="star" size={20} useThemeColor />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const Icon = forwardRef<any, IconProps>((props, ref) => {
|
|
42
|
+
const {
|
|
43
|
+
name,
|
|
44
|
+
size,
|
|
45
|
+
color,
|
|
46
|
+
style,
|
|
47
|
+
useThemeColor,
|
|
48
|
+
allowFontScaling,
|
|
49
|
+
...others
|
|
50
|
+
} = {
|
|
51
|
+
...defaultProps,
|
|
52
|
+
...props,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const theme = useTheme();
|
|
56
|
+
|
|
57
|
+
const iconColor = color || (useThemeColor
|
|
58
|
+
? (theme.colorScheme === 'dark' ? theme.colors.dark?.[0] : theme.black)
|
|
59
|
+
: undefined);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<FontAwesomeIcon
|
|
63
|
+
ref={ref}
|
|
64
|
+
name={name}
|
|
65
|
+
size={size}
|
|
66
|
+
color={iconColor}
|
|
67
|
+
style={style}
|
|
68
|
+
allowFontScaling={allowFontScaling}
|
|
69
|
+
{...others}
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
Icon.displayName = 'Icon';
|
|
@@ -228,7 +228,7 @@ const ListRoot = forwardRef<any, ListProps>((props, ref) => {
|
|
|
228
228
|
<BoxView ref={ref} style={sx(styles.root, style)} {...others}>
|
|
229
229
|
{childrenArray.map((child, index) => {
|
|
230
230
|
if (!React.isValidElement(child)) return child;
|
|
231
|
-
return React.cloneElement(child as React.ReactElement
|
|
231
|
+
return React.cloneElement<ListItemProps>(child as React.ReactElement<ListItemProps>, {
|
|
232
232
|
key: index,
|
|
233
233
|
__index: index,
|
|
234
234
|
});
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
View,
|
|
4
4
|
TouchableOpacity,
|
|
5
5
|
Animated,
|
|
6
|
+
Modal,
|
|
6
7
|
} from 'react-native';
|
|
7
8
|
import { BoxView } from '../BoxView';
|
|
8
9
|
import { Text } from '../Text';
|
|
9
10
|
import { Divider } from '../Divider';
|
|
10
|
-
import { Portal } from '../Portal';
|
|
11
11
|
import type {
|
|
12
12
|
DefaultProps,
|
|
13
13
|
MantineColor,
|
|
@@ -171,7 +171,7 @@ interface MenuContextValue {
|
|
|
171
171
|
opened: boolean;
|
|
172
172
|
setOpened: (opened: boolean) => void;
|
|
173
173
|
closeOnItemClick: boolean;
|
|
174
|
-
targetRef: React.RefObject<View>;
|
|
174
|
+
targetRef: React.RefObject<View | null>;
|
|
175
175
|
dropdownPosition: { top: number; left: number; width: number };
|
|
176
176
|
setDropdownPosition: (pos: { top: number; left: number; width: number }) => void;
|
|
177
177
|
}
|
|
@@ -216,7 +216,7 @@ const MenuTarget: React.FC<MenuTargetProps> = ({ children }) => {
|
|
|
216
216
|
setOpened(true);
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
-
return React.cloneElement(children
|
|
219
|
+
return React.cloneElement(children as React.ReactElement<any>, {
|
|
220
220
|
ref: targetRef,
|
|
221
221
|
onPress: handlePress,
|
|
222
222
|
});
|
|
@@ -241,16 +241,19 @@ const MenuDropdown: React.FC<MenuDropdownProps> = ({ children, style, ...others
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
return (
|
|
244
|
-
<
|
|
244
|
+
<Modal
|
|
245
|
+
visible={opened}
|
|
246
|
+
transparent
|
|
247
|
+
animationType="none"
|
|
248
|
+
onRequestClose={() => setOpened(false)}
|
|
249
|
+
statusBarTranslucent
|
|
250
|
+
>
|
|
245
251
|
<TouchableOpacity
|
|
246
252
|
activeOpacity={1}
|
|
247
253
|
onPress={() => setOpened(false)}
|
|
248
254
|
style={{
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
left: 0,
|
|
252
|
-
right: 0,
|
|
253
|
-
bottom: 0,
|
|
255
|
+
flex: 1,
|
|
256
|
+
backgroundColor: 'transparent',
|
|
254
257
|
}}
|
|
255
258
|
>
|
|
256
259
|
<Animated.View
|
|
@@ -268,7 +271,7 @@ const MenuDropdown: React.FC<MenuDropdownProps> = ({ children, style, ...others
|
|
|
268
271
|
{children}
|
|
269
272
|
</Animated.View>
|
|
270
273
|
</TouchableOpacity>
|
|
271
|
-
</
|
|
274
|
+
</Modal>
|
|
272
275
|
);
|
|
273
276
|
};
|
|
274
277
|
|
|
@@ -110,10 +110,11 @@ const useStyles = createStyles(
|
|
|
110
110
|
return {
|
|
111
111
|
overlay: {
|
|
112
112
|
flex: 1,
|
|
113
|
-
backgroundColor: '
|
|
113
|
+
backgroundColor: 'transparent',
|
|
114
114
|
justifyContent: centered ? 'center' : 'flex-start',
|
|
115
115
|
alignItems: 'center',
|
|
116
116
|
paddingTop: (centered ? 0 : rem(60)) as any,
|
|
117
|
+
zIndex: 1001, // Ensure modal content is above backdrop
|
|
117
118
|
},
|
|
118
119
|
container: {
|
|
119
120
|
backgroundColor: theme.colorScheme === 'dark' ? (theme.colors.dark || [])[7] : theme.white,
|
|
@@ -124,6 +125,7 @@ const useStyles = createStyles(
|
|
|
124
125
|
...(fullScreen && {
|
|
125
126
|
height: '100%',
|
|
126
127
|
}),
|
|
128
|
+
zIndex: 1002, // Ensure modal content is above its parent overlay
|
|
127
129
|
},
|
|
128
130
|
header: {
|
|
129
131
|
padding: getPadding(),
|
|
@@ -254,24 +256,17 @@ export const Modal = forwardRef<any, ModalProps>((props, ref) => {
|
|
|
254
256
|
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
255
257
|
style={{ flex: 1 }}
|
|
256
258
|
>
|
|
259
|
+
{/* Full screen overlay backdrop */}
|
|
257
260
|
{withOverlay && (
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
]}
|
|
265
|
-
>
|
|
266
|
-
<Overlay
|
|
267
|
-
opacity={overlayOpacity}
|
|
268
|
-
color={overlayColor}
|
|
269
|
-
onPress={handleOverlayPress}
|
|
270
|
-
style={{ position: 'absolute' }}
|
|
271
|
-
/>
|
|
272
|
-
</Animated.View>
|
|
261
|
+
<Overlay
|
|
262
|
+
opacity={overlayOpacity}
|
|
263
|
+
color={overlayColor}
|
|
264
|
+
onPress={handleOverlayPress}
|
|
265
|
+
zIndex={1000}
|
|
266
|
+
/>
|
|
273
267
|
)}
|
|
274
268
|
|
|
269
|
+
{/* Modal container positioned over overlay */}
|
|
275
270
|
<TouchableOpacity
|
|
276
271
|
activeOpacity={1}
|
|
277
272
|
style={styles.overlay}
|
|
@@ -156,10 +156,18 @@ export const Notification = forwardRef<any, NotificationProps>((props, ref) => {
|
|
|
156
156
|
|
|
157
157
|
<BoxView style={styles.body}>
|
|
158
158
|
{title && (
|
|
159
|
-
|
|
159
|
+
typeof title === 'string' || typeof title === 'number' ? (
|
|
160
|
+
<Text style={styles.title}>{title}</Text>
|
|
161
|
+
) : (
|
|
162
|
+
<BoxView style={{ marginBottom: styles.title.marginBottom }}>{title}</BoxView>
|
|
163
|
+
)
|
|
160
164
|
)}
|
|
161
165
|
{message && (
|
|
162
|
-
|
|
166
|
+
typeof message === 'string' || typeof message === 'number' ? (
|
|
167
|
+
<Text style={styles.message}>{message}</Text>
|
|
168
|
+
) : (
|
|
169
|
+
<BoxView>{message}</BoxView>
|
|
170
|
+
)
|
|
163
171
|
)}
|
|
164
172
|
</BoxView>
|
|
165
173
|
|
|
@@ -4,7 +4,6 @@ import { BoxView } from '../BoxView';
|
|
|
4
4
|
import { Text } from '../Text';
|
|
5
5
|
import type {
|
|
6
6
|
DefaultProps,
|
|
7
|
-
|
|
8
7
|
MantineNumberSize,
|
|
9
8
|
MantineSize,
|
|
10
9
|
} from '../../theme/types';
|
|
@@ -13,7 +12,19 @@ import { createStyles, getSize } from '../../theme';
|
|
|
13
12
|
import { rem } from '../../theme/utils/rem';
|
|
14
13
|
import { INPUT_SIZES } from '../Input';
|
|
15
14
|
|
|
16
|
-
export interface NumberInputProps
|
|
15
|
+
export interface NumberInputProps
|
|
16
|
+
extends
|
|
17
|
+
DefaultProps,
|
|
18
|
+
Omit<
|
|
19
|
+
TextInputProps,
|
|
20
|
+
| 'value'
|
|
21
|
+
| 'onChangeText'
|
|
22
|
+
| 'onChange'
|
|
23
|
+
| 'keyboardType'
|
|
24
|
+
| 'editable'
|
|
25
|
+
| 'placeholderTextColor'
|
|
26
|
+
| 'defaultValue'
|
|
27
|
+
> {
|
|
17
28
|
/** Input label */
|
|
18
29
|
label?: React.ReactNode;
|
|
19
30
|
|
|
@@ -101,7 +112,9 @@ const useStyles = createStyles(
|
|
|
101
112
|
case 'filled':
|
|
102
113
|
return {
|
|
103
114
|
backgroundColor:
|
|
104
|
-
theme.colorScheme === 'dark'
|
|
115
|
+
theme.colorScheme === 'dark'
|
|
116
|
+
? (theme.colors.dark || [])[5]
|
|
117
|
+
: (theme.colors.gray || [])[1],
|
|
105
118
|
borderWidth: 1,
|
|
106
119
|
borderColor: 'transparent',
|
|
107
120
|
};
|
|
@@ -112,10 +125,15 @@ const useStyles = createStyles(
|
|
|
112
125
|
};
|
|
113
126
|
default:
|
|
114
127
|
return {
|
|
115
|
-
backgroundColor:
|
|
128
|
+
backgroundColor:
|
|
129
|
+
theme.colorScheme === 'dark'
|
|
130
|
+
? (theme.colors.dark || [])[6]
|
|
131
|
+
: theme.white,
|
|
116
132
|
borderWidth: 1,
|
|
117
133
|
borderColor:
|
|
118
|
-
theme.colorScheme === 'dark'
|
|
134
|
+
theme.colorScheme === 'dark'
|
|
135
|
+
? (theme.colors.dark || [])[4]
|
|
136
|
+
: (theme.colors.gray || [])[4],
|
|
119
137
|
};
|
|
120
138
|
}
|
|
121
139
|
};
|
|
@@ -132,7 +150,10 @@ const useStyles = createStyles(
|
|
|
132
150
|
},
|
|
133
151
|
description: {
|
|
134
152
|
fontSize: theme.fontSizes.xs as number,
|
|
135
|
-
color:
|
|
153
|
+
color:
|
|
154
|
+
theme.colorScheme === 'dark'
|
|
155
|
+
? (theme.colors.dark || [])[2]
|
|
156
|
+
: (theme.colors.gray || [])[6],
|
|
136
157
|
marginTop: theme.spacing.xs,
|
|
137
158
|
},
|
|
138
159
|
error: {
|
|
@@ -166,6 +187,7 @@ const useStyles = createStyles(
|
|
|
166
187
|
...(withIcon && {
|
|
167
188
|
paddingLeft: 0,
|
|
168
189
|
}),
|
|
190
|
+
fontFamily: theme.fontFamilyInput,
|
|
169
191
|
},
|
|
170
192
|
controls: {
|
|
171
193
|
flexDirection: 'row',
|
|
@@ -178,12 +200,17 @@ const useStyles = createStyles(
|
|
|
178
200
|
alignItems: 'center',
|
|
179
201
|
borderLeftWidth: 1,
|
|
180
202
|
borderLeftColor:
|
|
181
|
-
theme.colorScheme === 'dark'
|
|
203
|
+
theme.colorScheme === 'dark'
|
|
204
|
+
? (theme.colors.dark || [])[4]
|
|
205
|
+
: (theme.colors.gray || [])[4],
|
|
182
206
|
},
|
|
183
207
|
controlText: {
|
|
184
208
|
fontSize: rem(18) as any,
|
|
185
209
|
fontWeight: '600',
|
|
186
|
-
color:
|
|
210
|
+
color:
|
|
211
|
+
theme.colorScheme === 'dark'
|
|
212
|
+
? (theme.colors.dark || [])[0]
|
|
213
|
+
: (theme.colors.gray || [])[7],
|
|
187
214
|
},
|
|
188
215
|
};
|
|
189
216
|
}
|
|
@@ -226,9 +253,12 @@ export const NumberInput = forwardRef<any, NumberInputProps>((props, ref) => {
|
|
|
226
253
|
} = useComponentDefaultProps('NumberInput', defaultProps, props);
|
|
227
254
|
|
|
228
255
|
const theme = useTheme();
|
|
229
|
-
const [uncontrolledValue, setUncontrolledValue] = useState<number | ''>(
|
|
256
|
+
const [uncontrolledValue, setUncontrolledValue] = useState<number | ''>(
|
|
257
|
+
defaultValue ?? ''
|
|
258
|
+
);
|
|
230
259
|
|
|
231
|
-
const value =
|
|
260
|
+
const value =
|
|
261
|
+
controlledValue !== undefined ? controlledValue : uncontrolledValue;
|
|
232
262
|
|
|
233
263
|
const { styles, sx } = useStyles(
|
|
234
264
|
{
|
|
@@ -297,7 +327,9 @@ export const NumberInput = forwardRef<any, NumberInputProps>((props, ref) => {
|
|
|
297
327
|
return (
|
|
298
328
|
<BoxView style={sx(styles.wrapper, wrapperStyle)}>
|
|
299
329
|
{label && (
|
|
300
|
-
<Text style={styles.label}>
|
|
330
|
+
<Text style={styles.label}>
|
|
331
|
+
{typeof label === 'string' ? label : label}
|
|
332
|
+
</Text>
|
|
301
333
|
)}
|
|
302
334
|
|
|
303
335
|
<BoxView style={sx(styles.inputWrapper, style)}>
|
|
@@ -309,7 +341,9 @@ export const NumberInput = forwardRef<any, NumberInputProps>((props, ref) => {
|
|
|
309
341
|
onChangeText={handleChange}
|
|
310
342
|
placeholder={placeholder}
|
|
311
343
|
placeholderTextColor={
|
|
312
|
-
theme.colorScheme === 'dark'
|
|
344
|
+
theme.colorScheme === 'dark'
|
|
345
|
+
? (theme.colors.dark || [])[3]
|
|
346
|
+
: (theme.colors.gray || [])[5]
|
|
313
347
|
}
|
|
314
348
|
keyboardType="numeric"
|
|
315
349
|
editable={!disabled}
|
|
@@ -322,7 +356,10 @@ export const NumberInput = forwardRef<any, NumberInputProps>((props, ref) => {
|
|
|
322
356
|
<TouchableOpacity
|
|
323
357
|
style={styles.control}
|
|
324
358
|
onPress={handleDecrement}
|
|
325
|
-
disabled={
|
|
359
|
+
disabled={
|
|
360
|
+
disabled ||
|
|
361
|
+
(min !== undefined && typeof value === 'number' && value <= min)
|
|
362
|
+
}
|
|
326
363
|
activeOpacity={0.7}
|
|
327
364
|
>
|
|
328
365
|
<Text style={styles.controlText}>−</Text>
|
|
@@ -331,7 +368,10 @@ export const NumberInput = forwardRef<any, NumberInputProps>((props, ref) => {
|
|
|
331
368
|
<TouchableOpacity
|
|
332
369
|
style={styles.control}
|
|
333
370
|
onPress={handleIncrement}
|
|
334
|
-
disabled={
|
|
371
|
+
disabled={
|
|
372
|
+
disabled ||
|
|
373
|
+
(max !== undefined && typeof value === 'number' && value >= max)
|
|
374
|
+
}
|
|
335
375
|
activeOpacity={0.7}
|
|
336
376
|
>
|
|
337
377
|
<Text style={styles.controlText}>+</Text>
|
|
@@ -347,7 +387,9 @@ export const NumberInput = forwardRef<any, NumberInputProps>((props, ref) => {
|
|
|
347
387
|
)}
|
|
348
388
|
|
|
349
389
|
{error && (
|
|
350
|
-
<Text style={styles.error}>
|
|
390
|
+
<Text style={styles.error}>
|
|
391
|
+
{typeof error === 'string' ? error : error}
|
|
392
|
+
</Text>
|
|
351
393
|
)}
|
|
352
394
|
</BoxView>
|
|
353
395
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, useState } from 'react';
|
|
2
2
|
import { TextInput as RNTextInput, Pressable } from 'react-native';
|
|
3
3
|
import { TextInput, type TextInputProps } from '../TextInput';
|
|
4
|
-
import {
|
|
4
|
+
import { Icon } from '../Icon';
|
|
5
5
|
|
|
6
6
|
export interface PasswordInputProps extends Omit<TextInputProps, 'rightSection' | 'type'> {
|
|
7
7
|
/** Toggle button aria-label */
|
|
@@ -22,7 +22,7 @@ const defaultProps: Partial<PasswordInputProps> = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const DefaultEyeIcon = ({ visible }: { visible: boolean }) => (
|
|
25
|
-
<
|
|
25
|
+
<Icon name={visible ? 'eye' : 'eye-slash'} size={16} useThemeColor />
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
export const PasswordInput = forwardRef<RNTextInput, PasswordInputProps>((props, ref) => {
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { forwardRef, useRef, useState } from 'react';
|
|
2
2
|
import { TextInput } from 'react-native';
|
|
3
3
|
import { BoxView } from '../BoxView';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
DefaultProps,
|
|
6
|
+
MantineNumberSize,
|
|
7
|
+
MantineSize,
|
|
8
|
+
} from '../../theme/types';
|
|
5
9
|
import { useComponentDefaultProps } from '../../theme/theme-provider';
|
|
6
10
|
import { createStyles, getSize } from '../../theme';
|
|
7
11
|
import { rem } from '../../theme/utils/rem';
|
|
8
12
|
|
|
9
|
-
|
|
10
13
|
export interface PinInputProps extends DefaultProps {
|
|
11
14
|
/** Number of inputs */
|
|
12
15
|
length?: number;
|
|
@@ -94,18 +97,23 @@ const useStyles = createStyles(
|
|
|
94
97
|
borderColor: error
|
|
95
98
|
? (theme.colors.red || [])[6]
|
|
96
99
|
: theme.colorScheme === 'dark'
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
backgroundColor:
|
|
100
|
+
? (theme.colors.dark || [])[4]
|
|
101
|
+
: (theme.colors.gray || [])[4],
|
|
102
|
+
backgroundColor:
|
|
103
|
+
theme.colorScheme === 'dark'
|
|
104
|
+
? (theme.colors.dark || [])[6]
|
|
105
|
+
: theme.white,
|
|
100
106
|
fontSize: getSize({ size, sizes: theme.fontSizes }) as any,
|
|
101
107
|
textAlign: 'center',
|
|
102
108
|
color: theme.colorScheme === 'dark' ? theme.white : theme.black,
|
|
103
109
|
...(disabled && {
|
|
104
110
|
opacity: 0.6,
|
|
105
111
|
}),
|
|
112
|
+
fontFamily: theme.fontFamilyInput,
|
|
106
113
|
},
|
|
107
114
|
inputFocused: {
|
|
108
|
-
borderColor:
|
|
115
|
+
borderColor:
|
|
116
|
+
theme.colors[theme.primaryColor]?.[6] || theme.primaryBgColor,
|
|
109
117
|
borderWidth: 2,
|
|
110
118
|
},
|
|
111
119
|
};
|
|
@@ -142,10 +150,13 @@ export const PinInput = forwardRef<any, PinInputProps>((props, ref) => {
|
|
|
142
150
|
...others
|
|
143
151
|
} = useComponentDefaultProps('PinInput', defaultProps, props);
|
|
144
152
|
|
|
145
|
-
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
153
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
154
|
+
defaultValue || ''
|
|
155
|
+
);
|
|
146
156
|
const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
|
|
147
157
|
|
|
148
|
-
const value =
|
|
158
|
+
const value =
|
|
159
|
+
controlledValue !== undefined ? controlledValue : uncontrolledValue;
|
|
149
160
|
const inputRefs = useRef<(TextInput | null)[]>([]);
|
|
150
161
|
|
|
151
162
|
const { styles, sx } = useStyles(
|
|
@@ -226,7 +237,11 @@ export const PinInput = forwardRef<any, PinInputProps>((props, ref) => {
|
|
|
226
237
|
return (
|
|
227
238
|
<TextInput
|
|
228
239
|
key={index}
|
|
229
|
-
ref={(el) =>
|
|
240
|
+
ref={(el) => {
|
|
241
|
+
if (inputRefs.current) {
|
|
242
|
+
inputRefs.current[index] = el;
|
|
243
|
+
}
|
|
244
|
+
}}
|
|
230
245
|
value={mask && displayValue ? '•' : displayValue}
|
|
231
246
|
onChangeText={(text) => handleChange(text, index)}
|
|
232
247
|
onKeyPress={(e) => handleKeyPress(e, index)}
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
View,
|
|
4
4
|
TouchableWithoutFeedback,
|
|
5
5
|
Animated,
|
|
6
|
+
Modal,
|
|
6
7
|
} from 'react-native';
|
|
7
8
|
import { BoxView } from '../BoxView';
|
|
8
|
-
import { Portal } from '../Portal';
|
|
9
9
|
import type {
|
|
10
10
|
DefaultProps,
|
|
11
11
|
|
|
@@ -92,7 +92,7 @@ const defaultProps: Partial<PopoverProps> = {
|
|
|
92
92
|
interface PopoverContextValue {
|
|
93
93
|
opened: boolean;
|
|
94
94
|
setOpened: (opened: boolean) => void;
|
|
95
|
-
targetRef: React.RefObject<View>;
|
|
95
|
+
targetRef: React.RefObject<View | null>;
|
|
96
96
|
dropdownPosition: { top: number; left: number; width: number };
|
|
97
97
|
setDropdownPosition: (pos: { top: number; left: number; width: number }) => void;
|
|
98
98
|
}
|
|
@@ -123,7 +123,7 @@ const PopoverTarget: React.FC<PopoverTargetProps> = ({ children }) => {
|
|
|
123
123
|
setOpened(true);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
return React.cloneElement(children
|
|
126
|
+
return React.cloneElement(children as React.ReactElement<any>, {
|
|
127
127
|
ref: targetRef,
|
|
128
128
|
onPress: handlePress,
|
|
129
129
|
});
|
|
@@ -148,15 +148,18 @@ const PopoverDropdown: React.FC<PopoverDropdownProps> = ({ children, style, ...o
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
return (
|
|
151
|
-
<
|
|
151
|
+
<Modal
|
|
152
|
+
visible={opened}
|
|
153
|
+
transparent
|
|
154
|
+
animationType="none"
|
|
155
|
+
onRequestClose={() => setOpened(false)}
|
|
156
|
+
statusBarTranslucent
|
|
157
|
+
>
|
|
152
158
|
<TouchableWithoutFeedback onPress={() => setOpened(false)}>
|
|
153
159
|
<View
|
|
154
160
|
style={{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
left: 0,
|
|
158
|
-
right: 0,
|
|
159
|
-
bottom: 0,
|
|
161
|
+
flex: 1,
|
|
162
|
+
backgroundColor: 'transparent',
|
|
160
163
|
}}
|
|
161
164
|
>
|
|
162
165
|
<Animated.View
|
|
@@ -175,7 +178,7 @@ const PopoverDropdown: React.FC<PopoverDropdownProps> = ({ children, style, ...o
|
|
|
175
178
|
</Animated.View>
|
|
176
179
|
</View>
|
|
177
180
|
</TouchableWithoutFeedback>
|
|
178
|
-
</
|
|
181
|
+
</Modal>
|
|
179
182
|
);
|
|
180
183
|
};
|
|
181
184
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
1
|
+
import React, { forwardRef, useEffect, useRef } from 'react';
|
|
2
|
+
import { View, Animated } from 'react-native';
|
|
3
3
|
import { BoxView } from '../BoxView';
|
|
4
4
|
import { Text } from '../Text';
|
|
5
5
|
import type { DefaultProps, MantineColor } from '../../theme/types';
|
|
@@ -119,13 +119,41 @@ export const RingProgress = forwardRef<any, RingProgressProps>((props, ref) => {
|
|
|
119
119
|
{ name: 'RingProgress' }
|
|
120
120
|
) as any;
|
|
121
121
|
|
|
122
|
+
// Animation values for each section
|
|
123
|
+
const animatedValues = useRef(
|
|
124
|
+
sections.map(() => new Animated.Value(0))
|
|
125
|
+
).current;
|
|
126
|
+
|
|
127
|
+
// Update animation values when sections change
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
// Ensure we have the right number of animated values
|
|
130
|
+
while (animatedValues.length < sections.length) {
|
|
131
|
+
animatedValues.push(new Animated.Value(0));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Animate each section
|
|
135
|
+
const animations = sections.map((section, index) => {
|
|
136
|
+
const animValue = animatedValues[index];
|
|
137
|
+
if (!animValue) return Animated.timing(new Animated.Value(0), { toValue: 0, duration: 0, useNativeDriver: false });
|
|
138
|
+
|
|
139
|
+
return Animated.timing(animValue, {
|
|
140
|
+
toValue: section.value,
|
|
141
|
+
duration: 1000,
|
|
142
|
+
useNativeDriver: false,
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
Animated.parallel(animations).start();
|
|
147
|
+
}, [sections, animatedValues]);
|
|
148
|
+
|
|
122
149
|
// Calculate total value and normalize sections
|
|
123
|
-
const normalizedSections = sections.map((section) => ({
|
|
150
|
+
const normalizedSections = sections.map((section, index) => ({
|
|
124
151
|
...section,
|
|
125
152
|
percentage: (section.value / 100) * 100,
|
|
153
|
+
animatedValue: animatedValues[index] || new Animated.Value(0),
|
|
126
154
|
}));
|
|
127
155
|
|
|
128
|
-
// Render
|
|
156
|
+
// Render animated ring using borders and transforms
|
|
129
157
|
// Note: This is a basic implementation. For full SVG support, use react-native-svg
|
|
130
158
|
const renderSections = () => {
|
|
131
159
|
let currentAngle = 0;
|
|
@@ -139,10 +167,21 @@ export const RingProgress = forwardRef<any, RingProgressProps>((props, ref) => {
|
|
|
139
167
|
const rotation = currentAngle;
|
|
140
168
|
currentAngle += angle;
|
|
141
169
|
|
|
142
|
-
//
|
|
143
|
-
|
|
170
|
+
// Animate the opacity for a smooth appearance
|
|
171
|
+
const animatedOpacity = section.animatedValue.interpolate({
|
|
172
|
+
inputRange: [0, section.value],
|
|
173
|
+
outputRange: [0, 1],
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Animated scale for smooth growth effect
|
|
177
|
+
const animatedScale = section.animatedValue.interpolate({
|
|
178
|
+
inputRange: [0, section.value],
|
|
179
|
+
outputRange: [0.8, 1],
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Simplified representation - just show colored arcs with animation
|
|
144
183
|
return (
|
|
145
|
-
<View
|
|
184
|
+
<Animated.View
|
|
146
185
|
key={index}
|
|
147
186
|
style={{
|
|
148
187
|
position: 'absolute',
|
|
@@ -152,7 +191,11 @@ export const RingProgress = forwardRef<any, RingProgressProps>((props, ref) => {
|
|
|
152
191
|
borderWidth: thickness,
|
|
153
192
|
borderColor: 'transparent',
|
|
154
193
|
borderTopColor: sectionColor,
|
|
155
|
-
transform: [
|
|
194
|
+
transform: [
|
|
195
|
+
{ rotate: `${rotation}deg` },
|
|
196
|
+
{ scale: animatedScale },
|
|
197
|
+
],
|
|
198
|
+
opacity: animatedOpacity,
|
|
156
199
|
}}
|
|
157
200
|
/>
|
|
158
201
|
);
|
|
@@ -85,19 +85,20 @@ const useStyles = createStyles(
|
|
|
85
85
|
flexDirection: orientation === 'horizontal' ? 'row' : 'column',
|
|
86
86
|
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark?.[6] : theme.colors.gray?.[1],
|
|
87
87
|
borderRadius: theme.fn.radius(radius),
|
|
88
|
-
padding: rem(
|
|
88
|
+
padding: rem(3) as any,
|
|
89
89
|
opacity: disabled ? 0.5 : 1,
|
|
90
90
|
...(fullWidth && { width: '100%' }),
|
|
91
91
|
},
|
|
92
92
|
indicator: {
|
|
93
93
|
position: 'absolute',
|
|
94
94
|
backgroundColor: theme.white,
|
|
95
|
-
borderRadius: theme.fn.radius(radius),
|
|
95
|
+
borderRadius: (theme.fn.radius(radius) as number) - rem(1),
|
|
96
96
|
shadowColor: '#000',
|
|
97
97
|
shadowOffset: { width: 0, height: 1 },
|
|
98
98
|
shadowOpacity: 0.05,
|
|
99
99
|
shadowRadius: 1,
|
|
100
100
|
elevation: 1,
|
|
101
|
+
margin: rem(3) as any,
|
|
101
102
|
...(theme.colorScheme === 'dark' && {
|
|
102
103
|
backgroundColor: theme.colors.dark?.[5],
|
|
103
104
|
}),
|
|
@@ -105,11 +106,11 @@ const useStyles = createStyles(
|
|
|
105
106
|
segment: {
|
|
106
107
|
flex: 1,
|
|
107
108
|
paddingHorizontal: sizeStyles.padding as any,
|
|
108
|
-
paddingVertical:
|
|
109
|
+
paddingVertical: rem(6) as any,
|
|
109
110
|
minHeight: sizeStyles.height as any,
|
|
110
111
|
justifyContent: 'center',
|
|
111
112
|
alignItems: 'center',
|
|
112
|
-
borderRadius: theme.fn.radius(radius),
|
|
113
|
+
borderRadius: (theme.fn.radius(radius) as number) - rem(1),
|
|
113
114
|
zIndex: 1,
|
|
114
115
|
},
|
|
115
116
|
label: {
|
|
@@ -181,6 +182,7 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>((props, r
|
|
|
181
182
|
useEffect(() => {
|
|
182
183
|
if (segmentLayouts[activeIndex]) {
|
|
183
184
|
const layout = segmentLayouts[activeIndex];
|
|
185
|
+
// No need to adjust for margin since indicator has its own margin
|
|
184
186
|
|
|
185
187
|
Animated.parallel([
|
|
186
188
|
Animated.timing(indicatorPosition, {
|