Skip to content

Commit 07d33a6

Browse files
committed
fix: remove Swipeable from hierarchy if the feature flag is false
1 parent 8b39d66 commit 07d33a6

File tree

1 file changed

+40
-44
lines changed

1 file changed

+40
-44
lines changed

package/src/components/Message/MessageSimple/MessageSimple.tsx

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -262,52 +262,48 @@ const MessageSimpleWithContext = <
262262
{message.pinned ? <MessagePinnedHeader /> : null}
263263
</View>
264264

265-
{alignment === 'left' ? (
266-
<Swipeable
267-
containerStyle={[styles.contentWrapper, contentWrapper]}
268-
friction={2}
269-
leftThreshold={100}
270-
onSwipeableWillOpen={() => {
271-
if (!swipeableRef.current) return;
272-
clearQuotedMessageState();
273-
setQuotedMessageState(message);
274-
triggerHaptic('impactLight');
275-
swipeableRef.current.close();
276-
}}
277-
ref={swipeableRef}
278-
renderLeftActions={() => {
279-
if (enableSwipeToReply) {
265+
{enableSwipeToReply ? (
266+
alignment === 'left' ? (
267+
<Swipeable
268+
containerStyle={[styles.contentWrapper, contentWrapper]}
269+
friction={2}
270+
leftThreshold={100}
271+
onSwipeableWillOpen={() => {
272+
if (!swipeableRef.current) return;
273+
clearQuotedMessageState();
274+
setQuotedMessageState(message);
275+
triggerHaptic('impactLight');
276+
swipeableRef.current.close();
277+
}}
278+
ref={swipeableRef}
279+
renderLeftActions={() => {
280280
return MessageSwipeContent ? <MessageSwipeContent /> : null;
281-
} else {
282-
return null;
283-
}
284-
}}
285-
>
286-
{renderMessageBubble}
287-
</Swipeable>
288-
) : (
289-
<Swipeable
290-
containerStyle={[styles.contentWrapper, contentWrapper]}
291-
friction={2}
292-
onSwipeableWillOpen={() => {
293-
if (!swipeableRef.current) return;
294-
clearQuotedMessageState();
295-
setQuotedMessageState(message);
296-
triggerHaptic('impactLight');
297-
swipeableRef.current.close();
298-
}}
299-
ref={swipeableRef}
300-
renderRightActions={() => {
301-
if (enableSwipeToReply) {
281+
}}
282+
>
283+
{renderMessageBubble}
284+
</Swipeable>
285+
) : (
286+
<Swipeable
287+
containerStyle={[styles.contentWrapper, contentWrapper]}
288+
friction={2}
289+
onSwipeableWillOpen={() => {
290+
if (!swipeableRef.current) return;
291+
clearQuotedMessageState();
292+
setQuotedMessageState(message);
293+
triggerHaptic('impactLight');
294+
swipeableRef.current.close();
295+
}}
296+
ref={swipeableRef}
297+
renderRightActions={() => {
302298
return MessageSwipeContent ? <MessageSwipeContent /> : null;
303-
} else {
304-
return null;
305-
}
306-
}}
307-
rightThreshold={100}
308-
>
309-
{renderMessageBubble}
310-
</Swipeable>
299+
}}
300+
rightThreshold={100}
301+
>
302+
{renderMessageBubble}
303+
</Swipeable>
304+
)
305+
) : (
306+
renderMessageBubble
311307
)}
312308

313309
{reactionListPosition === 'bottom' && ReactionListBottom ? <ReactionListBottom /> : null}

0 commit comments

Comments
 (0)