Skip to content

Commit 51dab21

Browse files
fabriziocuccifacebook-github-bot
authored andcommitted
Migrate LogBoxInspectorMessageHeader to Flow component syntax
Summary: Migrate LogBoxInspectorMessageHeader from function component to Flow component syntax. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D93743229
1 parent 5e0a9e8 commit 51dab21

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,21 @@ import LogBoxMessage from './LogBoxMessage';
1818
import * as LogBoxStyle from './LogBoxStyle';
1919
import * as React from 'react';
2020

21-
type Props = Readonly<{
21+
const SHOW_MORE_MESSAGE_LENGTH = 300;
22+
23+
component LogBoxInspectorMessageHeader(
2224
collapsed: boolean,
2325
message: Message,
2426
level: LogLevel,
2527
title: string,
2628
onPress: () => void,
27-
}>;
28-
29-
const SHOW_MORE_MESSAGE_LENGTH = 300;
30-
31-
function LogBoxInspectorMessageHeader(props: Props): React.Node {
29+
) {
3230
function renderShowMore() {
33-
if (
34-
props.message.content.length < SHOW_MORE_MESSAGE_LENGTH ||
35-
!props.collapsed
36-
) {
31+
if (message.content.length < SHOW_MORE_MESSAGE_LENGTH || !collapsed) {
3732
return null;
3833
}
3934
return (
40-
<Text style={messageStyles.collapse} onPress={() => props.onPress()}>
35+
<Text style={messageStyles.collapse} onPress={() => onPress()}>
4136
... See More
4237
</Text>
4338
);
@@ -47,15 +42,15 @@ function LogBoxInspectorMessageHeader(props: Props): React.Node {
4742
<View style={messageStyles.body}>
4843
<View style={messageStyles.heading}>
4944
<Text
50-
style={[messageStyles.headingText, messageStyles[props.level]]}
45+
style={[messageStyles.headingText, messageStyles[level]]}
5146
id="logbox_message_title_text">
52-
{props.title}
47+
{title}
5348
</Text>
5449
</View>
5550
<Text style={messageStyles.bodyText} id="logbox_message_contents_text">
5651
<LogBoxMessage
57-
maxLength={props.collapsed ? SHOW_MORE_MESSAGE_LENGTH : Infinity}
58-
message={props.message}
52+
maxLength={collapsed ? SHOW_MORE_MESSAGE_LENGTH : Infinity}
53+
message={message}
5954
style={messageStyles.messageText}
6055
/>
6156
{renderShowMore()}

0 commit comments

Comments
 (0)