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

FAB menu - the menus for FAB menu slide in from the left-to-right, instead of bottom-to-top #3347

Closed
isagoico opened this issue Jun 3, 2021 · 11 comments · Fixed by #3558
Closed
Assignees

Comments

@isagoico
Copy link

isagoico commented Jun 3, 2021

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!

Upwork Job - https://www.upwork.com/jobs/~0156d103876d9e96f7


Expected Result:

Menu should slide from bottom to top

Actual Result:

Menu slides from left-to-right

Action Performed:

  1. Open e.cash app on iOS or aOS
  2. Log in and click on the FAB button.

Workaround:

No need, visual issue.

Platform:

Where is this issue occurring?

Web
iOS ✔️
Android ✔️
Desktop App
Mobile Web

Version Number: 1.0.62-0

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos:

WhatsApp.Video.2021-06-03.at.12.47.55.PM.mp4

onal supporting documentation

Expensify/Expensify Issue URL:

View all open jobs on Upwork


From @roryabraham https://expensify.slack.com/archives/C01GTK53T8Q/p1622681730473400

On mobile platforms, the menus for FAB menu slide in from the left-to-right, instead of bottom-to-top

@MelvinBot
Copy link

Triggered auto assignment to @HorusGoul (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@roryabraham
Copy link
Contributor

I think this can be external. If you agree @HorusGoul then the next step would be for you to:

  1. Remove your assignment (unless you are a member of the engineering-contributor-management team)
  2. Add the External label to get this auto-assigned to a member of the (non-engineering) contributor management team

@HorusGoul HorusGoul removed their assignment Jun 4, 2021
@HorusGoul HorusGoul added the External Added to denote the issue can be worked on by a contributor label Jun 4, 2021
@MelvinBot
Copy link

Triggered auto assignment to @kevinksullivan (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@kevinksullivan
Copy link
Contributor

upwork job posted

https://www.upwork.com/jobs/~0156d103876d9e96f7

@MelvinBot
Copy link

Triggered auto assignment to @Luke9389 (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@kevinksullivan kevinksullivan removed their assignment Jun 5, 2021
@parasharrajat
Copy link
Member

parasharrajat commented Jun 5, 2021

Proposal

Explanation

  1. the required Behaviour is that Menu should be Bottom_docked on Mobile devices and Popover for the rest.
  2. In https://github.com/Expensify/Expensify.cash/blob/3eee51b9c4af23d04845468df227e94fc0034f0a/src/components/Popover/index.js#L11-L19
    we control this behavior but this file is only active for Web, M-web. Thus on M-web we can't find this issue.
    But https://github.com/Expensify/Expensify.cash/blob/3eee51b9c4af23d04845468df227e94fc0034f0a/src/components/Popover/index.native.js#L11-L16

We don't have any behavior like this. We just want to Bottom Dock the Menu which already has defined animations thus props from the parent are not needed. That's why we are clearing the props in the next step for Mobile sizes.

Now when we pass the animation Props from SidebarScreen
https://github.com/Expensify/Expensify.cash/blob/3eee51b9c4af23d04845468df227e94fc0034f0a/src/pages/home/sidebar/SidebarScreen.js#L103
These were meant for the Popover type. M-web, handles it well due to these lines.

{...props}
        animationIn={props.isSmallScreenWidth ? undefined : props.animationIn}
        animationOut={props.isSmallScreenWidth ? undefined : props.animationOut}

But index.native.js 's animation will be overwritten.

Solution

so Solution here is to change the View logic of https://github.com/Expensify/Expensify.cash/blob/3eee51b9c4af23d04845468df227e94fc0034f0a/src/components/Popover/index.native.js .

TO

 <Modal
        type={CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
        // eslint-disable-next-line react/jsx-props-no-spreading
        {...props}
        // Only BOTTOM_DOCKED so we don't need animation props.
        animationIn={undefined}
        animationOut={undefined}
    />

OR We _.omit the animation props from the passed props and then forward it to Modal.

This does not affect any other Menus at all. We originally expected this behavior but forgot to patch native devices with respect to M-web. That's what I proposed as a solution.

@gauravahujame
Copy link

gauravahujame commented Jun 5, 2021

Understanding

From SidebarScreen.js, we pass animationIn and animationOut to the CreateMenu component.
https://github.com/Expensify/Expensify.cash/blob/3eee51b9c4af23d04845468df227e94fc0034f0a/src/pages/home/sidebar/SidebarScreen.js#L103-L104
These are further passed to Popover => Modal => BaseModal. Inside BaseModal, we prioritize animation props over the ones returned from getModalStyles function.
https://github.com/Expensify/Expensify.cash/blob/3eee51b9c4af23d04845468df227e94fc0034f0a/src/components/Modal/BaseModal.js#L95-L96

Problem

SidebarScreen.js should not send the animations because they can be different based on the platform. So it does not make sense to send fadeInLeft and fadeOutLeft from here because they don't apply to mobile devices.

Solution

            <BaseCreateMenu
                // eslint-disable-next-line react/jsx-props-no-spreading
                {...this.props}
                onMenuHide={this.onMenuHide}
                onItemSelected={item => this.selectItem(item)}
                animationIn={this.props.animationIn || 'slideInUp'} // THIS
                animationOut={this.props.animationOut || 'slideOutDown'} // THIS
            />

With this, menus have a platform specific default animation and also the flexibility of overriding them if needed in future.

Also, @parasharrajat I think we should let PopupOver to relay animation props from parent components instead of setting them undefined. This way it won't affect other parts of the app which are using PopOver.

Update: I've been able to test my solution and this is how it looks
https://user-images.githubusercontent.com/26275462/120879414-c7c73700-c5e0-11eb-9594-e308ca773cf2.mp4

Screen.Recording.2021-06-05.at.10.03.57.AM.mov

@amnan181
Copy link

amnan181 commented Jun 5, 2021

Proposal

You just have to change the animation type to work as you want

  1. You have to add the initial animation type like animationIn="slideInUp"
  2. Same as first one you have to change the animation out animation which will be triggered when your modal is going to be closed so simply add the type which type of behaviour you want while closing the modal animationOut="slideOutDown"

Thanks!

@dharammachra
Copy link
Contributor

dharammachra commented Jun 6, 2021

@isagoico @HorusGoul -

Issue -

SidebarScreen.js - We have hard coded value
animationIn="fadeInLeft"
animationOut="fadeOutLeft"

It can be different based on the platform.

Proposal -
We need to remove hard coded animationIn and animationOut props from SidebarScreen.

  1. We can simply create a helper method getAnimationInType() with the following structures
    .
    └── libs/
    └── getAnimationInType/
    ├── index.js => 'fadeInLeft'
    └── index.native.js - return () =>’ slideInUp’

Then we can simply assign the value -

animationIn ={getAnimationInType()}
'
OR

  1. We should simply check the platform specific animations in the index.native.js

src/components/CreateMenu/index.native.js
animationIn={this.props.animationIn || 'slideInUp'}
animationOut={this.props.animationOut || 'slideOutDown'}

Please find the attached video for Mobile and Web after my solution:

  1. Mobile -
    https://user-images.githubusercontent.com/368119/120922094-deef4d00-c6e4-11eb-8772-67104223c994.mov

  2. Web -

Web.mov

@Luke9389
Copy link
Contributor

Luke9389 commented Jun 7, 2021

I don't understand why this is happening. This menu should be getting set as type=CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED. Do any of you see why this problem is occurring? I'm not asking for altered proposals at this time, just an explanation of what's going on.

Edit: I see it now. Talked 1:1 with @roryabraham.

@Luke9389
Copy link
Contributor

Luke9389 commented Jun 7, 2021

This issue was discussed internally and it was decided that we'd use a different solution that has not been mentioned above. Thanks for you're time folks!

@Luke9389 Luke9389 added Weekly KSv2 and removed External Added to denote the issue can be worked on by a contributor Daily KSv2 Exported labels Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants