@openpeepshq/rn-components 0.8.4 → 0.8.5
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": "@openpeepshq/rn-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -104,7 +104,7 @@ export const EditNotificationsSheet = forwardRef<
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
return (
|
|
107
|
-
<BaseSheet ref={ref} key={name}>
|
|
107
|
+
<BaseSheet ref={ref} key={name} scrollable>
|
|
108
108
|
<View className="flex-1 p-4">
|
|
109
109
|
<View className="w-full">
|
|
110
110
|
<ThemedText className="text-center text-xl font-semibold mb-6">
|
|
@@ -13,6 +13,17 @@ import { Avatar, AvatarImage } from '../ui/avatar';
|
|
|
13
13
|
import { UserXIcon } from '../icons/index';
|
|
14
14
|
import { cn } from '../../lib/utils';
|
|
15
15
|
|
|
16
|
+
/** Tailwind spacing unit in dp (size-N / w-N → N × 4). */
|
|
17
|
+
const TAILWIND_UNIT = 4;
|
|
18
|
+
/** Initials and deleted-icon scale with the avatar instead of preset buckets. */
|
|
19
|
+
const FONT_RATIO = 0.375;
|
|
20
|
+
const ICON_RATIO = 0.4375;
|
|
21
|
+
|
|
22
|
+
const avatarPxFromClassName = (className?: string): number => {
|
|
23
|
+
const match = className?.match(/(?:^|\s)(?:size-|w-)(\d+)(?=\s|$)/);
|
|
24
|
+
return match ? Number(match[1]) * TAILWIND_UNIT : 64;
|
|
25
|
+
};
|
|
26
|
+
|
|
16
27
|
export const ProfileAvatar = ({
|
|
17
28
|
profile,
|
|
18
29
|
className,
|
|
@@ -23,9 +34,9 @@ export const ProfileAvatar = ({
|
|
|
23
34
|
const { t } = useTranslation();
|
|
24
35
|
const { isDark } = useOpenPeepsTheme();
|
|
25
36
|
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
37
|
+
const px = avatarPxFromClassName(className);
|
|
38
|
+
const iconSize = Math.max(12, Math.round(px * ICON_RATIO));
|
|
39
|
+
const fontSize = Math.max(10, Math.round(px * FONT_RATIO));
|
|
29
40
|
const roundedClass = 'rounded-full';
|
|
30
41
|
const deleted = isDeletedProfile(profile);
|
|
31
42
|
|
|
@@ -36,16 +47,18 @@ export const ProfileAvatar = ({
|
|
|
36
47
|
const backgroundColor =
|
|
37
48
|
!deleted && !avatarSource ? initialsBackground(hue, isDark) : undefined;
|
|
38
49
|
|
|
50
|
+
const rootClassName = cn(
|
|
51
|
+
'border border-muted-foreground overflow-hidden',
|
|
52
|
+
roundedClass,
|
|
53
|
+
className
|
|
54
|
+
);
|
|
55
|
+
|
|
39
56
|
if (deleted || !avatarSource) {
|
|
40
57
|
return (
|
|
41
58
|
<Avatar
|
|
42
59
|
alt={t('profile.header.avatarAlt')}
|
|
43
|
-
className={
|
|
44
|
-
|
|
45
|
-
sizeClass,
|
|
46
|
-
roundedClass,
|
|
47
|
-
className
|
|
48
|
-
)}
|
|
60
|
+
className={rootClassName}
|
|
61
|
+
style={{ width: px, height: px }}
|
|
49
62
|
>
|
|
50
63
|
<View
|
|
51
64
|
className={cn(
|
|
@@ -57,10 +70,7 @@ export const ProfileAvatar = ({
|
|
|
57
70
|
{deleted ? (
|
|
58
71
|
<UserXIcon size={iconSize} className="text-muted-foreground" />
|
|
59
72
|
) : (
|
|
60
|
-
<Text
|
|
61
|
-
className="text-foreground font-medium"
|
|
62
|
-
style={{ fontSize: isSmall ? 14 : 24 }}
|
|
63
|
-
>
|
|
73
|
+
<Text className="text-foreground font-medium" style={{ fontSize }}>
|
|
64
74
|
{getInitials(profile?.displayName, profile?.handle)}
|
|
65
75
|
</Text>
|
|
66
76
|
)}
|
|
@@ -72,12 +82,8 @@ export const ProfileAvatar = ({
|
|
|
72
82
|
return (
|
|
73
83
|
<Avatar
|
|
74
84
|
alt={t('profile.header.avatarAlt')}
|
|
75
|
-
className={
|
|
76
|
-
|
|
77
|
-
sizeClass,
|
|
78
|
-
roundedClass,
|
|
79
|
-
className
|
|
80
|
-
)}
|
|
85
|
+
className={rootClassName}
|
|
86
|
+
style={{ width: px, height: px }}
|
|
81
87
|
>
|
|
82
88
|
<AvatarImage
|
|
83
89
|
source={avatarSource}
|
|
@@ -205,7 +205,7 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
205
205
|
<DropdownMenu>
|
|
206
206
|
<KeyboardAvoidingView
|
|
207
207
|
className="flex-1"
|
|
208
|
-
behavior={Platform.OS === 'ios' ? 'padding' :
|
|
208
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
209
209
|
keyboardVerticalOffset={Platform.OS === 'ios' ? 90 : 0}
|
|
210
210
|
>
|
|
211
211
|
<ScrollView
|