Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove animations from the Popover menus #6333

Merged
merged 8 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/Popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const Popover = (props) => {
{...props}
animationIn={props.isSmallScreenWidth ? undefined : props.animationIn}
animationOut={props.isSmallScreenWidth ? undefined : props.animationOut}
animationInTiming={props.disableAnimation ? 1 : props.animationInTiming}
animationOutTiming={props.disableAnimation ? 1 : props.animationOutTiming}
shouldCloseOnOutsideClick
/>,
document.body,
Expand All @@ -33,6 +35,8 @@ const Popover = (props) => {
fullscreen={props.isSmallScreenWidth ? true : props.fullscreen}
animationIn={props.isSmallScreenWidth ? undefined : props.animationIn}
animationOut={props.isSmallScreenWidth ? undefined : props.animationOut}
animationInTiming={props.disableAnimation && !props.isSmallScreenWidth ? 1 : props.animationInTiming}
animationOutTiming={props.disableAnimation && !props.isSmallScreenWidth ? 1 : props.animationOutTiming}
/>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popover/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const propTypes = {
* On small screen widths, it uses BottomDocked modal type, and a Popover type on wide screen widths.
*/
const Popover = (props) => {
const propsWithoutAnimation = _.omit(props, ['animationIn', 'animationOut', 'popoverAnchorPosition']);
const propsWithoutAnimation = _.omit(props, ['animationIn', 'animationOut', 'popoverAnchorPosition', 'disableAnimation']);
return (
<Modal
type={CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Popover/popoverPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ const propTypes = {
bottom: PropTypes.number,
left: PropTypes.number,
}),

/** Whether disable the animations */
disableAnimation: PropTypes.bool,
};

const defaultProps = {
...(_.omit(defaultModalProps, ['type', 'popoverAnchorPosition'])),

// Anchor position is optional only because it is not relevant on mobile
anchorPosition: {},
disableAnimation: true,
};

export {propTypes, defaultProps};
1 change: 1 addition & 0 deletions src/components/PopoverMenu/BasePopoverMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class BasePopoverMenu extends PureComponent {
onModalHide={this.props.onMenuHide}
animationIn={this.props.animationIn}
animationOut={this.props.animationOut}
disableAnimation={this.props.disableAnimation}
>
<View style={this.props.isSmallScreenWidth ? {} : styles.createMenuContainer}>
{!_.isEmpty(this.props.headerText) && (
Expand Down
4 changes: 4 additions & 0 deletions src/components/PopoverMenu/popoverMenuPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ const propTypes = {

/** Optional non-interactive text to display as a header for any create menu */
headerText: PropTypes.string,

/** Whether disable the animations */
disableAnimation: PropTypes.bool,
};

const defaultProps = {
animationIn: 'fadeIn',
animationOut: 'fadeOut',
headerText: undefined,
disableAnimation: true,
};

export {propTypes, defaultProps};
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class PopoverReportActionContextMenu extends React.Component {
onModalHide={this.runAndResetOnPopoverHide}
anchorPosition={this.state.popoverAnchorPosition}
animationIn="fadeIn"
disableAnimation={false}
Jag96 marked this conversation as resolved.
Show resolved Hide resolved
animationOutTiming={1}
measureContent={this.measureContent}
shouldSetModalVisibility={false}
Expand Down
2 changes: 0 additions & 2 deletions src/pages/home/sidebar/SidebarScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ class SidebarScreen extends Component {
onClose={this.toggleCreateMenu}
isVisible={this.state.isCreateMenuActive}
anchorPosition={styles.createMenuPositionSidebar}
animationIn="fadeInLeft"
animationOut="fadeOutLeft"
onItemSelected={this.onCreateMenuItemSelected}
menuItems={[
{
Expand Down