From 16efb8dd520b752eb04c2807583fa1f4df279966 Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Tue, 9 Feb 2021 11:57:31 -0800 Subject: [PATCH] Render test titles and standardize on output Summary: Changelog: [General][Added] - Show a test title if set and standardize the output Note this will break existing screenshot tests so will need to re-run these Reviewed By: nadiia Differential Revision: D26318844 fbshipit-source-id: cef48d72a524ccc6f32b9d930c68fe4171270365 --- .../js/components/RNTesterExampleContainer.js | 2 +- .../SectionList/SectionListExamples.js | 30 ++++++++++--------- .../SectionList/SectionList_onEndReached.js | 6 ++-- .../SectionList_onViewableItemsChanged.js | 4 ++- packages/rn-tester/js/types/RNTesterTypes.js | 1 + 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/packages/rn-tester/js/components/RNTesterExampleContainer.js b/packages/rn-tester/js/components/RNTesterExampleContainer.js index ad2501c3111..744c4bb89a9 100644 --- a/packages/rn-tester/js/components/RNTesterExampleContainer.js +++ b/packages/rn-tester/js/components/RNTesterExampleContainer.js @@ -55,7 +55,7 @@ class RNTesterExampleContainer extends React.Component { if (module.examples.length === 1) { return ( {}, + onTest: null, }; case 'onEndReached': @@ -71,7 +71,7 @@ function getExample(example, output, ref) { onEndReached: info => output('onEndReached'), onEndReachedThreshold: 0, }, - startTest: () => { + onTest: () => { const scrollResponder = ref?.current?.getScrollResponder(); if (scrollResponder != null) { scrollResponder.scrollToEnd(); @@ -86,18 +86,14 @@ function getExample(example, output, ref) { function SectionListExamples(props: Props): React.Node { const [output, setOutput] = React.useState(''); const ref = React.useRef>(); - const {startTest, props: testProps} = getExample( - props.example, - setOutput, - ref, - ); + const {onTest, props: testProps} = getExample(props.example, setOutput, ref); return ( - + {output} - - Test - + {onTest != null ? ( +