@openpeepshq/rn-components 0.12.1 → 0.12.3

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.12.1",
3
+ "version": "0.12.3",
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",
@@ -98,7 +98,7 @@
98
98
  "clsx": "^2.1.1",
99
99
  "date-fns": "^4.1.0",
100
100
  "i18next": "^24.2.3",
101
- "i18next-http-backend": "^3.0.6",
101
+ "i18next-http-backend": "^4.0.10",
102
102
  "js-base64": "^3.7.7",
103
103
  "livekit-client": "2.19.2",
104
104
  "lucide-react-native": "^0.474.0",
@@ -142,8 +142,8 @@
142
142
  "timezones-list": "^3.1.0",
143
143
  "validator": "^13.15.23",
144
144
  "zustand": "^5.0.3",
145
- "@openpeepshq/common": "^0.6.1",
146
- "@openpeepshq/react": "^0.11.0"
145
+ "@openpeepshq/common": "^0.6.2",
146
+ "@openpeepshq/react": "^0.11.1"
147
147
  },
148
148
  "devDependencies": {
149
149
  "@babel/core": "^7.26.7",
@@ -161,7 +161,7 @@
161
161
  "@react-native/jest-preset": "0.85.2",
162
162
  "@react-native/metro-config": "0.85.2",
163
163
  "@react-native/typescript-config": "0.85.2",
164
- "@release-it/conventional-changelog": "^9.0.2",
164
+ "@release-it/conventional-changelog": "^12.0.2",
165
165
  "@sentry/cli": "^3.3.5",
166
166
  "@types/jest": "^29.5.14",
167
167
  "@types/node": "^22.14.1",
@@ -182,7 +182,7 @@
182
182
  "prettier": "^3.0.3",
183
183
  "react-native-builder-bob": "^0.35.2",
184
184
  "react-test-renderer": "19.2.3",
185
- "release-it": "^17.10.0",
185
+ "release-it": "^19.0.0",
186
186
  "ts-jest": "^29.3.4",
187
187
  "typescript": "^6.0.2",
188
188
  "@eslint/js": "^9.17.0"
@@ -175,9 +175,9 @@ export const EventForm = ({
175
175
  <SectionTitle>{t('events.form.dateAndTimeTitle')}</SectionTitle>
176
176
 
177
177
  <PickerField
178
- label={t('events.form.startDate')}
178
+ label={t('events.startDate')}
179
179
  value={formatDate(event.start, eventTimeZone)}
180
- placeholder={t('events.form.startDate')}
180
+ placeholder={t('events.startDate')}
181
181
  icon={<CalendarIcon className="text-muted-foreground" size={18} />}
182
182
  onPress={() => bottomSheetPresent(startSheetRef)}
183
183
  />
@@ -193,9 +193,9 @@ export const EventForm = ({
193
193
  {showEndDate ? (
194
194
  <>
195
195
  <PickerField
196
- label={t('events.form.endDate')}
196
+ label={t('events.endDate')}
197
197
  value={formatDate(event.end, eventTimeZone)}
198
- placeholder={t('events.form.endDate')}
198
+ placeholder={t('events.endDate')}
199
199
  icon={
200
200
  <CalendarIcon className="text-muted-foreground" size={18} />
201
201
  }
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Regression tests for the ProfileCard layout guards (issue #2111).
3
+ *
4
+ * The RN card dropped the web card's flexbox overflow guards
5
+ * (`min-w-0 flex-1` on the content wrapper, line clamps on the texts), so a
6
+ * long bio pushed the Follow/Unfollow button past the right edge where it
7
+ * was clipped. The row and text column must stay flexible and the texts
8
+ * must keep their line caps, mirroring
9
+ * platform/react/src/components/profile/ProfileCard.tsx.
10
+ */
11
+
12
+ const React = require('react');
13
+ const ReactTestRenderer = require('react-test-renderer');
14
+
15
+ jest.mock('react-native', () => ({
16
+ View: (props: { children?: unknown }) =>
17
+ React.createElement('View', null, props.children),
18
+ Pressable: (props: {
19
+ children?: unknown;
20
+ onPress?: () => void;
21
+ disabled?: boolean;
22
+ }) =>
23
+ React.createElement(
24
+ 'Pressable',
25
+ { onPress: props.onPress, disabled: props.disabled },
26
+ props.children
27
+ ),
28
+ TouchableWithoutFeedback: (props: { children?: unknown }) =>
29
+ React.createElement('TouchableWithoutFeedback', null, props.children),
30
+ }));
31
+
32
+ jest.mock('react-i18next', () => ({
33
+ useTranslation: () => ({ t: (key: string) => key }),
34
+ }));
35
+
36
+ jest.mock('@react-navigation/native', () => ({
37
+ useNavigation: () => ({ navigate: jest.fn() }),
38
+ }));
39
+
40
+ jest.mock('@openpeepshq/common', () => ({}));
41
+
42
+ jest.mock('@openpeepshq/common/lib', () => ({
43
+ // Mirrored from platform/common/src/lib — the built package ships ESM
44
+ // which Jest's node transform doesn't cover.
45
+ markdownPlainText: (text?: string) => text ?? '',
46
+ }));
47
+
48
+ jest.mock('../icons/index', () => ({
49
+ XIcon: () => React.createElement('XIcon'),
50
+ }));
51
+
52
+ jest.mock('../ui/themed-text', () => ({
53
+ ThemedText: (props: Record<string, unknown>) =>
54
+ React.createElement('ThemedText', props, props.children),
55
+ }));
56
+
57
+ jest.mock('./Avatar', () => ({
58
+ ProfileAvatar: (props: Record<string, unknown>) =>
59
+ React.createElement('ProfileAvatar', props),
60
+ }));
61
+
62
+ jest.mock('./FollowUnfollowButton', () => ({
63
+ FollowUnfollowButton: (props: Record<string, unknown>) =>
64
+ React.createElement('FollowUnfollowButton', props),
65
+ }));
66
+
67
+ jest.mock('../../lib/utils', () => ({
68
+ truncateText: (text: string, max: number) =>
69
+ text && text.length > max ? `${text.slice(0, max)}…` : text,
70
+ }));
71
+
72
+ import type { ProfileCardProps } from './ProfileCard';
73
+ import { ProfileCard } from './ProfileCard';
74
+
75
+ const longBio =
76
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '.repeat(6) +
77
+ 'Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
78
+
79
+ const profile = {
80
+ did: 'did:plc:test',
81
+ handle: 'lovelace.example',
82
+ displayName: 'Ada Lovelace',
83
+ bio: longBio,
84
+ } as unknown as ProfileCardProps['profile'];
85
+
86
+ const renderCard = () => {
87
+ let tree: ReturnType<typeof ReactTestRenderer.create>;
88
+ ReactTestRenderer.act(() => {
89
+ tree = ReactTestRenderer.create(
90
+ React.createElement(ProfileCard, {
91
+ profile,
92
+ actionType: 'link' as const,
93
+ })
94
+ );
95
+ });
96
+ return tree;
97
+ };
98
+
99
+ describe('ProfileCard layout guards (issue #2111)', () => {
100
+ it('clamps the bio to two lines so a long bio cannot push the action out', () => {
101
+ const tree = renderCard();
102
+ const bioText = tree.root
103
+ .findAllByType('ThemedText')
104
+ .find((node: { props: { children?: unknown } }) =>
105
+ String(node.props.children).startsWith('Lorem ipsum')
106
+ );
107
+ expect(bioText).toBeDefined();
108
+ expect(bioText.props.numberOfLines).toBe(2);
109
+ });
110
+
111
+ it('clamps the display name and handle to one line', () => {
112
+ const tree = renderCard();
113
+ const texts = tree.root.findAllByType('ThemedText');
114
+ const name = texts.find(
115
+ (node: { props: { children?: unknown } }) =>
116
+ node.props.children === 'Ada Lovelace'
117
+ );
118
+ const handle = texts.find(
119
+ (node: { props: { children?: unknown } }) =>
120
+ String(node.props.children) === '@lovelace.example' ||
121
+ (Array.isArray(node.props.children) &&
122
+ node.props.children.join('') === '@lovelace.example')
123
+ );
124
+ expect(name).toBeDefined();
125
+ expect(handle).toBeDefined();
126
+ expect(name.props.numberOfLines).toBe(1);
127
+ expect(handle.props.numberOfLines).toBe(1);
128
+ });
129
+
130
+ it('keeps the profile content inside a flexible row with the action pinned', () => {
131
+ const tree = renderCard();
132
+ const contentRow = tree.root.findByProps({
133
+ className: 'flex flex-row items-center gap-x-2 min-w-0 flex-1',
134
+ });
135
+ const textColumn = tree.root.findByProps({
136
+ className: 'min-w-0 flex-1',
137
+ });
138
+ expect(contentRow).toBeDefined();
139
+ expect(textColumn).toBeDefined();
140
+ // Follow/Unfollow action is rendered and not clipped away.
141
+ expect(tree.root.findByType('FollowUnfollowButton')).toBeDefined();
142
+ });
143
+ });
@@ -64,18 +64,26 @@ export const ProfileCard = ({
64
64
  }`}
65
65
  >
66
66
  <TouchableWithoutFeedback onPress={onPress}>
67
- <View className="flex flex-row items-center gap-x-2">
67
+ <View className="flex flex-row items-center gap-x-2 min-w-0 flex-1">
68
68
  <ProfileAvatar
69
69
  profile={profile}
70
70
  className={actionType === 'select' ? 'size-10' : 'size-16'}
71
71
  />
72
- <View className="">
73
- <ThemedText className="text-lg font-semibold">
72
+ <View className="min-w-0 flex-1">
73
+ <ThemedText
74
+ className="text-lg font-semibold truncate"
75
+ numberOfLines={1}
76
+ >
74
77
  {truncateText(profile.displayName, 18) || profile.handle}
75
78
  </ThemedText>
76
- <ThemedText className="">@{profile.handle}</ThemedText>
79
+ <ThemedText className="truncate" numberOfLines={1}>
80
+ @{profile.handle}
81
+ </ThemedText>
77
82
  {bio ? (
78
- <ThemedText className="text-muted-foreground mt-1 text-sm">
83
+ <ThemedText
84
+ className="text-muted-foreground mt-1 text-sm"
85
+ numberOfLines={2}
86
+ >
79
87
  {truncateText(bio, 100)}
80
88
  </ThemedText>
81
89
  ) : null}