From 60f43e8d6be6fe3c5a758f061a629d53c4fd60a7 Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Fri, 20 Feb 2026 02:18:04 -0800 Subject: [PATCH 1/3] Migrate LogBoxButton to Flow component syntax (#55620) Summary: Migrate LogBoxButton from function component to Flow component syntax. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D93743230 --- .../Libraries/LogBox/UI/LogBoxButton.js | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js index 6e4da80afbf7..e897e13d0b93 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js @@ -19,7 +19,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; -type Props = Readonly<{ +component LogBoxButton( id?: string, backgroundColor: Readonly<{ default: string, @@ -29,14 +29,12 @@ type Props = Readonly<{ hitSlop?: ?EdgeInsetsProp, onPress?: ?(event: GestureResponderEvent) => void, style?: ViewStyleProp, -}>; - -function LogBoxButton(props: Props): React.Node { +) { const [pressed, setPressed] = useState(false); - let backgroundColor = props.backgroundColor; - if (!backgroundColor) { - backgroundColor = { + let resolvedBackgroundColor = backgroundColor; + if (!resolvedBackgroundColor) { + resolvedBackgroundColor = { default: LogBoxStyle.getBackgroundColor(0.95), pressed: LogBoxStyle.getBackgroundColor(0.6), }; @@ -44,25 +42,25 @@ function LogBoxButton(props: Props): React.Node { const content = ( - {props.children} + {children} ); - return props.onPress == null ? ( + return onPress == null ? ( content ) : ( setPressed(true)} onPressOut={() => setPressed(false)}> {content} From 052e932b12e5162c6c051d0e788a84d4f9df1e0f Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Fri, 20 Feb 2026 02:18:04 -0800 Subject: [PATCH 2/3] Migrate LogBoxInspectorStackFrame to Flow component syntax (#55621) Summary: Migrate LogBoxInspectorStackFrame from function component to Flow component syntax. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D93743228 --- .../Libraries/LogBox/UI/LogBoxInspectorStackFrame.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js index 7573f86fc06b..644b28ce3714 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js @@ -19,13 +19,10 @@ import LogBoxButton from './LogBoxButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = Readonly<{ +component LogBoxInspectorStackFrame( frame: StackFrame, onPress?: ?(event: GestureResponderEvent) => void, -}>; - -function LogBoxInspectorStackFrame(props: Props): React.Node { - const {frame, onPress} = props; +) { const column = frame.column != null && parseInt(frame.column, 10); const location = getFileName(frame.file) + From 6ec3aef054432ed0c6cc10a43470933deaa70b01 Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Fri, 20 Feb 2026 02:18:04 -0800 Subject: [PATCH 3/3] Migrate LogBoxInspectorSourceMapStatus to Flow component syntax (#55622) Summary: Migrate LogBoxInspectorSourceMapStatus from function component to Flow component syntax. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D93743232 --- .../UI/LogBoxInspectorSourceMapStatus.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js index 96e93c500e22..5351316fc12e 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js @@ -19,19 +19,17 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useEffect, useState} from 'react'; -type Props = Readonly<{ +component LogBoxInspectorSourceMapStatus( onPress?: ?(event: GestureResponderEvent) => void, status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING', -}>; - -function LogBoxInspectorSourceMapStatus(props: Props): React.Node { +) { const [state, setState] = useState({ animation: null, rotate: null, }); useEffect(() => { - if (props.status === 'PENDING') { + if (status === 'PENDING') { if (state.animation == null) { const animated = new Animated.Value(0); const animation = Animated.loop( @@ -67,11 +65,11 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node { state.animation.stop(); } }; - }, [props.status, state.animation]); + }, [status, state.animation]); let image; let color; - switch (props.status) { + switch (status) { case 'FAILED': image = require('./LogBoxImages/alert-triangle.png'); color = LogBoxStyle.getErrorColor(1); @@ -82,7 +80,7 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node { break; } - if (props.status === 'COMPLETE' || image == null) { + if (status === 'COMPLETE' || image == null) { return null; } @@ -93,14 +91,14 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node { pressed: LogBoxStyle.getBackgroundColor(1), }} hitSlop={{bottom: 8, left: 8, right: 8, top: 8}} - onPress={props.onPress} + onPress={onPress} style={styles.root}>