diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js index 110e411b62a62b..ae6ddbc551ff34 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js @@ -9,40 +9,37 @@ */ import Keyboard from '../../Components/Keyboard/Keyboard'; -import ScrollView from '../../Components/ScrollView/ScrollView'; import View from '../../Components/View/View'; import StyleSheet from '../../StyleSheet/StyleSheet'; import * as LogBoxData from '../Data/LogBoxData'; import LogBoxLog, {type LogLevel} from '../Data/LogBoxLog'; -import LogBoxInspectorCodeFrame from './LogBoxInspectorCodeFrame'; +import LogBoxInspectorBody from './LogBoxInspectorBody'; import LogBoxInspectorFooter from './LogBoxInspectorFooter'; import LogBoxInspectorHeader from './LogBoxInspectorHeader'; -import LogBoxInspectorMessageHeader from './LogBoxInspectorMessageHeader'; -import LogBoxInspectorReactFrames from './LogBoxInspectorReactFrames'; -import LogBoxInspectorStackFrames from './LogBoxInspectorStackFrames'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; +import {useEffect} from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ onDismiss: () => void, onChangeSelectedIndex: (index: number) => void, onMinimize: () => void, logs: $ReadOnlyArray, selectedIndex: number, fatalType?: ?LogLevel, -|}>; +}>; -function LogBoxInspector(props: Props): React.Node { +export default function LogBoxInspector(props: Props): React.Node { const {logs, selectedIndex} = props; let log = logs[selectedIndex]; - React.useEffect(() => { + useEffect(() => { if (log) { LogBoxData.symbolicateLogNow(log); } }, [log]); - React.useEffect(() => { + useEffect(() => { // Optimistically symbolicate the last and next logs. if (logs.length > 1) { const selected = selectedIndex; @@ -54,7 +51,7 @@ function LogBoxInspector(props: Props): React.Node { } }, [logs, selectedIndex]); - React.useEffect(() => { + useEffect(() => { Keyboard.dismiss(); }, []); @@ -84,68 +81,9 @@ function LogBoxInspector(props: Props): React.Node { ); } -const headerTitleMap = { - warn: 'Console Warning', - error: 'Console Error', - fatal: 'Uncaught Error', - syntax: 'Syntax Error', - component: 'Render Error', -}; - -function LogBoxInspectorBody(props: {log: LogBoxLog, onRetry: () => void}) { - const [collapsed, setCollapsed] = React.useState(true); - - React.useEffect(() => { - setCollapsed(true); - }, [props.log]); - - const headerTitle = - props.log.type ?? - headerTitleMap[props.log.isComponentError ? 'component' : props.log.level]; - - if (collapsed) { - return ( - <> - setCollapsed(!collapsed)} - message={props.log.message} - level={props.log.level} - title={headerTitle} - /> - - - - - - - ); - } - return ( - - setCollapsed(!collapsed)} - message={props.log.message} - level={props.log.level} - title={headerTitle} - /> - - - - - ); -} - const styles = StyleSheet.create({ root: { flex: 1, backgroundColor: LogBoxStyle.getTextColor(), }, - scrollBody: { - backgroundColor: LogBoxStyle.getBackgroundColor(0.9), - flex: 1, - }, }); - -export default LogBoxInspector; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorBody.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorBody.js new file mode 100644 index 00000000000000..65af7fb2cdde38 --- /dev/null +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorBody.js @@ -0,0 +1,87 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import ScrollView from '../../Components/ScrollView/ScrollView'; +import StyleSheet from '../../StyleSheet/StyleSheet'; +import LogBoxLog from '../Data/LogBoxLog'; +import LogBoxInspectorCodeFrame from './LogBoxInspectorCodeFrame'; +import LogBoxInspectorMessageHeader from './LogBoxInspectorMessageHeader'; +import LogBoxInspectorReactFrames from './LogBoxInspectorReactFrames'; +import LogBoxInspectorStackFrames from './LogBoxInspectorStackFrames'; +import * as LogBoxStyle from './LogBoxStyle'; +import * as React from 'react'; +import {useEffect, useState} from 'react'; + +const headerTitleMap = { + warn: 'Console Warning', + error: 'Console Error', + fatal: 'Uncaught Error', + syntax: 'Syntax Error', + component: 'Render Error', +}; + +export default function LogBoxInspectorBody(props: { + log: LogBoxLog, + onRetry: () => void, +}): React.Node { + const [collapsed, setCollapsed] = useState(true); + + useEffect(() => { + setCollapsed(true); + }, [props.log]); + + const headerTitle = + props.log.type ?? + headerTitleMap[props.log.isComponentError ? 'component' : props.log.level]; + + if (collapsed) { + return ( + <> + setCollapsed(!collapsed)} + message={props.log.message} + level={props.log.level} + title={headerTitle} + /> + + + + + + + ); + } + return ( + + setCollapsed(!collapsed)} + message={props.log.message} + level={props.log.level} + title={headerTitle} + /> + + + + + ); +} + +const styles = StyleSheet.create({ + root: { + flex: 1, + backgroundColor: LogBoxStyle.getTextColor(), + }, + scrollBody: { + backgroundColor: LogBoxStyle.getBackgroundColor(0.9), + flex: 1, + }, +}); diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js index 44d344f0334aa5..4100fb4a414933 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js @@ -10,21 +10,20 @@ import type {LogLevel} from '../Data/LogBoxLog'; -import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView'; import View from '../../Components/View/View'; import StyleSheet from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; -import LogBoxButton from './LogBoxButton'; +import LogBoxInspectorFooterButton from './LogBoxInspectorFooterButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| +type Props = $ReadOnly<{ onDismiss: () => void, onMinimize: () => void, level?: ?LogLevel, -|}>; +}>; -function LogBoxInspectorFooter(props: Props): React.Node { +export default function LogBoxInspectorFooter(props: Props): React.Node { if (props.level === 'syntax') { return ( @@ -39,34 +38,12 @@ function LogBoxInspectorFooter(props: Props): React.Node { return ( - - + + ); } -type ButtonProps = $ReadOnly<{| - onPress: () => void, - text: string, -|}>; - -function FooterButton(props: ButtonProps): React.Node { - return ( - - - - {props.text} - - - - ); -} - const styles = StyleSheet.create({ root: { backgroundColor: LogBoxStyle.getBackgroundColor(1), @@ -79,17 +56,6 @@ const styles = StyleSheet.create({ button: { flex: 1, }, - buttonContent: { - alignItems: 'center', - height: 48, - justifyContent: 'center', - }, - buttonLabel: { - color: LogBoxStyle.getTextColor(1), - fontSize: 14, - includeFontPadding: false, - lineHeight: 20, - }, syntaxErrorText: { textAlign: 'center', width: '100%', @@ -102,5 +68,3 @@ const styles = StyleSheet.create({ color: LogBoxStyle.getTextColor(0.6), }, }); - -export default LogBoxInspectorFooter; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js new file mode 100644 index 00000000000000..d2208c773e2af4 --- /dev/null +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js @@ -0,0 +1,58 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView'; +import View from '../../Components/View/View'; +import StyleSheet from '../../StyleSheet/StyleSheet'; +import Text from '../../Text/Text'; +import LogBoxButton from './LogBoxButton'; +import * as LogBoxStyle from './LogBoxStyle'; +import * as React from 'react'; + +type ButtonProps = $ReadOnly<{ + onPress: () => void, + text: string, +}>; + +export default function LogBoxInspectorFooterButton( + props: ButtonProps, +): React.Node { + return ( + + + + {props.text} + + + + ); +} + +const styles = StyleSheet.create({ + button: { + flex: 1, + }, + buttonContent: { + alignItems: 'center', + height: 48, + justifyContent: 'center', + }, + buttonLabel: { + color: LogBoxStyle.getTextColor(1), + fontSize: 14, + includeFontPadding: false, + lineHeight: 20, + }, +}); diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js index 1f578db82f0f26..0f5d270aa3f8a6 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js @@ -8,26 +8,25 @@ * @format */ -import type {ImageSource} from '../../Image/ImageSource'; import type {LogLevel} from '../Data/LogBoxLog'; import StatusBar from '../../Components/StatusBar/StatusBar'; import View from '../../Components/View/View'; -import Image from '../../Image/Image'; import StyleSheet from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; import Platform from '../../Utilities/Platform'; -import LogBoxButton from './LogBoxButton'; +import LogBoxInspectorHeaderButton from './LogBoxInspectorHeaderButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{| + +type Props = $ReadOnly<{ onSelectIndex: (selectedIndex: number) => void, selectedIndex: number, total: number, level: LogLevel, -|}>; +}>; -function LogBoxInspectorHeader(props: Props): React.Node { +export default function LogBoxInspectorHeader(props: Props): React.Node { if (props.level === 'syntax') { return ( @@ -70,64 +69,6 @@ function LogBoxInspectorHeader(props: Props): React.Node { ); } -const backgroundForLevel = (level: LogLevel) => - ({ - warn: { - default: 'transparent', - pressed: LogBoxStyle.getWarningDarkColor(), - }, - error: { - default: 'transparent', - pressed: LogBoxStyle.getErrorDarkColor(), - }, - fatal: { - default: 'transparent', - pressed: LogBoxStyle.getFatalDarkColor(), - }, - syntax: { - default: 'transparent', - pressed: LogBoxStyle.getFatalDarkColor(), - }, - })[level]; - -function LogBoxInspectorHeaderButton( - props: $ReadOnly<{| - disabled: boolean, - image: ImageSource, - level: LogLevel, - onPress?: ?() => void, - |}>, -): React.Node { - return ( - - {props.disabled ? null : ( - - )} - - ); -} - -const headerStyles = StyleSheet.create({ - button: { - alignItems: 'center', - aspectRatio: 1, - justifyContent: 'center', - marginTop: 5, - marginRight: 6, - marginLeft: 6, - marginBottom: -8, - borderRadius: 3, - }, - buttonImage: { - height: 14, - width: 8, - tintColor: LogBoxStyle.getTextColor(), - }, -}); - const styles = StyleSheet.create({ syntax: { backgroundColor: LogBoxStyle.getFatalColor(), @@ -164,5 +105,3 @@ const styles = StyleSheet.create({ paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 40, }, }); - -export default LogBoxInspectorHeader; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js new file mode 100644 index 00000000000000..73270c0319a9c5 --- /dev/null +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js @@ -0,0 +1,76 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import type {ImageSource} from '../../Image/ImageSource'; +import type {LogLevel} from '../Data/LogBoxLog'; + +import Image from '../../Image/Image'; +import StyleSheet from '../../StyleSheet/StyleSheet'; +import LogBoxButton from './LogBoxButton'; +import * as LogBoxStyle from './LogBoxStyle'; +import * as React from 'react'; + +const backgroundForLevel = (level: LogLevel) => + ({ + warn: { + default: 'transparent', + pressed: LogBoxStyle.getWarningDarkColor(), + }, + error: { + default: 'transparent', + pressed: LogBoxStyle.getErrorDarkColor(), + }, + fatal: { + default: 'transparent', + pressed: LogBoxStyle.getFatalDarkColor(), + }, + syntax: { + default: 'transparent', + pressed: LogBoxStyle.getFatalDarkColor(), + }, + })[level]; + +export default function LogBoxInspectorHeaderButton( + props: $ReadOnly<{ + disabled: boolean, + image: ImageSource, + level: LogLevel, + onPress?: ?() => void, + }>, +): React.Node { + return ( + + {props.disabled ? null : ( + + )} + + ); +} + +const styles = StyleSheet.create({ + button: { + alignItems: 'center', + aspectRatio: 1, + justifyContent: 'center', + marginTop: 5, + marginRight: 6, + marginLeft: 6, + marginBottom: -8, + borderRadius: 3, + }, + buttonImage: { + height: 14, + width: 8, + tintColor: LogBoxStyle.getTextColor(), + }, +}); diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxButton-test.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxButton-test.js index f5f6c972d3c43f..797ccde3f230ef 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxButton-test.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxButton-test.js @@ -15,9 +15,16 @@ const render = require('../../../../jest/renderer'); const LogBoxButton = require('../LogBoxButton').default; const React = require('react'); +// Mock `TouchableWithoutFeedback` because we are interested in snapshotting the +// behavior of `LogBoxButton`, not `TouchableWithoutFeedback`. +jest.mock('../../../Components/Touchable/TouchableWithoutFeedback', () => ({ + __esModule: true, + default: 'TouchableWithoutFeedback', +})); + describe('LogBoxButton', () => { it('should render only a view without an onPress', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render TouchableWithoutFeedback and pass through props', () => { - const output = render.shallowRender( + const output = render.create( ({ + __esModule: true, + default: 'LogBoxInspectorBody', +})); +jest.mock('../LogBoxInspectorFooter', () => ({ + __esModule: true, + default: 'LogBoxInspectorFooter', +})); +jest.mock('../LogBoxInspectorHeader', () => ({ + __esModule: true, + default: 'LogBoxInspectorHeader', +})); + const logs = [ new LogBoxLog({ level: 'warn', @@ -54,7 +69,7 @@ const logs = [ describe('LogBoxContainer', () => { it('should render null with no logs', () => { - const output = render.shallowRender( + const output = render.create( {}} onMinimize={() => {}} @@ -68,7 +83,7 @@ describe('LogBoxContainer', () => { }); it('should render warning with selectedIndex 0', () => { - const output = render.shallowRender( + const output = render.create( {}} onMinimize={() => {}} @@ -82,7 +97,7 @@ describe('LogBoxContainer', () => { }); it('should render fatal with selectedIndex 2', () => { - const output = render.shallowRender( + const output = render.create( {}} onMinimize={() => {}} diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorCodeFrame-test.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorCodeFrame-test.js index 0d27cc4f5e31a4..7fd6c0872fb504 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorCodeFrame-test.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorCodeFrame-test.js @@ -15,17 +15,34 @@ const render = require('../../../../jest/renderer'); const LogBoxInspectorCodeFrame = require('../LogBoxInspectorCodeFrame').default; const React = require('react'); +// Mock child components because we are interested in snapshotting the behavior +// of `LogBoxInspectorCodeFrame`, not its children. +jest.mock('../../../Components/ScrollView/ScrollView', () => ({ + __esModule: true, + default: 'ScrollView', +})); +jest.mock('../AnsiHighlight', () => ({ + __esModule: true, + default: 'Ansi', +})); +jest.mock('../LogBoxButton', () => ({ + __esModule: true, + default: 'LogBoxButton', +})); +jest.mock('../LogBoxInspectorSection', () => ({ + __esModule: true, + default: 'LogBoxInspectorSection', +})); + describe('LogBoxInspectorCodeFrame', () => { it('should render null for no code frame', () => { - const output = render.shallowRender( - , - ); + const output = render.create(); expect(output).toMatchSnapshot(); }); it('should render a code frame', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render a code frame without a location', () => { - const output = render.shallowRender( + const output = render.create( ({ + __esModule: true, + default: 'LogBoxInspectorFooterButton', +})); + describe('LogBoxInspectorFooter', () => { it('should render two buttons for warning', () => { - const output = render.shallowRender( + const output = render.create( {}} onDismiss={() => {}} @@ -29,7 +36,7 @@ describe('LogBoxInspectorFooter', () => { }); it('should render two buttons for error', () => { - const output = render.shallowRender( + const output = render.create( {}} onDismiss={() => {}} @@ -41,7 +48,7 @@ describe('LogBoxInspectorFooter', () => { }); it('should render two buttons for fatal', () => { - const output = render.shallowRender( + const output = render.create( {}} onDismiss={() => {}} @@ -53,7 +60,7 @@ describe('LogBoxInspectorFooter', () => { }); it('should render no buttons and a message for syntax error', () => { - const output = render.shallowRender( + const output = render.create( {}} onDismiss={() => {}} diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-test.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-test.js index 3ea9f2392c5927..a16f1474b56c21 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-test.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorHeader-test.js @@ -15,9 +15,16 @@ const render = require('../../../../jest/renderer'); const LogBoxInspectorHeader = require('../LogBoxInspectorHeader').default; const React = require('react'); +// Mock `LogBoxInspectorHeaderButton` because we are interested in snapshotting +// the behavior of `LogBoxInspectorHeader`, not `LogBoxInspectorHeaderButton`. +jest.mock('../LogBoxInspectorHeaderButton', () => ({ + __esModule: true, + default: 'LogBoxInspectorHeaderButton', +})); + describe('LogBoxInspectorHeader', () => { it('should render no buttons for one total', () => { - const output = render.shallowRender( + const output = render.create( {}} selectedIndex={0} @@ -30,7 +37,7 @@ describe('LogBoxInspectorHeader', () => { }); it('should render both buttons for two total', () => { - const output = render.shallowRender( + const output = render.create( {}} selectedIndex={1} @@ -43,7 +50,7 @@ describe('LogBoxInspectorHeader', () => { }); it('should render two buttons for three or more total', () => { - const output = render.shallowRender( + const output = render.create( {}} selectedIndex={0} @@ -56,7 +63,7 @@ describe('LogBoxInspectorHeader', () => { }); it('should render syntax error header', () => { - const output = render.shallowRender( + const output = render.create( {}} selectedIndex={0} diff --git a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorMessageHeader-test.js b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorMessageHeader-test.js index 078f582015e23b..287b185dae5fe5 100644 --- a/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorMessageHeader-test.js +++ b/packages/react-native/Libraries/LogBox/UI/__tests__/LogBoxInspectorMessageHeader-test.js @@ -16,9 +16,16 @@ const LogBoxInspectorMessageHeader = require('../LogBoxInspectorMessageHeader').default; const React = require('react'); +// Mock `LogBoxMessage` because we are interested in snapshotting the +// behavior of `LogBoxInspectorMessageHeader`, not `LogBoxMessage`. +jest.mock('../LogBoxMessage', () => ({ + __esModule: true, + default: 'LogBoxMessage', +})); + describe('LogBoxInspectorMessageHeader', () => { it('should render error', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render fatal', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render syntax error', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should not render See More button for short content', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should not render "See More" if expanded', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render "See More" if collapsed', () => { - const output = render.shallowRender( + const output = render.create( - - @@ -87,11 +87,11 @@ exports[`LogBoxInspectorFooter should render two buttons for fatal 1`] = ` } } > - - @@ -114,11 +114,11 @@ exports[`LogBoxInspectorFooter should render two buttons for warning 1`] = ` } } > - - diff --git a/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js b/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js index 853954e6ebdfc5..8368411158f79b 100644 --- a/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js +++ b/packages/react-native/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js @@ -18,9 +18,16 @@ const { } = require('../LogBoxNotificationContainer'); const React = require('react'); +// Mock `LogBoxLogNotification` because we are interested in snapshotting the +// behavior of `LogBoxNotificationContainer`, not `LogBoxLogNotification`. +jest.mock('../UI/LogBoxNotification', () => ({ + __esModule: true, + default: 'LogBoxLogNotification', +})); + describe('LogBoxNotificationContainer', () => { it('should render null with no logs', () => { - const output = render.shallowRender( + const output = render.create( , ); @@ -28,7 +35,7 @@ describe('LogBoxNotificationContainer', () => { }); it('should render null with no selected log and disabled', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render the latest warning notification', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render the latest error notification', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render both an error and warning notification', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render selected fatal error even when disabled', () => { - const output = render.shallowRender( + const output = render.create( { }); it('should render selected syntax error even when disabled', () => { - const output = render.shallowRender( + const output = render.create( void, onChangeSelectedIndex: (index: number) => void, onMinimize: () => void, logs: $ReadOnlyArray, selectedIndex: number, fatalType?: ?LogLevel, -|}>; -declare function LogBoxInspector(props: Props): React.Node; -declare export default typeof LogBoxInspector; +}>; +declare export default function LogBoxInspector(props: Props): React.Node; +" +`; + +exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorBody.js 1`] = ` +"declare export default function LogBoxInspectorBody(props: { + log: LogBoxLog, + onRetry: () => void, +}): React.Node; " `; @@ -5546,25 +5553,46 @@ declare export default typeof LogBoxInspectorCodeFrame; `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorFooter.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ onDismiss: () => void, onMinimize: () => void, level?: ?LogLevel, -|}>; -declare function LogBoxInspectorFooter(props: Props): React.Node; -declare export default typeof LogBoxInspectorFooter; +}>; +declare export default function LogBoxInspectorFooter(props: Props): React.Node; +" +`; + +exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorFooterButton.js 1`] = ` +"type ButtonProps = $ReadOnly<{ + onPress: () => void, + text: string, +}>; +declare export default function LogBoxInspectorFooterButton( + props: ButtonProps +): React.Node; " `; exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorHeader.js 1`] = ` -"type Props = $ReadOnly<{| +"type Props = $ReadOnly<{ onSelectIndex: (selectedIndex: number) => void, selectedIndex: number, total: number, level: LogLevel, -|}>; -declare function LogBoxInspectorHeader(props: Props): React.Node; -declare export default typeof LogBoxInspectorHeader; +}>; +declare export default function LogBoxInspectorHeader(props: Props): React.Node; +" +`; + +exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js 1`] = ` +"declare export default function LogBoxInspectorHeaderButton( + props: $ReadOnly<{ + disabled: boolean, + image: ImageSource, + level: LogLevel, + onPress?: ?() => void, + }> +): React.Node; " `;