@openpeepshq/rn-components 0.18.0 → 0.20.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.
@@ -1,11 +1,13 @@
1
1
  /**
2
- * Native PostActions reaction-picker wiring (issue #80 review round 5).
2
+ * Native PostActions reaction-picker wiring (issue #276, round-15 review item
3
+ * #2 — this suite was removed when the RN picker switched to the allowed-set
4
+ * model and is restored here).
3
5
  *
4
- * Pins that the RN PostActions React button opens the picker and threads
5
- * `myReactions` / `toggleReaction` / `onClose` through to it (the web path has
6
- * useFeedPostActions + ReactionPicker tests, but the native wiring was
7
- * untested). Mirrors PostMenu.test.tsx: node jest env, every external import
8
- * mocked — the decision under test is the button→picker threading.
6
+ * Pins that the RN PostActions Like button opens the picker and threads
7
+ * `myReactions`, the community `reactions` (from useAllowedReactions) and
8
+ * `onToggle` through to it. Mirrors PostMenu.test.tsx: node jest env, every
9
+ * external import mocked — the decision under test is the button→picker
10
+ * threading.
9
11
  */
10
12
  import { type ReactNode } from 'react';
11
13
  import ReactTestRenderer from 'react-test-renderer';
@@ -22,8 +24,8 @@ let mockCanReact = true;
22
24
  let lastPickerProps:
23
25
  | {
24
26
  myReactions: string[];
27
+ reactions: readonly string[];
25
28
  onToggle: (r: string) => void;
26
- onClose: () => void;
27
29
  }
28
30
  | undefined;
29
31
  const buttonInstances: { onPress?: () => void }[] = [];
@@ -47,12 +49,12 @@ jest.mock('react-i18next', () => ({
47
49
  }),
48
50
  }));
49
51
 
50
- // --- the feed action hook under test --------------------------------------
52
+ // --- the feed action hooks under test --------------------------------------
51
53
  jest.mock('@openpeepshq/react', () => ({
52
54
  useFeedPostActions: () => ({
53
55
  me: { id: 'me-1' },
54
56
  myRepost: undefined,
55
- iReacted: mockMyReactions.length > 0,
57
+ iLiked: mockMyReactions.includes('👍'),
56
58
  myReactions: mockMyReactions,
57
59
  canReply: true,
58
60
  canRepost: true,
@@ -61,14 +63,15 @@ jest.mock('@openpeepshq/react', () => ({
61
63
  toggleRepost,
62
64
  toggleReaction,
63
65
  }),
66
+ useAllowedReactions: () => REACTION_TYPES,
64
67
  }));
65
68
 
66
69
  // --- local UI: capture picker props and button presses --------------------
67
70
  jest.mock('./ReactionPicker', () => ({
68
71
  ReactionPicker: (props: {
69
72
  myReactions: string[];
73
+ reactions: readonly string[];
70
74
  onToggle: (r: string) => void;
71
- onClose: () => void;
72
75
  }) => {
73
76
  lastPickerProps = props;
74
77
  return null;
@@ -151,24 +154,24 @@ const renderPostActions = (
151
154
  return { tree };
152
155
  };
153
156
 
154
- /** The React button is the one whose text is the react footer label. */
157
+ /** The Like button is the one whose text is the react footer label. */
155
158
  const reactButtonPress = (json: unknown): (() => void) | undefined => {
156
159
  let found: (() => void) | undefined;
157
160
  walk(json, (n) => {
158
161
  if (found || n.type !== 'Button') return;
159
- if (collectText(n).includes('posts.footer.react')) {
162
+ if (collectText(n).includes('posts.footer.like')) {
160
163
  found = n.props?.onPress as () => void;
161
164
  }
162
165
  });
163
166
  return found;
164
167
  };
165
168
 
166
- /** The React button's `disabled` prop (undefined when the button is absent). */
169
+ /** The Like button's `disabled` prop (undefined when the button is absent). */
167
170
  const reactButtonDisabled = (json: unknown): boolean | undefined => {
168
171
  let found: boolean | undefined;
169
172
  walk(json, (n) => {
170
173
  if (found !== undefined || n.type !== 'Button') return;
171
- if (collectText(n).includes('posts.footer.react')) {
174
+ if (collectText(n).includes('posts.footer.like')) {
172
175
  found = n.props?.disabled as boolean | undefined;
173
176
  }
174
177
  });
@@ -186,7 +189,7 @@ beforeEach(() => {
186
189
  buttonInstances.length = 0;
187
190
  });
188
191
 
189
- test('tapping the React button opens the picker wired to the feed actions', () => {
192
+ test('tapping the Like button opens the picker wired to the feed actions', () => {
190
193
  const { tree } = renderPostActions(makePost());
191
194
  const press = reactButtonPress(tree.toJSON());
192
195
  expect(press).toBeTruthy();
@@ -198,6 +201,7 @@ test('tapping the React button opens the picker wired to the feed actions', () =
198
201
 
199
202
  expect(lastPickerProps).toBeDefined();
200
203
  expect(lastPickerProps?.myReactions).toEqual(['❤️']);
204
+ expect(lastPickerProps?.reactions).toEqual(REACTION_TYPES);
201
205
  tree.unmount();
202
206
  });
203
207
 
@@ -217,7 +221,10 @@ test('picking an emoji from the open picker calls toggleReaction with it', () =>
217
221
  tree.unmount();
218
222
  });
219
223
 
220
- test('the picker close control calls onClose without toggling a reaction', () => {
224
+ test('an orphan (no longer allowed) reaction still toggles', () => {
225
+ // The picker renders the profile's own reactions that are no longer in the
226
+ // community allowed set (orphans) so they stay retractable; the RN wrapper
227
+ // must thread them through onToggle the same as allowed reactions.
221
228
  const { tree } = renderPostActions(makePost());
222
229
  ReactTestRenderer.act(() => {
223
230
  reactButtonPress(tree.toJSON())!();
@@ -225,14 +232,15 @@ test('the picker close control calls onClose without toggling a reaction', () =>
225
232
  expect(lastPickerProps).toBeDefined();
226
233
 
227
234
  ReactTestRenderer.act(() => {
228
- lastPickerProps?.onClose();
235
+ lastPickerProps?.onToggle('🎉');
229
236
  });
230
237
 
231
- expect(toggleReaction).not.toHaveBeenCalled();
238
+ expect(toggleReaction).toHaveBeenCalledTimes(1);
239
+ expect(toggleReaction).toHaveBeenCalledWith('🎉');
232
240
  tree.unmount();
233
241
  });
234
242
 
235
- test('the React button renders disabled when the profile cannot react and has no reactions', () => {
243
+ test('the Like button renders disabled when the profile cannot react and has no reactions', () => {
236
244
  // Native mirror of the web ReactionPicker contract: without the react
237
245
  // capability and no existing reaction, the trigger is inert (the web path
238
246
  // pins this in ReactionPicker.test.tsx).
@@ -11,26 +11,24 @@ import {
11
11
  } from '../../icons/index';
12
12
  import { type PublicPost } from '@openpeepshq/common';
13
13
  import { useTranslation } from 'react-i18next';
14
- import { useFeedPostActions } from '@openpeepshq/react';
14
+ import { useFeedPostActions, useAllowedReactions } from '@openpeepshq/react';
15
15
  import { ReactionPicker } from './ReactionPicker';
16
16
  import { ShareMenu } from './ShareMenu';
17
17
 
18
18
  interface PostActionsProps {
19
19
  post: PublicPost;
20
20
  previewMode?: boolean;
21
- compact?: boolean;
22
21
  }
23
22
 
24
23
  export const PostActions = ({
25
24
  post,
26
25
  previewMode = false,
27
- compact: _compact = false,
28
26
  }: PostActionsProps) => {
29
27
  const { t } = useTranslation();
30
28
  const {
31
29
  me,
32
30
  myRepost,
33
- iReacted,
31
+ iLiked,
34
32
  myReactions,
35
33
  canReply,
36
34
  canRepost,
@@ -39,6 +37,7 @@ export const PostActions = ({
39
37
  toggleRepost,
40
38
  toggleReaction,
41
39
  } = useFeedPostActions(post);
40
+ const allowedReactions = useAllowedReactions();
42
41
  const [reactionPickerOpen, setReactionPickerOpen] = useState(false);
43
42
 
44
43
  const replyActive = !previewMode && canReply;
@@ -145,12 +144,9 @@ export const PostActions = ({
145
144
  onPress={() => setReactionPickerOpen((open) => !open)}
146
145
  className={cn(actionClass, 'justify-end', !reactActive && idleClass)}
147
146
  >
148
- <ThumbsUpIcon
149
- size={16}
150
- className={iconClass(reactActive, iReacted)}
151
- />
152
- <ThemedText className={labelClass(reactActive, iReacted)}>
153
- {t('posts.footer.react')}
147
+ <ThumbsUpIcon size={16} className={iconClass(reactActive, iLiked)} />
148
+ <ThemedText className={labelClass(reactActive, iLiked)}>
149
+ {t('posts.footer.like')}
154
150
  </ThemedText>
155
151
  </Button>
156
152
  <View className="flex-1 items-end">{shareButton}</View>
@@ -159,7 +155,7 @@ export const PostActions = ({
159
155
  <View className="flex-row gap-1 px-4 pb-2">
160
156
  <ReactionPicker
161
157
  myReactions={myReactions}
162
- onClose={() => setReactionPickerOpen(false)}
158
+ reactions={allowedReactions}
163
159
  onToggle={(reaction) => {
164
160
  setReactionPickerOpen(false);
165
161
  void toggleReaction(reaction);
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { Pressable } from 'react-native';
3
+ import { ThemedText } from '../../ui/themed-text';
4
+ import { cn } from '../../../lib/utils';
5
+
6
+ export interface ReactionButtonProps {
7
+ reaction: string;
8
+ /** Accessible label; defaults to the emoji itself. */
9
+ title?: string;
10
+ /** Highlight the emoji the profile has already attached. */
11
+ active?: boolean;
12
+ /** An emoji no longer in the allowed set but still attached — dim it. */
13
+ orphan?: boolean;
14
+ onPress: () => void;
15
+ }
16
+
17
+ /**
18
+ * A single emoji reaction control, shared by the post reaction picker and the
19
+ * jam reaction menu so tap/active styling lives in one place instead of
20
+ * drifting across copies.
21
+ */
22
+ export const ReactionButton = ({
23
+ reaction,
24
+ title,
25
+ active = false,
26
+ orphan = false,
27
+ onPress,
28
+ }: ReactionButtonProps) => (
29
+ <Pressable
30
+ accessibilityRole="button"
31
+ accessibilityLabel={title ?? reaction}
32
+ onPress={onPress}
33
+ className={cn(
34
+ 'shrink-0 rounded-md p-2',
35
+ active && 'bg-border',
36
+ orphan && 'opacity-60'
37
+ )}
38
+ >
39
+ <ThemedText className="text-lg">{reaction}</ThemedText>
40
+ </Pressable>
41
+ );
@@ -1,184 +1,103 @@
1
1
  /**
2
- * Native ReactionPicker render test (issue #80 review round 4).
2
+ * Regression test for the native `ReactionPicker` orphaned-reaction path
3
+ * (issue #276, round-5 review item #2) — the mirror of the web picker test.
4
+ * Orphans — reactions attached before the community removed the emoji from its
5
+ * allowed set — render after a divider, flagged `orphan` (dimmed by
6
+ * `ReactionButton`), and stay retractable; there is no divider/orphan section
7
+ * when every attached reaction is still allowed.
3
8
  *
4
- * Pins the picker contract on React Native, mirroring the web
5
- * ReactionPicker.test.tsx per the AGENTS.md sync rule: the row renders all 7
6
- * curated reactions plus the explicit close affordance, the current
7
- * profile's own reactions are highlighted, a tap calls `onToggle` with the
8
- * tapped emoji, and the close button fires `onClose`.
9
- *
10
- * Mirrors the inline-mock pattern of PostMenu.test.tsx / ShareMenu.test.tsx:
11
- * node jest env, every external import mocked; `@openpeepshq/common` is
12
- * stubbed with the real curated set so the row is asserted against the
13
- * actual REACTION_TYPES values.
9
+ * The RN primitives, i18n, and `ReactionButton` are stubbed to self-describing
10
+ * host tags (`RB_ALLOWED` / `RB_ORPHAN` / `DIVIDER`) so the assertions read the
11
+ * real picker's orphan computation and render order from the rendered tree.
14
12
  */
15
- import { type ReactNode } from 'react';
16
- import ReactTestRenderer from 'react-test-renderer';
17
-
18
- const REACTION_TYPES = ['👍', '👎', '❤️', '😂', '😮', '😢', '🎉'];
19
- const CLOSE_LABEL = 'posts.actions.closeReactionPicker';
13
+ const React = require('react');
14
+ const ReactTestRenderer = require('react-test-renderer');
20
15
 
21
16
  jest.mock('react-native', () => {
22
- const React = require('react');
23
- const make = (tag: string) => (props: { children?: ReactNode }) => {
24
- const { children, ...rest } = props;
25
- return React.createElement(tag, rest, children);
26
- };
27
- return {
28
- View: make('View'),
29
- Pressable: make('Pressable'),
30
- };
17
+ const V = (props: { className?: string; children?: unknown }) =>
18
+ React.createElement(
19
+ props.className === 'mx-1 h-8 w-px shrink-0 bg-border'
20
+ ? 'DIVIDER'
21
+ : 'DIV',
22
+ null,
23
+ props.children
24
+ );
25
+ const T = (props: { children?: unknown }) =>
26
+ React.createElement('Text', null, props.children);
27
+ const P = (props: { children?: unknown }) =>
28
+ React.createElement('Pressable', null, props.children);
29
+ return { View: V, Text: T, Pressable: P };
31
30
  });
32
-
33
31
  jest.mock('react-i18next', () => ({
34
- useTranslation: () => ({
35
- t: (key: string, opts?: { defaultValue?: string }) =>
36
- opts?.defaultValue ?? key,
37
- }),
32
+ useTranslation: () => ({ t: (key: string) => key }),
38
33
  }));
39
-
40
- jest.mock('@openpeepshq/common', () => ({
41
- REACTION_TYPES,
34
+ jest.mock('./ReactionButton', () => ({
35
+ ReactionButton: (props: {
36
+ reaction?: string;
37
+ orphan?: boolean;
38
+ onPress?: () => void;
39
+ }) =>
40
+ React.createElement(
41
+ props.orphan ? 'RB_ORPHAN' : 'RB_ALLOWED',
42
+ { onPress: props.onPress },
43
+ props.reaction
44
+ ),
42
45
  }));
43
46
 
44
- jest.mock('../../ui/themed-text', () => {
45
- const React = require('react');
46
- return {
47
- ThemedText: (props: { children?: ReactNode }) =>
48
- React.createElement('Text', null, props.children),
49
- };
50
- });
51
-
52
- jest.mock('../../icons/index', () => ({
53
- XIcon: () => null,
54
- }));
55
-
56
- jest.mock('../../../lib/utils', () => ({
57
- cn: (...parts: Array<string | false | null | undefined>) =>
58
- parts.filter(Boolean).join(' '),
59
- }));
60
-
61
- import { ReactionPicker } from './ReactionPicker';
62
-
63
- type TreeNode = {
64
- type?: string;
65
- props?: Record<string, unknown> | null;
66
- children?: (TreeNode | string | null)[];
67
- };
47
+ const { ReactionPicker } = require('./ReactionPicker');
68
48
 
69
- function collectText(node: unknown, out: string[] = []): string[] {
70
- if (node === null || typeof node !== 'object') return out;
71
- const n = node as TreeNode;
72
- for (const c of n.children || []) {
73
- if (typeof c === 'string') out.push(c);
74
- else if (c) collectText(c, out);
75
- }
76
- return out;
77
- }
78
-
79
- /** Depth-first walk over the render tree, visiting every element node. */
80
- function walk(node: unknown, visit: (n: TreeNode) => void): void {
81
- if (node === null || typeof node !== 'object') return;
82
- const n = node as TreeNode;
83
- visit(n);
84
- for (const c of n.children || []) {
85
- if (typeof c !== 'string' && c !== null) walk(c, visit);
86
- }
87
- }
88
-
89
- /** The Pressable whose only text content is the given emoji. */
90
- function emojiPressable(json: unknown, emoji: string): TreeNode | undefined {
91
- let found: TreeNode | undefined;
92
- walk(json, (n) => {
93
- if (found || n.type !== 'Pressable') return;
94
- if (collectText(n).join('') === emoji) found = n;
95
- });
96
- return found;
97
- }
98
-
99
- const renderPicker = (props?: {
100
- myReactions?: string[];
101
- onToggle?: (reaction: string) => void;
102
- onClose?: () => void;
103
- }) => {
104
- const onToggle = props?.onToggle ?? jest.fn();
105
- const onClose = props?.onClose ?? jest.fn();
106
- let tree!: ReactTestRenderer.ReactTestRenderer;
49
+ const render = (
50
+ myReactions: string[],
51
+ reactions: readonly string[],
52
+ onToggle: (reaction: string) => void
53
+ ) => {
54
+ let tree!: ReturnType<typeof ReactTestRenderer.create>;
107
55
  ReactTestRenderer.act(() => {
108
56
  tree = ReactTestRenderer.create(
109
- <ReactionPicker
110
- myReactions={props?.myReactions ?? []}
111
- onToggle={onToggle}
112
- onClose={onClose}
113
- />
57
+ React.createElement(ReactionPicker, {
58
+ myReactions,
59
+ reactions,
60
+ onToggle,
61
+ })
114
62
  );
115
63
  });
116
- return { tree, onToggle, onClose };
64
+ return tree;
117
65
  };
118
66
 
119
- test('renders every curated reaction plus the close affordance', () => {
120
- const { tree } = renderPicker();
121
- const text = collectText(tree.toJSON());
122
- for (const emoji of REACTION_TYPES) {
123
- expect(text).toContain(emoji);
124
- }
125
- let sawClose = false;
126
- walk(tree.toJSON(), (n) => {
127
- if (n.props?.accessibilityLabel === CLOSE_LABEL) sawClose = true;
128
- });
129
- expect(sawClose).toBe(true);
130
- tree.unmount();
131
- });
132
-
133
- test('highlights only the reactions the current profile already attached', () => {
134
- const { tree } = renderPicker({ myReactions: ['❤️'] });
135
- const highlighted: string[] = [];
136
- walk(tree.toJSON(), (n) => {
137
- const className = n.props?.className;
138
- if (typeof className === 'string' && className.includes('bg-border')) {
139
- highlighted.push(...collectText(n));
140
- }
67
+ describe('ReactionPicker (native) orphans', () => {
68
+ it('renders the orphan (dimmed flag) after the divider', () => {
69
+ const tree = render(['🐰'], ['👍'], () => {});
70
+ const dividers = tree.root.findAllByType('DIVIDER');
71
+ const orphans = tree.root.findAllByType('RB_ORPHAN');
72
+ expect(dividers.length).toBe(1);
73
+ expect(orphans.length).toBe(1);
74
+ // The divider precedes the orphan in render order.
75
+ const all = tree.root.findAll(() => true);
76
+ const dividerIdx = all.findIndex((n) => n.type === 'DIVIDER');
77
+ const orphanIdx = all.findIndex((n) => n.type === 'RB_ORPHAN');
78
+ expect(dividerIdx).toBeGreaterThanOrEqual(0);
79
+ expect(dividerIdx).toBeLessThan(orphanIdx);
80
+ // The orphan row carries the emoji it retracts.
81
+ expect(orphans[0].children).toContain('🐰');
141
82
  });
142
- expect(highlighted).toEqual(['❤️']);
143
- tree.unmount();
144
- });
145
-
146
- test('gives each emoji button an accessibility label with the reaction name', () => {
147
- const { tree } = renderPicker();
148
- for (const emoji of REACTION_TYPES) {
149
- const button = emojiPressable(tree.toJSON(), emoji);
150
- expect(button).toBeTruthy();
151
- expect(button?.props?.accessibilityLabel).toBe(emoji);
152
- }
153
- tree.unmount();
154
- });
155
83
 
156
- test('tapping an emoji calls onToggle with that emoji', () => {
157
- const onToggle = jest.fn();
158
- const { tree } = renderPicker({ onToggle });
159
- const pressed = emojiPressable(tree.toJSON(), '😂');
160
- expect(pressed).toBeTruthy();
161
- ReactTestRenderer.act(() => {
162
- (pressed?.props?.onPress as () => void)();
84
+ it('retracts when the orphan is tapped', () => {
85
+ let toggled: string | undefined;
86
+ const tree = render(['👍', '🐰'], ['👍'], (r) => {
87
+ toggled = r;
88
+ });
89
+ const orphan = tree.root.findAllByType('RB_ORPHAN')[0];
90
+ expect(orphan.children).toContain('🐰');
91
+ // The orphan button is wired to retract its own emoji.
92
+ ReactTestRenderer.act(() => {
93
+ orphan.props.onPress();
94
+ });
95
+ expect(toggled).toBe('🐰');
163
96
  });
164
- expect(onToggle).toHaveBeenCalledTimes(1);
165
- expect(onToggle).toHaveBeenCalledWith('😂');
166
- tree.unmount();
167
- });
168
97
 
169
- test('the close button fires onClose without toggling a reaction', () => {
170
- const onToggle = jest.fn();
171
- const onClose = jest.fn();
172
- const { tree } = renderPicker({ onToggle, onClose });
173
- let closed = false;
174
- walk(tree.toJSON(), (n) => {
175
- if (n.props?.accessibilityLabel === CLOSE_LABEL && n.props?.onPress) {
176
- closed = true;
177
- ReactTestRenderer.act(() => (n.props.onPress as () => void)());
178
- }
98
+ it('renders no orphan section when every attached reaction is allowed', () => {
99
+ const tree = render(['👍', '🎉'], ['👍', '🎉'], () => {});
100
+ expect(tree.root.findAllByType('RB_ORPHAN').length).toBe(0);
101
+ expect(tree.root.findAllByType('DIVIDER').length).toBe(0);
179
102
  });
180
- expect(closed).toBe(true);
181
- expect(onClose).toHaveBeenCalledTimes(1);
182
- expect(onToggle).not.toHaveBeenCalled();
183
- tree.unmount();
184
103
  });
@@ -1,58 +1,57 @@
1
1
  import React from 'react';
2
- import { Pressable, View } from 'react-native';
3
- import { REACTION_TYPES } from '@openpeepshq/common';
2
+ import { View } from 'react-native';
4
3
  import type { ReactionData } from '@openpeepshq/common/types';
5
4
  import { useTranslation } from 'react-i18next';
6
- import { ThemedText } from '../../ui/themed-text';
7
- import { XIcon } from '../../icons/index';
8
- import { cn } from '../../../lib/utils';
5
+ import { ReactionButton } from './ReactionButton';
9
6
 
10
7
  export interface ReactionPickerProps {
11
8
  /** Reactions the current profile already attached to this post. */
12
9
  myReactions: string[];
10
+ /** Emojis the community allows on posts (from useAllowedReactions). */
11
+ reactions: readonly string[];
13
12
  onToggle: (reaction: ReactionData['reaction']) => void;
14
- /** Closes the picker (mirrors the web popover closing on outside click). */
15
- onClose: () => void;
16
13
  }
17
14
 
18
15
  /**
19
- * Post reaction selection: a row of the curated reactions. Tapping an emoji
20
- * toggles the current profile's reaction for the post (mirrors the jam
21
- * reaction menu). A close (dismiss) button at the end of the row lets the
22
- * picker be closed without re-tapping the React button, matching the web
23
- * picker's outside-click dismissal.
16
+ * Post reaction selection: a row of the community's allowed reactions, plus
17
+ * any of the profile's own reactions that are no longer allowed (orphans) so
18
+ * they stay visible and retractable. Tapping an emoji toggles the current
19
+ * profile's reaction for the post (mirrors the jam reaction menu).
24
20
  */
25
21
  export const ReactionPicker = ({
26
22
  myReactions,
23
+ reactions,
27
24
  onToggle,
28
- onClose,
29
25
  }: ReactionPickerProps) => {
30
26
  const { t } = useTranslation();
31
-
27
+ const orphans = myReactions.filter(
28
+ (reaction) => !reactions.includes(reaction)
29
+ );
32
30
  return (
33
31
  <View className="flex-row items-center gap-1">
34
- {REACTION_TYPES.map((reaction) => (
35
- <Pressable
32
+ {reactions.map((reaction) => (
33
+ <ReactionButton
36
34
  key={reaction}
37
- accessibilityRole="button"
38
- accessibilityLabel={reaction}
35
+ reaction={reaction}
36
+ active={myReactions.includes(reaction)}
39
37
  onPress={() => onToggle(reaction)}
40
- className={cn(
41
- 'shrink-0 rounded-md p-2',
42
- myReactions.includes(reaction) && 'bg-border'
43
- )}
44
- >
45
- <ThemedText className="text-lg">{reaction}</ThemedText>
46
- </Pressable>
38
+ />
47
39
  ))}
48
- <Pressable
49
- accessibilityRole="button"
50
- accessibilityLabel={t('posts.actions.closeReactionPicker')}
51
- onPress={onClose}
52
- className="shrink-0 rounded-md p-2"
53
- >
54
- <XIcon size={16} className="text-muted-foreground" />
55
- </Pressable>
40
+ {orphans.length > 0 ? (
41
+ <>
42
+ <View className="mx-1 h-8 w-px shrink-0 bg-border" />
43
+ {orphans.map((reaction) => (
44
+ <ReactionButton
45
+ key={reaction}
46
+ reaction={reaction}
47
+ orphan
48
+ active
49
+ title={t('posts.actions.orphanedReaction')}
50
+ onPress={() => onToggle(reaction)}
51
+ />
52
+ ))}
53
+ </>
54
+ ) : null}
56
55
  </View>
57
56
  );
58
57
  };
@@ -19,6 +19,7 @@ export * from './PostInfoHeader';
19
19
  export * from './PostMenu';
20
20
  export * from './PostReactionHeader';
21
21
  export * from './ReactionPicker';
22
+ export * from './ReactionButton';
22
23
  export * from './ShareMenu';
23
24
  export * from './UnreadPostIndicator';
24
25
  export * from './VideoPlayer';
@@ -344,7 +344,12 @@ export const EventForm = ({
344
344
 
345
345
  <SectionTitle>{t('events.form.location')}</SectionTitle>
346
346
 
347
- <EventTypeSwitcher event={event} isEdit={isEdit} onChange={setEvent} />
347
+ <EventTypeSwitcher
348
+ event={event}
349
+ isEdit={isEdit}
350
+ onChange={setEvent}
351
+ visibility={postData.visibility}
352
+ />
348
353
 
349
354
  <SectionTitle>{t('events.form.people')}</SectionTitle>
350
355