@oxyhq/bloom 0.1.32 → 0.1.34
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 +108 -7
- package/lib/commonjs/admonition/index.js +7 -0
- package/lib/commonjs/admonition/index.js.map +1 -1
- package/lib/commonjs/avatar/Avatar.js +2 -18
- package/lib/commonjs/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/bottom-sheet/index.js +16 -6
- package/lib/commonjs/bottom-sheet/index.js.map +1 -1
- package/lib/commonjs/button/Button.js +6 -18
- package/lib/commonjs/button/Button.js.map +1 -1
- package/lib/commonjs/chip/Chip.js +6 -16
- package/lib/commonjs/chip/Chip.js.map +1 -1
- package/lib/commonjs/collapsible/Collapsible.js +28 -20
- package/lib/commonjs/collapsible/Collapsible.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +2 -6
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/fill/index.js +7 -5
- package/lib/commonjs/fill/index.js.map +1 -1
- package/lib/commonjs/grid/index.js +9 -6
- package/lib/commonjs/grid/index.js.map +1 -1
- package/lib/commonjs/grouped-buttons/GroupedButtons.js +76 -48
- package/lib/commonjs/grouped-buttons/GroupedButtons.js.map +1 -1
- package/lib/commonjs/hooks/index.js +13 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useInteractionState.js +42 -0
- package/lib/commonjs/hooks/useInteractionState.js.map +1 -1
- package/lib/commonjs/hooks/usePressAnimation.js +44 -0
- package/lib/commonjs/hooks/usePressAnimation.js.map +1 -0
- package/lib/commonjs/icon-circle/index.js +7 -5
- package/lib/commonjs/icon-circle/index.js.map +1 -1
- package/lib/commonjs/icons/{EnveopeOpen.js → EnvelopeOpen.js} +1 -1
- package/lib/commonjs/icons/EnvelopeOpen.js.map +1 -0
- package/lib/commonjs/icons/TEMPLATE.js +3 -2
- package/lib/commonjs/icons/TEMPLATE.js.map +1 -1
- package/lib/commonjs/icons/VerifiedCheck.js +3 -2
- package/lib/commonjs/icons/VerifiedCheck.js.map +1 -1
- package/lib/commonjs/icons/VerifierCheck.js +3 -2
- package/lib/commonjs/icons/VerifierCheck.js.map +1 -1
- package/lib/commonjs/icons/index.js +4 -4
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/loading/Loading.js +2 -17
- package/lib/commonjs/loading/Loading.js.map +1 -1
- package/lib/commonjs/loading/SpinnerIcon.js +3 -34
- package/lib/commonjs/loading/SpinnerIcon.js.map +1 -1
- package/lib/commonjs/prompt-input/Actions.js +1 -0
- package/lib/commonjs/prompt-input/Actions.js.map +1 -1
- package/lib/commonjs/prompt-input/Attachments.js +1 -0
- package/lib/commonjs/prompt-input/Attachments.js.map +1 -1
- package/lib/commonjs/prompt-input/PromptInput.js +1 -0
- package/lib/commonjs/prompt-input/PromptInput.js.map +1 -1
- package/lib/commonjs/prompt-input/SubmitButton.js +1 -0
- package/lib/commonjs/prompt-input/SubmitButton.js.map +1 -1
- package/lib/commonjs/prompt-input/Textarea.js +1 -0
- package/lib/commonjs/prompt-input/Textarea.js.map +1 -1
- package/lib/commonjs/prompt-input/Textarea.web.js +1 -0
- package/lib/commonjs/prompt-input/Textarea.web.js.map +1 -1
- package/lib/commonjs/search-input/index.js +1 -0
- package/lib/commonjs/search-input/index.js.map +1 -1
- package/lib/commonjs/settings-list/SettingsList.js +10 -11
- package/lib/commonjs/settings-list/SettingsList.js.map +1 -1
- package/lib/commonjs/skeleton/index.js +5 -0
- package/lib/commonjs/skeleton/index.js.map +1 -1
- package/lib/commonjs/switch/Switch.js +43 -28
- package/lib/commonjs/switch/Switch.js.map +1 -1
- package/lib/commonjs/tabs/Tabs.js +6 -15
- package/lib/commonjs/tabs/Tabs.js.map +1 -1
- package/lib/commonjs/typography/index.js +14 -5
- package/lib/commonjs/typography/index.js.map +1 -1
- package/lib/commonjs/utils/lazy-require.js +37 -0
- package/lib/commonjs/utils/lazy-require.js.map +1 -0
- package/lib/module/admonition/index.js +7 -0
- package/lib/module/admonition/index.js.map +1 -1
- package/lib/module/avatar/Avatar.js +2 -18
- package/lib/module/avatar/Avatar.js.map +1 -1
- package/lib/module/bottom-sheet/index.js +16 -6
- package/lib/module/bottom-sheet/index.js.map +1 -1
- package/lib/module/button/Button.js +7 -19
- package/lib/module/button/Button.js.map +1 -1
- package/lib/module/chip/Chip.js +7 -17
- package/lib/module/chip/Chip.js.map +1 -1
- package/lib/module/collapsible/Collapsible.js +30 -22
- package/lib/module/collapsible/Collapsible.js.map +1 -1
- package/lib/module/dialog/Dialog.js +2 -6
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/fill/index.js +5 -3
- package/lib/module/fill/index.js.map +1 -1
- package/lib/module/grid/index.js +9 -5
- package/lib/module/grid/index.js.map +1 -1
- package/lib/module/grouped-buttons/GroupedButtons.js +77 -48
- package/lib/module/grouped-buttons/GroupedButtons.js.map +1 -1
- package/lib/module/hooks/index.js +2 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useInteractionState.js +41 -0
- package/lib/module/hooks/useInteractionState.js.map +1 -1
- package/lib/module/hooks/usePressAnimation.js +41 -0
- package/lib/module/hooks/usePressAnimation.js.map +1 -0
- package/lib/module/icon-circle/index.js +5 -3
- package/lib/module/icon-circle/index.js.map +1 -1
- package/lib/module/icons/{EnveopeOpen.js → EnvelopeOpen.js} +1 -1
- package/lib/module/icons/EnvelopeOpen.js.map +1 -0
- package/lib/module/icons/TEMPLATE.js +3 -2
- package/lib/module/icons/TEMPLATE.js.map +1 -1
- package/lib/module/icons/VerifiedCheck.js +3 -2
- package/lib/module/icons/VerifiedCheck.js.map +1 -1
- package/lib/module/icons/VerifierCheck.js +3 -2
- package/lib/module/icons/VerifierCheck.js.map +1 -1
- package/lib/module/icons/index.js +1 -1
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/loading/Loading.js +2 -17
- package/lib/module/loading/Loading.js.map +1 -1
- package/lib/module/loading/SpinnerIcon.js +3 -34
- package/lib/module/loading/SpinnerIcon.js.map +1 -1
- package/lib/module/prompt-input/Actions.js +1 -0
- package/lib/module/prompt-input/Actions.js.map +1 -1
- package/lib/module/prompt-input/Attachments.js +1 -0
- package/lib/module/prompt-input/Attachments.js.map +1 -1
- package/lib/module/prompt-input/PromptInput.js +1 -0
- package/lib/module/prompt-input/PromptInput.js.map +1 -1
- package/lib/module/prompt-input/SubmitButton.js +1 -0
- package/lib/module/prompt-input/SubmitButton.js.map +1 -1
- package/lib/module/prompt-input/Textarea.js +1 -0
- package/lib/module/prompt-input/Textarea.js.map +1 -1
- package/lib/module/prompt-input/Textarea.web.js +1 -0
- package/lib/module/prompt-input/Textarea.web.js.map +1 -1
- package/lib/module/search-input/index.js +1 -0
- package/lib/module/search-input/index.js.map +1 -1
- package/lib/module/settings-list/SettingsList.js +10 -11
- package/lib/module/settings-list/SettingsList.js.map +1 -1
- package/lib/module/skeleton/index.js +5 -0
- package/lib/module/skeleton/index.js.map +1 -1
- package/lib/module/switch/Switch.js +45 -30
- package/lib/module/switch/Switch.js.map +1 -1
- package/lib/module/tabs/Tabs.js +8 -17
- package/lib/module/tabs/Tabs.js.map +1 -1
- package/lib/module/typography/index.js +12 -3
- package/lib/module/typography/index.js.map +1 -1
- package/lib/module/utils/lazy-require.js +33 -0
- package/lib/module/utils/lazy-require.js.map +1 -0
- package/lib/typescript/commonjs/admonition/index.d.ts +21 -0
- package/lib/typescript/commonjs/admonition/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/button/Button.d.ts.map +1 -1
- package/lib/typescript/commonjs/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/commonjs/collapsible/Collapsible.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/fill/index.d.ts +2 -2
- package/lib/typescript/commonjs/fill/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/grid/index.d.ts +4 -4
- package/lib/typescript/commonjs/grid/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/grouped-buttons/GroupedButtons.d.ts +9 -5
- package/lib/typescript/commonjs/grouped-buttons/GroupedButtons.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/index.d.ts +2 -1
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/useInteractionState.d.ts +23 -0
- package/lib/typescript/commonjs/hooks/useInteractionState.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/usePressAnimation.d.ts +16 -0
- package/lib/typescript/commonjs/hooks/usePressAnimation.d.ts.map +1 -0
- package/lib/typescript/commonjs/icon-circle/index.d.ts +4 -4
- package/lib/typescript/commonjs/icon-circle/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/{EnveopeOpen.d.ts → EnvelopeOpen.d.ts} +1 -1
- package/lib/typescript/commonjs/icons/EnvelopeOpen.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/TEMPLATE.d.ts +2 -1
- package/lib/typescript/commonjs/icons/TEMPLATE.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/VerifiedCheck.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/VerifierCheck.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/index.d.ts +1 -1
- package/lib/typescript/commonjs/icons/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/Loading.d.ts.map +1 -1
- package/lib/typescript/commonjs/loading/SpinnerIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompt-input/Actions.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Actions.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompt-input/Attachments.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Attachments.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompt-input/PromptInput.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/PromptInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompt-input/SubmitButton.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/SubmitButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompt-input/Textarea.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Textarea.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompt-input/Textarea.web.d.ts +3 -0
- package/lib/typescript/commonjs/prompt-input/Textarea.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/settings-list/SettingsList.d.ts.map +1 -1
- package/lib/typescript/commonjs/skeleton/index.d.ts +15 -0
- package/lib/typescript/commonjs/skeleton/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/switch/Switch.d.ts.map +1 -1
- package/lib/typescript/commonjs/tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/commonjs/typography/index.d.ts +11 -10
- package/lib/typescript/commonjs/typography/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/lazy-require.d.ts +15 -0
- package/lib/typescript/commonjs/utils/lazy-require.d.ts.map +1 -0
- package/lib/typescript/module/admonition/index.d.ts +21 -0
- package/lib/typescript/module/admonition/index.d.ts.map +1 -1
- package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/module/button/Button.d.ts.map +1 -1
- package/lib/typescript/module/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/module/collapsible/Collapsible.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/fill/index.d.ts +2 -2
- package/lib/typescript/module/fill/index.d.ts.map +1 -1
- package/lib/typescript/module/grid/index.d.ts +4 -4
- package/lib/typescript/module/grid/index.d.ts.map +1 -1
- package/lib/typescript/module/grouped-buttons/GroupedButtons.d.ts +9 -5
- package/lib/typescript/module/grouped-buttons/GroupedButtons.d.ts.map +1 -1
- package/lib/typescript/module/hooks/index.d.ts +2 -1
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/useInteractionState.d.ts +23 -0
- package/lib/typescript/module/hooks/useInteractionState.d.ts.map +1 -1
- package/lib/typescript/module/hooks/usePressAnimation.d.ts +16 -0
- package/lib/typescript/module/hooks/usePressAnimation.d.ts.map +1 -0
- package/lib/typescript/module/icon-circle/index.d.ts +4 -4
- package/lib/typescript/module/icon-circle/index.d.ts.map +1 -1
- package/lib/typescript/module/icons/{EnveopeOpen.d.ts → EnvelopeOpen.d.ts} +1 -1
- package/lib/typescript/module/icons/EnvelopeOpen.d.ts.map +1 -0
- package/lib/typescript/module/icons/TEMPLATE.d.ts +2 -1
- package/lib/typescript/module/icons/TEMPLATE.d.ts.map +1 -1
- package/lib/typescript/module/icons/VerifiedCheck.d.ts.map +1 -1
- package/lib/typescript/module/icons/VerifierCheck.d.ts.map +1 -1
- package/lib/typescript/module/icons/index.d.ts +1 -1
- package/lib/typescript/module/icons/index.d.ts.map +1 -1
- package/lib/typescript/module/loading/Loading.d.ts.map +1 -1
- package/lib/typescript/module/loading/SpinnerIcon.d.ts.map +1 -1
- package/lib/typescript/module/prompt-input/Actions.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Actions.d.ts.map +1 -1
- package/lib/typescript/module/prompt-input/Attachments.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Attachments.d.ts.map +1 -1
- package/lib/typescript/module/prompt-input/PromptInput.d.ts +3 -0
- package/lib/typescript/module/prompt-input/PromptInput.d.ts.map +1 -1
- package/lib/typescript/module/prompt-input/SubmitButton.d.ts +3 -0
- package/lib/typescript/module/prompt-input/SubmitButton.d.ts.map +1 -1
- package/lib/typescript/module/prompt-input/Textarea.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Textarea.d.ts.map +1 -1
- package/lib/typescript/module/prompt-input/Textarea.web.d.ts +3 -0
- package/lib/typescript/module/prompt-input/Textarea.web.d.ts.map +1 -1
- package/lib/typescript/module/settings-list/SettingsList.d.ts.map +1 -1
- package/lib/typescript/module/skeleton/index.d.ts +15 -0
- package/lib/typescript/module/skeleton/index.d.ts.map +1 -1
- package/lib/typescript/module/switch/Switch.d.ts.map +1 -1
- package/lib/typescript/module/tabs/Tabs.d.ts.map +1 -1
- package/lib/typescript/module/typography/index.d.ts +11 -10
- package/lib/typescript/module/typography/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/lazy-require.d.ts +15 -0
- package/lib/typescript/module/utils/lazy-require.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/BloomThemeProvider.test.tsx +3 -3
- package/src/admonition/index.tsx +7 -0
- package/src/avatar/Avatar.tsx +2 -19
- package/src/bottom-sheet/index.tsx +18 -6
- package/src/button/Button.tsx +6 -22
- package/src/chip/Chip.tsx +3 -19
- package/src/collapsible/Collapsible.tsx +34 -25
- package/src/dialog/Dialog.tsx +3 -6
- package/src/fill/index.tsx +6 -3
- package/src/grid/index.tsx +11 -5
- package/src/grouped-buttons/GroupedButtons.tsx +79 -60
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useInteractionState.ts +21 -0
- package/src/hooks/usePressAnimation.ts +37 -0
- package/src/icon-circle/index.tsx +6 -3
- package/src/icons/TEMPLATE.tsx +2 -2
- package/src/icons/VerifiedCheck.tsx +3 -2
- package/src/icons/VerifierCheck.tsx +3 -2
- package/src/icons/index.ts +1 -1
- package/src/loading/Loading.tsx +2 -18
- package/src/loading/SpinnerIcon.tsx +4 -36
- package/src/prompt-input/Actions.tsx +1 -0
- package/src/prompt-input/Attachments.tsx +1 -0
- package/src/prompt-input/PromptInput.tsx +1 -0
- package/src/prompt-input/SubmitButton.tsx +1 -0
- package/src/prompt-input/Textarea.tsx +1 -0
- package/src/prompt-input/Textarea.web.tsx +1 -0
- package/src/search-input/index.tsx +1 -0
- package/src/settings-list/SettingsList.tsx +12 -8
- package/src/skeleton/index.tsx +5 -0
- package/src/switch/Switch.tsx +45 -23
- package/src/tabs/Tabs.tsx +3 -21
- package/src/typography/index.tsx +14 -4
- package/src/utils/lazy-require.ts +31 -0
- package/lib/commonjs/icons/EnveopeOpen.js.map +0 -1
- package/lib/module/icons/EnveopeOpen.js.map +0 -1
- package/lib/typescript/commonjs/icons/EnveopeOpen.d.ts.map +0 -1
- package/lib/typescript/module/icons/EnveopeOpen.d.ts.map +0 -1
- /package/src/icons/{EnveopeOpen.tsx → EnvelopeOpen.tsx} +0 -0
|
@@ -1,45 +1,14 @@
|
|
|
1
|
-
import React, { Children } from 'react';
|
|
2
|
-
import { View, Text, TouchableOpacity } from 'react-native';
|
|
1
|
+
import React, { Children, memo } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
5
|
import type { GroupedButtonsProps, GroupedButtonItemProps } from './types';
|
|
6
6
|
|
|
7
7
|
export type { GroupedButtonsProps, GroupedButtonItemProps } from './types';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
const theme = useTheme();
|
|
11
|
-
const childArray = Children.toArray(children);
|
|
9
|
+
// ── Item (defined first so it can be attached to GroupedButtons) ─
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
<View
|
|
15
|
-
style={[
|
|
16
|
-
{
|
|
17
|
-
borderRadius: 12,
|
|
18
|
-
backgroundColor: theme.colors.card,
|
|
19
|
-
overflow: 'hidden',
|
|
20
|
-
},
|
|
21
|
-
style,
|
|
22
|
-
]}
|
|
23
|
-
>
|
|
24
|
-
{childArray.map((child, index) => (
|
|
25
|
-
<React.Fragment key={index}>
|
|
26
|
-
{child}
|
|
27
|
-
{index < childArray.length - 1 && (
|
|
28
|
-
<View
|
|
29
|
-
style={{
|
|
30
|
-
height: 1,
|
|
31
|
-
backgroundColor: theme.colors.borderLight,
|
|
32
|
-
marginLeft: 16,
|
|
33
|
-
}}
|
|
34
|
-
/>
|
|
35
|
-
)}
|
|
36
|
-
</React.Fragment>
|
|
37
|
-
))}
|
|
38
|
-
</View>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function Item({
|
|
11
|
+
function ItemComponent({
|
|
43
12
|
label,
|
|
44
13
|
description,
|
|
45
14
|
icon,
|
|
@@ -49,7 +18,6 @@ export function Item({
|
|
|
49
18
|
testID,
|
|
50
19
|
}: GroupedButtonItemProps) {
|
|
51
20
|
const theme = useTheme();
|
|
52
|
-
|
|
53
21
|
const labelColor = destructive ? theme.colors.negative : theme.colors.text;
|
|
54
22
|
|
|
55
23
|
return (
|
|
@@ -58,31 +26,13 @@ export function Item({
|
|
|
58
26
|
disabled={disabled}
|
|
59
27
|
activeOpacity={0.6}
|
|
60
28
|
testID={testID}
|
|
61
|
-
style={
|
|
62
|
-
flexDirection: 'row',
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
paddingVertical: 12,
|
|
65
|
-
paddingHorizontal: 16,
|
|
66
|
-
opacity: disabled ? 0.5 : 1,
|
|
67
|
-
}}
|
|
29
|
+
style={[styles.item, disabled && styles.disabled]}
|
|
68
30
|
>
|
|
69
|
-
{icon &&
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</View>
|
|
73
|
-
)}
|
|
74
|
-
<View style={{ flex: 1 }}>
|
|
75
|
-
<Text style={{ fontSize: 16, color: labelColor }}>
|
|
76
|
-
{label}
|
|
77
|
-
</Text>
|
|
31
|
+
{icon && <View style={styles.iconWrapper}>{icon}</View>}
|
|
32
|
+
<View style={styles.textWrapper}>
|
|
33
|
+
<Text style={[styles.label, { color: labelColor }]}>{label}</Text>
|
|
78
34
|
{description && (
|
|
79
|
-
<Text
|
|
80
|
-
style={{
|
|
81
|
-
fontSize: 13,
|
|
82
|
-
color: theme.colors.textSecondary,
|
|
83
|
-
marginTop: 2,
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
35
|
+
<Text style={[styles.description, { color: theme.colors.textSecondary }]}>
|
|
86
36
|
{description}
|
|
87
37
|
</Text>
|
|
88
38
|
)}
|
|
@@ -91,4 +41,73 @@ export function Item({
|
|
|
91
41
|
);
|
|
92
42
|
}
|
|
93
43
|
|
|
94
|
-
|
|
44
|
+
export const Item = memo(ItemComponent);
|
|
45
|
+
Item.displayName = 'GroupedButtons.Item';
|
|
46
|
+
|
|
47
|
+
// ── GroupedButtons ───────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
function GroupedButtonsComponent({ children, style }: GroupedButtonsProps) {
|
|
50
|
+
const theme = useTheme();
|
|
51
|
+
const childArray = Children.toArray(children);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View
|
|
55
|
+
style={[
|
|
56
|
+
styles.container,
|
|
57
|
+
{ backgroundColor: theme.colors.card },
|
|
58
|
+
style,
|
|
59
|
+
]}
|
|
60
|
+
>
|
|
61
|
+
{childArray.map((child, index) => (
|
|
62
|
+
<React.Fragment key={index}>
|
|
63
|
+
{child}
|
|
64
|
+
{index < childArray.length - 1 && (
|
|
65
|
+
<View
|
|
66
|
+
style={[styles.divider, { backgroundColor: theme.colors.borderLight }]}
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
</React.Fragment>
|
|
70
|
+
))}
|
|
71
|
+
</View>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const GroupedButtonsMemo = memo(GroupedButtonsComponent);
|
|
76
|
+
GroupedButtonsMemo.displayName = 'GroupedButtons';
|
|
77
|
+
|
|
78
|
+
export const GroupedButtons = Object.assign(GroupedButtonsMemo, { Item });
|
|
79
|
+
|
|
80
|
+
// ── Styles ──────────────────────────────────────────────────────
|
|
81
|
+
|
|
82
|
+
const styles = StyleSheet.create({
|
|
83
|
+
container: {
|
|
84
|
+
borderRadius: 12,
|
|
85
|
+
overflow: 'hidden',
|
|
86
|
+
},
|
|
87
|
+
divider: {
|
|
88
|
+
height: 1,
|
|
89
|
+
marginLeft: 16,
|
|
90
|
+
},
|
|
91
|
+
item: {
|
|
92
|
+
flexDirection: 'row',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
paddingVertical: 12,
|
|
95
|
+
paddingHorizontal: 16,
|
|
96
|
+
},
|
|
97
|
+
disabled: {
|
|
98
|
+
opacity: 0.5,
|
|
99
|
+
},
|
|
100
|
+
iconWrapper: {
|
|
101
|
+
marginRight: 12,
|
|
102
|
+
},
|
|
103
|
+
textWrapper: {
|
|
104
|
+
flex: 1,
|
|
105
|
+
},
|
|
106
|
+
label: {
|
|
107
|
+
fontSize: 16,
|
|
108
|
+
},
|
|
109
|
+
description: {
|
|
110
|
+
fontSize: 13,
|
|
111
|
+
marginTop: 2,
|
|
112
|
+
},
|
|
113
|
+
});
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { useInteractionState } from './useInteractionState';
|
|
1
|
+
export { useInteractionState, useInteractionStates } from './useInteractionState';
|
|
2
2
|
export { useDelayedLoading } from './useDelayedLoading';
|
|
3
3
|
export { useThrottledValue } from './useThrottledValue';
|
|
4
|
+
export { usePressAnimation } from './usePressAnimation';
|
|
4
5
|
export { mergeRefs } from './mergeRefs';
|
|
@@ -12,3 +12,24 @@ export function useInteractionState() {
|
|
|
12
12
|
|
|
13
13
|
return { state, onIn, onOut };
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Tracks multiple interaction states (hovered, focused, pressed) in one hook.
|
|
18
|
+
*
|
|
19
|
+
* Returns stable handler objects suitable for spreading onto Pressable-like components.
|
|
20
|
+
* On web, `hoverHandlers` can be spread as `onMouseEnter`/`onMouseLeave`.
|
|
21
|
+
*/
|
|
22
|
+
export function useInteractionStates() {
|
|
23
|
+
const { state: hovered, onIn: onHoverIn, onOut: onHoverOut } = useInteractionState();
|
|
24
|
+
const { state: focused, onIn: onFocus, onOut: onBlur } = useInteractionState();
|
|
25
|
+
const { state: pressed, onIn: onPressIn, onOut: onPressOut } = useInteractionState();
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
hovered,
|
|
29
|
+
focused,
|
|
30
|
+
pressed,
|
|
31
|
+
hoverHandlers: { onHoverIn, onHoverOut } as const,
|
|
32
|
+
focusHandlers: { onFocus, onBlur } as const,
|
|
33
|
+
pressHandlers: { onPressIn, onPressOut } as const,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { animation } from '../styles/tokens';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hook that provides press-scale animation feedback.
|
|
8
|
+
*
|
|
9
|
+
* Returns an `Animated.Value` for the scale transform and press-in/press-out
|
|
10
|
+
* handlers that spring the value between 1 and the target scale.
|
|
11
|
+
*
|
|
12
|
+
* @param pressScale - Scale value when pressed (e.g. 0.97). Pass `undefined` to disable.
|
|
13
|
+
*/
|
|
14
|
+
export function usePressAnimation(pressScale: number | undefined = 0.97) {
|
|
15
|
+
const scaleAnim = useRef(new Animated.Value(1)).current;
|
|
16
|
+
const enabled = pressScale !== undefined;
|
|
17
|
+
|
|
18
|
+
const onPressIn = useCallback(() => {
|
|
19
|
+
if (!enabled) return;
|
|
20
|
+
Animated.spring(scaleAnim, {
|
|
21
|
+
toValue: pressScale!,
|
|
22
|
+
useNativeDriver: true,
|
|
23
|
+
...animation.spring.snappy,
|
|
24
|
+
}).start();
|
|
25
|
+
}, [scaleAnim, enabled, pressScale]);
|
|
26
|
+
|
|
27
|
+
const onPressOut = useCallback(() => {
|
|
28
|
+
if (!enabled) return;
|
|
29
|
+
Animated.spring(scaleAnim, {
|
|
30
|
+
toValue: 1,
|
|
31
|
+
useNativeDriver: true,
|
|
32
|
+
...animation.spring.gentle,
|
|
33
|
+
}).start();
|
|
34
|
+
}, [scaleAnim, enabled]);
|
|
35
|
+
|
|
36
|
+
return { scaleAnim, onPressIn, onPressOut, enabled } as const;
|
|
37
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
2
|
import { View, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
5
|
import { type Props as IconProps } from '../icons/common';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const IconCircleComponent = function IconCircle({
|
|
8
8
|
icon: Icon,
|
|
9
9
|
size = 'xl',
|
|
10
10
|
style,
|
|
@@ -33,4 +33,7 @@ export function IconCircle({
|
|
|
33
33
|
<Icon size={size} style={[{ color: colors.primary }, iconStyle]} />
|
|
34
34
|
</View>
|
|
35
35
|
);
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const IconCircle = memo(IconCircleComponent);
|
|
39
|
+
IconCircle.displayName = 'IconCircle';
|
package/src/icons/TEMPLATE.tsx
CHANGED
|
@@ -46,7 +46,7 @@ export function createSinglePathSVG({
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export function createMultiPathSVG({ paths }: { paths: string[] }) {
|
|
49
|
+
export function createMultiPathSVG({ paths, viewBox }: { paths: string[]; viewBox?: string }) {
|
|
50
50
|
return forwardRef<Svg, Props>(function IconImpl(props, ref) {
|
|
51
51
|
const { fill, size, style, gradient, ...rest } = useCommonSVGProps(props);
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ export function createMultiPathSVG({ paths }: { paths: string[] }) {
|
|
|
55
55
|
fill="none"
|
|
56
56
|
{...rest}
|
|
57
57
|
ref={ref}
|
|
58
|
-
viewBox=
|
|
58
|
+
viewBox={viewBox || '0 0 24 24'}
|
|
59
59
|
width={size}
|
|
60
60
|
height={size}
|
|
61
61
|
style={[style]}>
|
|
@@ -4,8 +4,8 @@ import Svg, {Circle, Path} from 'react-native-svg'
|
|
|
4
4
|
import {type Props, useCommonSVGProps} from './common'
|
|
5
5
|
|
|
6
6
|
export const VerifiedCheck = forwardRef<Svg, Props>(
|
|
7
|
-
function
|
|
8
|
-
const {fill, size, style, ...rest} = useCommonSVGProps(props)
|
|
7
|
+
function VerifiedCheckImpl(props, ref) {
|
|
8
|
+
const {fill, size, style, gradient, ...rest} = useCommonSVGProps(props)
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Svg
|
|
@@ -16,6 +16,7 @@ export const VerifiedCheck = forwardRef<Svg, Props>(
|
|
|
16
16
|
width={size}
|
|
17
17
|
height={size}
|
|
18
18
|
style={[style]}>
|
|
19
|
+
{gradient}
|
|
19
20
|
<Circle cx="12" cy="12" r="11.5" fill={fill} />
|
|
20
21
|
<Path
|
|
21
22
|
fill="#fff"
|
|
@@ -4,8 +4,8 @@ import Svg, {Path} from 'react-native-svg'
|
|
|
4
4
|
import {type Props, useCommonSVGProps} from './common'
|
|
5
5
|
|
|
6
6
|
export const VerifierCheck = forwardRef<Svg, Props>(
|
|
7
|
-
function
|
|
8
|
-
const {fill, size, style, ...rest} = useCommonSVGProps(props)
|
|
7
|
+
function VerifierCheckImpl(props, ref) {
|
|
8
|
+
const {fill, size, style, gradient, ...rest} = useCommonSVGProps(props)
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Svg
|
|
@@ -16,6 +16,7 @@ export const VerifierCheck = forwardRef<Svg, Props>(
|
|
|
16
16
|
width={size}
|
|
17
17
|
height={size}
|
|
18
18
|
style={[style]}>
|
|
19
|
+
{gradient}
|
|
19
20
|
<Path
|
|
20
21
|
fill={fill}
|
|
21
22
|
fillRule="evenodd"
|
package/src/icons/index.ts
CHANGED
|
@@ -58,7 +58,7 @@ export * from './Download';
|
|
|
58
58
|
export * from './EditBig';
|
|
59
59
|
export * from './Emoji';
|
|
60
60
|
export * from './Envelope';
|
|
61
|
-
export * from './
|
|
61
|
+
export * from './EnvelopeOpen';
|
|
62
62
|
export * from './Explosion';
|
|
63
63
|
export * from './Eye';
|
|
64
64
|
export * from './EyeSlash';
|
package/src/loading/Loading.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { View, Text, StyleSheet, type DimensionValue } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
5
|
import { animation } from '../styles/tokens';
|
|
6
|
+
import { lazyRequire } from '../utils/lazy-require';
|
|
6
7
|
import { SpinnerIcon } from './SpinnerIcon';
|
|
7
8
|
import type {
|
|
8
9
|
LoadingProps,
|
|
@@ -20,24 +21,7 @@ const SIZE_CONFIG = {
|
|
|
20
21
|
|
|
21
22
|
// Lazy-loaded reanimated for the top variant
|
|
22
23
|
type ReanimatedType = typeof import('react-native-reanimated');
|
|
23
|
-
|
|
24
|
-
let reanimatedResolved = false;
|
|
25
|
-
|
|
26
|
-
function getReanimated(): ReanimatedType | null {
|
|
27
|
-
if (!reanimatedResolved) {
|
|
28
|
-
reanimatedResolved = true;
|
|
29
|
-
try {
|
|
30
|
-
// Guard for ESM environments (Vite/browser) where require is not defined.
|
|
31
|
-
if (typeof require !== 'undefined') {
|
|
32
|
-
const moduleName = 'react-native-reanimated';
|
|
33
|
-
reanimatedModule = require(moduleName);
|
|
34
|
-
}
|
|
35
|
-
} catch {
|
|
36
|
-
reanimatedModule = null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return reanimatedModule;
|
|
40
|
-
}
|
|
24
|
+
const getReanimated = lazyRequire<ReanimatedType>('react-native-reanimated');
|
|
41
25
|
|
|
42
26
|
const SpinnerLoading: React.FC<SpinnerLoadingProps> = ({
|
|
43
27
|
size = 'medium',
|
|
@@ -1,47 +1,15 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { ActivityIndicator, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { lazyRequire } from '../utils/lazy-require';
|
|
5
|
+
|
|
4
6
|
// Lazy-loaded dependencies for the SVG spinner.
|
|
5
7
|
// Falls back to ActivityIndicator if react-native-svg or react-native-reanimated are not installed.
|
|
6
8
|
type SvgModuleType = typeof import('react-native-svg');
|
|
7
9
|
type ReanimatedType = typeof import('react-native-reanimated');
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let reanimatedModule: ReanimatedType | null = null;
|
|
12
|
-
let reanimatedResolved = false;
|
|
13
|
-
|
|
14
|
-
function getSvgModule(): SvgModuleType | null {
|
|
15
|
-
if (!svgModuleResolved) {
|
|
16
|
-
svgModuleResolved = true;
|
|
17
|
-
try {
|
|
18
|
-
// Guard for ESM environments (Vite/browser) where require is not defined.
|
|
19
|
-
if (typeof require !== 'undefined') {
|
|
20
|
-
const moduleName = 'react-native-svg';
|
|
21
|
-
svgModule = require(moduleName);
|
|
22
|
-
}
|
|
23
|
-
} catch {
|
|
24
|
-
svgModule = null;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return svgModule;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function getReanimated(): ReanimatedType | null {
|
|
31
|
-
if (!reanimatedResolved) {
|
|
32
|
-
reanimatedResolved = true;
|
|
33
|
-
try {
|
|
34
|
-
// Guard for ESM environments (Vite/browser) where require is not defined.
|
|
35
|
-
if (typeof require !== 'undefined') {
|
|
36
|
-
const moduleName = 'react-native-reanimated';
|
|
37
|
-
reanimatedModule = require(moduleName);
|
|
38
|
-
}
|
|
39
|
-
} catch {
|
|
40
|
-
reanimatedModule = null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return reanimatedModule;
|
|
44
|
-
}
|
|
11
|
+
const getSvgModule = lazyRequire<SvgModuleType>('react-native-svg');
|
|
12
|
+
const getReanimated = lazyRequire<ReanimatedType>('react-native-reanimated');
|
|
45
13
|
|
|
46
14
|
interface SpinnerIconProps {
|
|
47
15
|
size?: number;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { View, Text, Pressable, StyleSheet } from 'react-native';
|
|
3
|
-
import Svg, { Path } from 'react-native-svg';
|
|
4
3
|
|
|
5
4
|
import { useTheme } from '../theme/use-theme';
|
|
6
5
|
import type {
|
|
@@ -9,14 +8,19 @@ import type {
|
|
|
9
8
|
SettingsListDividerProps,
|
|
10
9
|
} from './types';
|
|
11
10
|
|
|
12
|
-
// ── Chevron icon (
|
|
11
|
+
// ── Chevron icon (unicode-based, no SVG dependency) ─────────────
|
|
13
12
|
const Chevron = memo(({ size = 16, color }: { size?: number; color: string }) => (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
<Text
|
|
14
|
+
style={{
|
|
15
|
+
fontSize: size,
|
|
16
|
+
color,
|
|
17
|
+
lineHeight: size,
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
width: size,
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
{'\u203A'}
|
|
23
|
+
</Text>
|
|
20
24
|
));
|
|
21
25
|
Chevron.displayName = 'Chevron';
|
|
22
26
|
|
package/src/skeleton/index.tsx
CHANGED
|
@@ -65,6 +65,7 @@ export function Text({
|
|
|
65
65
|
</View>
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
|
+
Text.displayName = 'Skeleton.Text';
|
|
68
69
|
|
|
69
70
|
export function Circle({
|
|
70
71
|
children,
|
|
@@ -96,6 +97,7 @@ export function Circle({
|
|
|
96
97
|
</Animated.View>
|
|
97
98
|
);
|
|
98
99
|
}
|
|
100
|
+
Circle.displayName = 'Skeleton.Circle';
|
|
99
101
|
|
|
100
102
|
export function Pill({
|
|
101
103
|
size,
|
|
@@ -124,6 +126,7 @@ export function Pill({
|
|
|
124
126
|
/>
|
|
125
127
|
);
|
|
126
128
|
}
|
|
129
|
+
Pill.displayName = 'Skeleton.Pill';
|
|
127
130
|
|
|
128
131
|
export function Col({
|
|
129
132
|
children,
|
|
@@ -134,6 +137,7 @@ export function Col({
|
|
|
134
137
|
}) {
|
|
135
138
|
return <View style={[styles.col, style]}>{children}</View>;
|
|
136
139
|
}
|
|
140
|
+
Col.displayName = 'Skeleton.Col';
|
|
137
141
|
|
|
138
142
|
export function Row({
|
|
139
143
|
children,
|
|
@@ -144,6 +148,7 @@ export function Row({
|
|
|
144
148
|
}) {
|
|
145
149
|
return <View style={[styles.row, style]}>{children}</View>;
|
|
146
150
|
}
|
|
151
|
+
Row.displayName = 'Skeleton.Row';
|
|
147
152
|
|
|
148
153
|
const styles = StyleSheet.create({
|
|
149
154
|
textOuter: {
|
package/src/switch/Switch.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { memo,
|
|
2
|
-
import { Pressable, Animated } from 'react-native';
|
|
1
|
+
import React, { memo, useCallback, useRef } from 'react';
|
|
2
|
+
import { Pressable, Animated, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../theme/use-theme';
|
|
5
5
|
import { animation } from '../styles/tokens';
|
|
@@ -16,30 +16,39 @@ const SwitchComponent = React.forwardRef<React.ElementRef<typeof Pressable>, Swi
|
|
|
16
16
|
const anim = useRef(new Animated.Value(value ? 1 : 0)).current;
|
|
17
17
|
const pressAnim = useRef(new Animated.Value(0)).current;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// Track last value to detect external changes and animate accordingly.
|
|
20
|
+
// This avoids useEffect while still handling controlled value changes.
|
|
21
|
+
const prevValueRef = useRef(value);
|
|
22
|
+
if (prevValueRef.current !== value) {
|
|
23
|
+
prevValueRef.current = value;
|
|
20
24
|
Animated.spring(anim, {
|
|
21
25
|
toValue: value ? 1 : 0,
|
|
22
26
|
useNativeDriver: false,
|
|
23
27
|
...animation.spring.gentle,
|
|
24
28
|
}).start();
|
|
25
|
-
}
|
|
29
|
+
}
|
|
26
30
|
|
|
27
|
-
const
|
|
31
|
+
const handlePress = useCallback(() => {
|
|
32
|
+
if (disabled) return;
|
|
33
|
+
onValueChange(!value);
|
|
34
|
+
}, [disabled, value, onValueChange]);
|
|
35
|
+
|
|
36
|
+
const onPressIn = useCallback(() => {
|
|
28
37
|
if (disabled) return;
|
|
29
38
|
Animated.spring(pressAnim, {
|
|
30
39
|
toValue: 1,
|
|
31
40
|
useNativeDriver: false,
|
|
32
41
|
...animation.spring.snappy,
|
|
33
42
|
}).start();
|
|
34
|
-
};
|
|
43
|
+
}, [disabled, pressAnim]);
|
|
35
44
|
|
|
36
|
-
const onPressOut = () => {
|
|
45
|
+
const onPressOut = useCallback(() => {
|
|
37
46
|
Animated.spring(pressAnim, {
|
|
38
47
|
toValue: 0,
|
|
39
48
|
useNativeDriver: false,
|
|
40
49
|
...animation.spring.gentle,
|
|
41
50
|
}).start();
|
|
42
|
-
};
|
|
51
|
+
}, [pressAnim]);
|
|
43
52
|
|
|
44
53
|
const track = TRACK[size];
|
|
45
54
|
const thumb = THUMB[size];
|
|
@@ -73,11 +82,11 @@ const SwitchComponent = React.forwardRef<React.ElementRef<typeof Pressable>, Swi
|
|
|
73
82
|
role="switch"
|
|
74
83
|
aria-checked={value}
|
|
75
84
|
accessibilityState={{ checked: value, disabled }}
|
|
76
|
-
onPress={
|
|
85
|
+
onPress={handlePress}
|
|
77
86
|
onPressIn={onPressIn}
|
|
78
87
|
onPressOut={onPressOut}
|
|
79
|
-
style={[
|
|
80
|
-
hitSlop={
|
|
88
|
+
style={[disabled && styles.disabled, style]}
|
|
89
|
+
hitSlop={HIT_SLOP}
|
|
81
90
|
testID={testID}
|
|
82
91
|
>
|
|
83
92
|
<Animated.View
|
|
@@ -91,18 +100,15 @@ const SwitchComponent = React.forwardRef<React.ElementRef<typeof Pressable>, Swi
|
|
|
91
100
|
}}
|
|
92
101
|
>
|
|
93
102
|
<Animated.View
|
|
94
|
-
style={
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
shadowRadius: 3,
|
|
104
|
-
elevation: 3,
|
|
105
|
-
}}
|
|
103
|
+
style={[
|
|
104
|
+
styles.thumb,
|
|
105
|
+
{
|
|
106
|
+
width: thumb,
|
|
107
|
+
height: thumbHeight,
|
|
108
|
+
borderRadius: thumbRadius,
|
|
109
|
+
transform: [{ translateX: thumbX }],
|
|
110
|
+
},
|
|
111
|
+
]}
|
|
106
112
|
/>
|
|
107
113
|
</Animated.View>
|
|
108
114
|
</Pressable>
|
|
@@ -113,3 +119,19 @@ const SwitchComponent = React.forwardRef<React.ElementRef<typeof Pressable>, Swi
|
|
|
113
119
|
SwitchComponent.displayName = 'Switch';
|
|
114
120
|
|
|
115
121
|
export const Switch = memo(SwitchComponent);
|
|
122
|
+
|
|
123
|
+
const HIT_SLOP = { top: 8, bottom: 8, left: 8, right: 8 } as const;
|
|
124
|
+
|
|
125
|
+
const styles = StyleSheet.create({
|
|
126
|
+
disabled: {
|
|
127
|
+
opacity: 0.4,
|
|
128
|
+
},
|
|
129
|
+
thumb: {
|
|
130
|
+
backgroundColor: '#fff',
|
|
131
|
+
shadowColor: '#000',
|
|
132
|
+
shadowOffset: { width: 0, height: 2 },
|
|
133
|
+
shadowOpacity: 0.15,
|
|
134
|
+
shadowRadius: 3,
|
|
135
|
+
elevation: 3,
|
|
136
|
+
},
|
|
137
|
+
});
|