Skip to content

Commit 71fbcd2

Browse files
committed
chore: remove profiler
1 parent 3462555 commit 71fbcd2

File tree

1 file changed

+68
-84
lines changed

1 file changed

+68
-84
lines changed

package/src/components/Message/Message.tsx

Lines changed: 68 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Profiler, useEffect, useMemo, useRef, useState } from 'react';
1+
import React, { useEffect, useMemo, useRef, useState } from 'react';
22
import {
33
GestureResponderEvent,
44
I18nManager,
@@ -849,92 +849,76 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
849849
}
850850

851851
return (
852-
<Profiler
853-
id={`Message:${message.id ?? 'unknown'}`}
854-
onRender={(id, phase, actualDuration, baseDuration, startTime, commitTime) => {
855-
console.log('[MessageProfiler]', {
856-
actualDuration,
857-
baseDuration,
858-
commitTime,
859-
id,
860-
messageId: message.id,
861-
overlayActive,
862-
phase,
863-
startTime,
864-
});
865-
}}
866-
>
867-
<MessageProvider value={messageContext}>
868-
<MessageOverlayRuntimeProvider value={messageOverlayRuntimeContext}>
869-
<View style={[style, styles.wrapper]} testID='message-wrapper'>
870-
{/*TODO: V9: Find a way to separate these in a dedicated file*/}
871-
<Portal hostName={overlayActive && rect ? 'top-item' : undefined}>
872-
{overlayActive && rect && overlayItemsAnchorRect ? (
873-
<View
874-
onLayout={(e) => {
875-
const { width: w, height: h } = e.nativeEvent.layout;
876-
877-
setOverlayTopH({
878-
h,
879-
w,
880-
x:
881-
overlayItemAlignment === 'right'
882-
? overlayItemsAnchorRect.x + overlayItemsAnchorRect.w - w
883-
: overlayItemsAnchorRect.x,
884-
y: rect.y - h,
885-
});
886-
}}
887-
>
888-
<MessageReactionPicker
889-
dismissOverlay={dismissOverlay}
890-
handleReaction={ownCapabilities.sendReaction ? handleReaction : undefined}
891-
/>
892-
</View>
893-
) : null}
894-
</Portal>
895-
<MessageOverlayWrapper targetId={DEFAULT_MESSAGE_OVERLAY_TARGET_ID}>
896-
<MessageItemView />
897-
</MessageOverlayWrapper>
898-
{showMessageReactions ? (
899-
<BottomSheetModal
900-
lazy={true}
901-
onClose={() => setShowMessageReactions(false)}
902-
visible={showMessageReactions}
903-
height={424}
852+
<MessageProvider value={messageContext}>
853+
<MessageOverlayRuntimeProvider value={messageOverlayRuntimeContext}>
854+
<View style={[style, styles.wrapper]} testID='message-wrapper'>
855+
{/*TODO: V9: Find a way to separate these in a dedicated file*/}
856+
<Portal hostName={overlayActive && rect ? 'top-item' : undefined}>
857+
{overlayActive && rect && overlayItemsAnchorRect ? (
858+
<View
859+
onLayout={(e) => {
860+
const { width: w, height: h } = e.nativeEvent.layout;
861+
862+
setOverlayTopH({
863+
h,
864+
w,
865+
x:
866+
overlayItemAlignment === 'right'
867+
? overlayItemsAnchorRect.x + overlayItemsAnchorRect.w - w
868+
: overlayItemsAnchorRect.x,
869+
y: rect.y - h,
870+
});
871+
}}
904872
>
905-
<MessageUserReactions message={message} selectedReaction={selectedReaction} />
906-
</BottomSheetModal>
873+
<MessageReactionPicker
874+
dismissOverlay={dismissOverlay}
875+
handleReaction={ownCapabilities.sendReaction ? handleReaction : undefined}
876+
/>
877+
</View>
907878
) : null}
908-
<Portal hostName={overlayActive && rect ? 'bottom-item' : undefined}>
909-
{overlayActive && rect && overlayItemsAnchorRect ? (
910-
<View
911-
onLayout={(e) => {
912-
const { width: w, height: h } = e.nativeEvent.layout;
913-
setOverlayBottomH({
914-
h,
915-
w,
916-
x:
917-
overlayItemAlignment === 'right'
918-
? overlayItemsAnchorRect.x + overlayItemsAnchorRect.w - w
919-
: overlayItemsAnchorRect.x,
920-
y: rect.y + rect.h,
921-
});
922-
}}
923-
>
924-
<MessageActionList
925-
dismissOverlay={dismissOverlay}
926-
messageActions={messageActions}
927-
/>
928-
</View>
929-
) : null}
930-
</Portal>
931-
{isBounceDialogOpen ? (
932-
<MessageBounce setIsBounceDialogOpen={setIsBounceDialogOpen} />
879+
</Portal>
880+
<MessageOverlayWrapper targetId={DEFAULT_MESSAGE_OVERLAY_TARGET_ID}>
881+
<MessageItemView />
882+
</MessageOverlayWrapper>
883+
{showMessageReactions ? (
884+
<BottomSheetModal
885+
lazy={true}
886+
onClose={() => setShowMessageReactions(false)}
887+
visible={showMessageReactions}
888+
height={424}
889+
>
890+
<MessageUserReactions message={message} selectedReaction={selectedReaction} />
891+
</BottomSheetModal>
892+
) : null}
893+
<Portal hostName={overlayActive && rect ? 'bottom-item' : undefined}>
894+
{overlayActive && rect && overlayItemsAnchorRect ? (
895+
<View
896+
onLayout={(e) => {
897+
const { width: w, height: h } = e.nativeEvent.layout;
898+
setOverlayBottomH({
899+
h,
900+
w,
901+
x:
902+
overlayItemAlignment === 'right'
903+
? overlayItemsAnchorRect.x + overlayItemsAnchorRect.w - w
904+
: overlayItemsAnchorRect.x,
905+
y: rect.y + rect.h,
906+
});
907+
}}
908+
>
909+
<MessageActionList
910+
dismissOverlay={dismissOverlay}
911+
messageActions={messageActions}
912+
/>
913+
</View>
933914
) : null}
934-
</View>
935-
</MessageOverlayRuntimeProvider>
936-
</MessageProvider>
937-
</Profiler>
915+
</Portal>
916+
{isBounceDialogOpen ? (
917+
<MessageBounce setIsBounceDialogOpen={setIsBounceDialogOpen} />
918+
) : null}
919+
</View>
920+
</MessageOverlayRuntimeProvider>
921+
</MessageProvider>
938922
);
939923
};
940924

0 commit comments

Comments
 (0)