From b36c081da76ddbb89d954f345c89063249c76886 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Tue, 17 Jan 2023 11:19:56 -0800 Subject: [PATCH 1/4] remove the prop logDetail --- src/libs/Navigation/AppNavigator/MainDrawerNavigator.js | 2 +- src/libs/Navigation/NavigationRoot.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js index f08cd7959e2c..ecc67769e8b8 100644 --- a/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js +++ b/src/libs/Navigation/AppNavigator/MainDrawerNavigator.js @@ -73,7 +73,7 @@ class MainDrawerNavigator extends Component { render() { // Wait until reports are fetched and there is a reportID in initialParams if (!this.initialParams.reportID) { - return ; + return ; } // After the app initializes and reports are available the home navigation is mounted diff --git a/src/libs/Navigation/NavigationRoot.js b/src/libs/Navigation/NavigationRoot.js index 0e0958e8a393..4b056a7cd7e8 100644 --- a/src/libs/Navigation/NavigationRoot.js +++ b/src/libs/Navigation/NavigationRoot.js @@ -61,7 +61,6 @@ const NavigationRoot = (props) => { )} From f7ec49ba1b48b5a2f930ce5ba494c5eada11290e Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Tue, 17 Jan 2023 11:20:17 -0800 Subject: [PATCH 2/4] remove the logic for logdetail --- src/CONST.js | 1 - src/components/FullscreenLoadingIndicator.js | 43 -------------------- 2 files changed, 44 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index fe10ef4496f6..46cd0e9e064e 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -375,7 +375,6 @@ const CONST = { REPORT_ACTION_ITEM_LAYOUT_DEBOUNCE_TIME: 1500, SHOW_LOADING_SPINNER_DEBOUNCE_TIME: 250, TOOLTIP_SENSE: 1000, - SPINNER_TIMEOUT: 15 * 1000, TRIE_INITIALIZATION: 'trie_initialization', }, PRIORITY_MODE: { diff --git a/src/components/FullscreenLoadingIndicator.js b/src/components/FullscreenLoadingIndicator.js index 4bf55d7a3921..5a6a62735810 100644 --- a/src/components/FullscreenLoadingIndicator.js +++ b/src/components/FullscreenLoadingIndicator.js @@ -1,63 +1,20 @@ import _ from 'underscore'; import React from 'react'; -import PropTypes from 'prop-types'; import {ActivityIndicator, StyleSheet, View} from 'react-native'; import styles from '../styles/styles'; import themeColors from '../styles/themes/default'; import stylePropTypes from '../styles/stylePropTypes'; -import Log from '../libs/Log'; -import CONST from '../CONST'; const propTypes = { - /** - * Context info printed in timing log. - * Providing this prop would capture logs for mounting/unmounting and staying visible for too long - */ - logDetail: PropTypes.shape({ - /** Name is used to distinct the loader in captured logs. */ - name: PropTypes.string.isRequired, - }), - /** Additional style props */ style: stylePropTypes, }; const defaultProps = { style: [], - logDetail: null, }; class FullScreenLoadingIndicator extends React.Component { - componentDidMount() { - if (!this.props.logDetail) { - return; - } - - if (!this.props.logDetail.name) { - throw new Error('A name should be set to distinct logged messages. Please check the `logDetails` prop.'); - } - - Log.info('[LoadingIndicator] Became visible', false, this.props.logDetail); - - this.timeoutID = setTimeout( - () => Log.alert( - `${CONST.ERROR.ENSURE_BUGBOT} [LoadingIndicator] Visible after timeout`, - {timeout: CONST.TIMING.SPINNER_TIMEOUT, ...this.props.logDetail}, - false, - ), - CONST.TIMING.SPINNER_TIMEOUT, - ); - } - - componentWillUnmount() { - if (!this.timeoutID) { - return; - } - - clearTimeout(this.timeoutID); - Log.info('[LoadingIndicator] Disappeared', false, this.props.logDetail); - } - render() { const additionalStyles = _.isArray(this.props.style) ? this.props.style : [this.props.style]; return ( From 921a032133f58fe15c68df8986a03f123922fbff Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Tue, 17 Jan 2023 11:42:11 -0800 Subject: [PATCH 3/4] convert to stateless component --- src/components/FullscreenLoadingIndicator.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/FullscreenLoadingIndicator.js b/src/components/FullscreenLoadingIndicator.js index 5a6a62735810..f930d14efc0a 100644 --- a/src/components/FullscreenLoadingIndicator.js +++ b/src/components/FullscreenLoadingIndicator.js @@ -14,15 +14,13 @@ const defaultProps = { style: [], }; -class FullScreenLoadingIndicator extends React.Component { - render() { - const additionalStyles = _.isArray(this.props.style) ? this.props.style : [this.props.style]; - return ( - - - - ); - } +const FullScreenLoadingIndicator = (props) => { + const additionalStyles = _.isArray(props.style) ? props.style : [props.style]; + return ( + + + + ); } FullScreenLoadingIndicator.propTypes = propTypes; From 0fc2a6357eb792ba7f1f9d1ded721236f1797f56 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Tue, 17 Jan 2023 14:34:59 -0800 Subject: [PATCH 4/4] lint --- src/components/FullscreenLoadingIndicator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FullscreenLoadingIndicator.js b/src/components/FullscreenLoadingIndicator.js index f930d14efc0a..5738a2e4dd9f 100644 --- a/src/components/FullscreenLoadingIndicator.js +++ b/src/components/FullscreenLoadingIndicator.js @@ -21,7 +21,7 @@ const FullScreenLoadingIndicator = (props) => { ); -} +}; FullScreenLoadingIndicator.propTypes = propTypes; FullScreenLoadingIndicator.defaultProps = defaultProps;