Skip to content

Commit

Permalink
Merge pull request #23238 from Expensify/marcaaron-headerGapRefactor
Browse files Browse the repository at this point in the history
Refactor `HeaderGap`
  • Loading branch information
thienlnam authored Nov 21, 2023
2 parents c6f9229 + 1f43737 commit c9b69ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
20 changes: 11 additions & 9 deletions src/components/HeaderGap/index.desktop.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import React, {memo} from 'react';
import {View} from 'react-native';
import withThemeStyles, {withThemeStylesPropTypes} from '@components/withThemeStyles';
import compose from '@libs/compose';

const propTypes = {
/** Styles to apply to the HeaderGap */
Expand All @@ -10,14 +11,15 @@ const propTypes = {
...withThemeStylesPropTypes,
};

class HeaderGap extends PureComponent {
render() {
return <View style={[this.props.themeStyles.headerGap, ...this.props.styles]} />;
}
const defaultProps = {
styles: [],
};

function HeaderGap(props) {
return <View style={[props.themeStyles.headerGap, ...props.styles]} />;
}

HeaderGap.displayName = 'HeaderGap';
HeaderGap.propTypes = propTypes;
HeaderGap.defaultProps = {
styles: [],
};
export default withThemeStyles(HeaderGap);
HeaderGap.defaultProps = defaultProps;
export default compose(memo, withThemeStyles)(HeaderGap);
11 changes: 5 additions & 6 deletions src/components/HeaderGap/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {PureComponent} from 'react';

export default class HeaderGap extends PureComponent {
render() {
return null;
}
function HeaderGap() {
return null;
}

HeaderGap.displayName = 'HeaderGap';
export default HeaderGap;

0 comments on commit c9b69ff

Please sign in to comment.