From 8280b6789b56547c98e6eff4de8646da070f293e Mon Sep 17 00:00:00 2001 From: Joe Gambino Date: Mon, 2 Aug 2021 14:37:19 -0700 Subject: [PATCH 1/2] Remove unused propType for CollapsibleSection --- .../CollapsibleSection/CollapsibleSectionPropTypes.js | 9 +-------- src/components/CollapsibleSection/index.js | 5 ++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/components/CollapsibleSection/CollapsibleSectionPropTypes.js b/src/components/CollapsibleSection/CollapsibleSectionPropTypes.js index e928619d432..2fe358f6607 100644 --- a/src/components/CollapsibleSection/CollapsibleSectionPropTypes.js +++ b/src/components/CollapsibleSection/CollapsibleSectionPropTypes.js @@ -4,15 +4,8 @@ const propTypes = { /** Title of the Collapsible section */ title: PropTypes.string.isRequired, - /** Whether the section should start expanded. False by default */ - isExpanded: PropTypes.bool, - /** Children to display inside the Collapsible component */ children: PropTypes.node.isRequired, }; -const defaultProps = { - isExpanded: false, -}; - -export {propTypes, defaultProps}; +export default propTypes; diff --git a/src/components/CollapsibleSection/index.js b/src/components/CollapsibleSection/index.js index 1b734933c08..ca6bbb02222 100644 --- a/src/components/CollapsibleSection/index.js +++ b/src/components/CollapsibleSection/index.js @@ -2,7 +2,7 @@ import React from 'react'; import {View, TouchableOpacity} from 'react-native'; import Collapsible from './Collapsible'; import Text from '../Text'; -import {propTypes, defaultProps} from './CollapsibleSectionPropTypes'; +import propTypes from './CollapsibleSectionPropTypes'; import styles from '../../styles/styles'; import Icon from '../Icon'; import {DownArrow, UpArrow} from '../Icon/Expensicons'; @@ -12,7 +12,7 @@ class CollapsibleSection extends React.Component { super(props); this.toggleSection = this.toggleSection.bind(this); this.state = { - isExpanded: this.props.isExpanded, + isExpanded: false, }; } @@ -48,6 +48,5 @@ class CollapsibleSection extends React.Component { } } -CollapsibleSection.defaultProps = defaultProps; CollapsibleSection.propTypes = propTypes; export default CollapsibleSection; From 994f44ba1cec13f62b0dd3f3389a4dbedc97ddf9 Mon Sep 17 00:00:00 2001 From: Joe Gambino Date: Thu, 5 Aug 2021 10:51:57 -0700 Subject: [PATCH 2/2] remove unnecessary propTypes file --- .../CollapsibleSection/CollapsibleSectionPropTypes.js | 11 ----------- src/components/CollapsibleSection/index.js | 10 +++++++++- 2 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 src/components/CollapsibleSection/CollapsibleSectionPropTypes.js diff --git a/src/components/CollapsibleSection/CollapsibleSectionPropTypes.js b/src/components/CollapsibleSection/CollapsibleSectionPropTypes.js deleted file mode 100644 index 2fe358f6607..00000000000 --- a/src/components/CollapsibleSection/CollapsibleSectionPropTypes.js +++ /dev/null @@ -1,11 +0,0 @@ -import PropTypes from 'prop-types'; - -const propTypes = { - /** Title of the Collapsible section */ - title: PropTypes.string.isRequired, - - /** Children to display inside the Collapsible component */ - children: PropTypes.node.isRequired, -}; - -export default propTypes; diff --git a/src/components/CollapsibleSection/index.js b/src/components/CollapsibleSection/index.js index ca6bbb02222..b30cb5b0122 100644 --- a/src/components/CollapsibleSection/index.js +++ b/src/components/CollapsibleSection/index.js @@ -1,12 +1,20 @@ import React from 'react'; import {View, TouchableOpacity} from 'react-native'; +import PropTypes from 'prop-types'; import Collapsible from './Collapsible'; import Text from '../Text'; -import propTypes from './CollapsibleSectionPropTypes'; import styles from '../../styles/styles'; import Icon from '../Icon'; import {DownArrow, UpArrow} from '../Icon/Expensicons'; +const propTypes = { + /** Title of the Collapsible section */ + title: PropTypes.string.isRequired, + + /** Children to display inside the Collapsible component */ + children: PropTypes.node.isRequired, +}; + class CollapsibleSection extends React.Component { constructor(props) { super(props);