diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js index 6e4da80afbf..e897e13d0b9 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} diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js index 7573f86fc06..644b28ce371 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) +