From 8bb0a9f9c9cafc4b0f67f111917e0f26e2fde46c Mon Sep 17 00:00:00 2001 From: Vincent Riemer Date: Fri, 8 Jul 2022 13:33:04 -0700 Subject: [PATCH] Create more mobile-friendly version of the platform test results UI Summary: Changelog: [RNTester][Internal] - Create more mobile-friendly version of the platform test results UI The original UI design for displaying the test results was done with only really tablets in mind so in order to better accomidate mobile screen sizes this diff adds a new expanding UI for the test results. Reviewed By: lunaleaps Differential Revision: D37701638 fbshipit-source-id: a1789abb15db7ab162fe90afc32d23c435f1bdb5 --- .../PlatformTest/RNTesterPlatformTest.js | 30 ++-- ...RNTesterPlatformTestMinimizedResultView.js | 96 ++++++++++ .../RNTesterPlatformTestResultView.js | 167 ++++++++++++------ 3 files changed, 230 insertions(+), 63 deletions(-) create mode 100644 packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestMinimizedResultView.js diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js index 0e90e06987b1b1..92389f36b81288 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTest.js @@ -37,14 +37,18 @@ export default function RNTesterPlatformTest(props: Props): React.MixedElement { return ( - {title} - {description} - - - + + {title} + + {description} + + + + + void, + style?: ?ViewStyleProp, +|}>; +export default function RNTesterPlatformTestMinimizedResultView({ + numFail, + numError, + numPass, + numPending, + onPress, + style, +}: Props): React.MixedElement { + return ( + + + + + {numPass} Pass + + + {numFail} Fail + + + {numError} Error + + + {numPending} Pending + + + + + + ); +} + +const styles = StyleSheet.create({ + caret: { + fontSize: 24, + transform: [{translateY: 4}], + marginEnd: 8, + opacity: 0.5, + }, + errorText: { + color: 'orange', + }, + failText: { + color: 'red', + }, + innerContainer: { + width: '100%', + height: '100%', + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + paddingHorizontal: 8, + backgroundColor: 'white', + }, + passText: { + color: 'green', + }, + pendingText: { + color: 'gray', + }, + root: { + borderTopColor: 'rgb(171, 171, 171)', + borderTopWidth: StyleSheet.hairlineWidth, + minHeight: 60, + }, + statsContainer: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'flex-start', + }, + summaryText: { + marginStart: 8, + }, +}); diff --git a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js index 590d49d40caf33..fbe4696c7bb0c9 100644 --- a/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js +++ b/packages/rn-tester/js/examples/Experimental/PlatformTest/RNTesterPlatformTestResultView.js @@ -18,6 +18,8 @@ import type { PlatformTestResultStatus, } from './RNTesterPlatformTestTypes'; +import RNTesterPlatformTestMinimizedResultView from './RNTesterPlatformTestMinimizedResultView'; + import * as React from 'react'; import {useMemo, useState, useCallback} from 'react'; import { @@ -31,6 +33,7 @@ import { TextInput, KeyboardAvoidingView, Platform, + TouchableOpacity, } from 'react-native'; const DISPLAY_STATUS_MAPPING: {[PlatformTestResultStatus]: string} = { @@ -202,62 +205,96 @@ export default function RNTesterPlatformTestResultView( [filteredResults], ); + const [resultsExpanded, setResultsExpanded] = useState(false); + const handleReset = useCallback(() => { setFilterText(''); reset(); + setResultsExpanded(false); }, [reset]); + const handleMinimizedPress = useCallback(() => { + setResultsExpanded(true); + }, []); + + const handleMaximizedPress = useCallback(() => { + setResultsExpanded(false); + }, []); + return ( - - - - Results - {filterText !== '' ? ( - <> - {' '} - - (Filtered: '{filterText}') + <> + + + + + + Results + {filterText !== '' ? ( + + (Filtered: '{filterText}') + + ) : null} + + + {numPass} Pass + + {' '} + + {numFail} Fail + + {' '} + + {numError} Error + + {numPending > 0 ? ( + <> + {' '} + + {numPending}{' '} + Pending + + + ) : null} - - ) : null} - - - - -