Skip to content

Commit 3874970

Browse files
committed
fix: rounding errors and unnecessary width enforcing
1 parent ae73857 commit 3874970

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const SwipableMessageBubble = React.memo(
107107

108108
const setMessageContentWidth = useStableCallback((valueOrCallback: SetStateAction<number>) => {
109109
if (typeof valueOrCallback === 'number') {
110-
props.setMessageContentWidth(Math.round(valueOrCallback));
110+
props.setMessageContentWidth(Math.ceil(valueOrCallback));
111111
return;
112112
}
113113
props.setMessageContentWidth(valueOrCallback);
@@ -175,13 +175,13 @@ export const SwipableMessageBubble = React.memo(
175175
);
176176
}),
177177
[
178-
isSwiping,
179178
messageSwipeToReplyHitSlop,
180-
onSwipe,
181179
touchStart,
180+
isSwiping,
181+
shouldRenderSwipeableWrapper,
182182
translateX,
183+
onSwipe,
183184
triggerHaptic,
184-
shouldRenderSwipeableWrapper,
185185
],
186186
);
187187

@@ -200,7 +200,9 @@ export const SwipableMessageBubble = React.memo(
200200
style={[
201201
styles.contentWrapper,
202202
contentWrapper,
203-
props.messageContentWidth > 0 ? { width: props.messageContentWidth } : {},
203+
props.messageContentWidth > 0 && shouldRenderAnimatedWrapper
204+
? { width: props.messageContentWidth }
205+
: {},
204206
]}
205207
>
206208
{shouldRenderAnimatedWrapper ? (

0 commit comments

Comments
 (0)