App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-12-13] FAB - Options are shown for full screen width in iPad, it should show like how it’s handled in desktop - @Santhosh-Sellavel

Open isagoico opened this issue 5 years ago • 25 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open app in an iPad
  2. Click on the FAB / Plus button

Expected Result:

Global action menu should be displayed like in the desktop app, in a floating modal.

Actual Result:

Global action menu is displayed full-width across the screen.

Workaround:

None needed, visual issue.

Platform:

Where is this issue occurring?

  • iOS (iPad ONLY)

Version Number: 1.1.6-0

Reproducible in staging?: yes **Reproducible in production?:**yes

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

Notes/Photos/Videos: Any additional supporting documentation image

Expensify/Expensify Issue URL:

Issue reported by: @Santhosh-Sellavel Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1631727718347500

View all open jobs on GitHub

isagoico avatar Oct 11 '21 19:10 isagoico

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

MelvinBot avatar Oct 11 '21 19:10 MelvinBot

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

MelvinBot avatar Oct 12 '21 10:10 MelvinBot

Upwork post

bfitzexpensify avatar Oct 12 '21 16:10 bfitzexpensify

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

MelvinBot avatar Oct 12 '21 16:10 MelvinBot

PROPOSAL

This happens because in the Popover for native versions, it doesn't have the option for largeScreenWidth.

I propose use the same approach as the Popover for web and desktop versions.

https://github.com/Expensify/App/blob/5d9785b23ebfbfa4d7263b0134e245356071834a/src/components/Popover/index.js#L27-L37

And remove unused lines of code, like the lines where omits the animationIn, animationOut, popoverAnchorPosition. Since this props are being filtered by the isSmallScreenWidth prop.

https://github.com/Expensify/App/blob/5d9785b23ebfbfa4d7263b0134e245356071834a/src/components/Popover/index.native.js#L17

Also, It is needed to move the PopoverMenu above the View where the SidebarLinks and FAB are. If left the way it is, it causes to render an extra padding on the bottom for the iPad, which will overlap the Popover with the FAB. See attached videos.

https://user-images.githubusercontent.com/53409604/137022024-003671bf-d759-465f-87a9-7ab98609dc34.mp4

https://user-images.githubusercontent.com/53409604/137022054-db70a0fc-f677-4580-bbdb-809670924458.mp4

AlfredoAlc avatar Oct 12 '21 20:10 AlfredoAlc

Another option is to create a variable popoverResponsiveWidthBreakpoint: 760, and in BasePopoverMenu.js pass a new prop to Popover component called useSmallScreenWidth.

 <Popover
                anchorPosition={this.props.anchorPosition}
                onClose={this.props.onClose}
                isVisible={this.props.isVisible}
                onModalHide={this.props.onMenuHide}
                animationIn={this.props.animationIn}
                animationOut={this.props.animationOut}
                useSmallScreenWidth={this.props.windowWidth <= variables.popoverResponsiveWidthBreakpoint}
            >

In use this props instead of props.isSmallScreenWidth which is used globally to switch between responsive modes (mobile/desktop).

 if (!props.fullscreen && !props.useSmallScreenWidth) {
        return createPortal(
            <Modal
                type={CONST.MODAL.MODAL_TYPE.POPOVER}
                popoverAnchorPosition={props.anchorPosition}
                // eslint-disable-next-line react/jsx-props-no-spreading
                {...props}
                animationIn={props.useSmallScreenWidth ? undefined : props.animationIn}
                animationOut={props.useSmallScreenWidth ? undefined : props.animationOut}
                shouldCloseOnOutsideClick
            />,
            document.body,
        );
    }

This will allow us to control responsive popovers which is not dependent on the global responsive variable.

Example:

https://user-images.githubusercontent.com/26057318/137025576-f057415e-d71b-4f18-a9f0-de741e07a567.mp4

akash191095 avatar Oct 12 '21 20:10 akash191095

hi, I am from Upwork. can I get a chance to perform tasks,

mohsiniqbalcui avatar Oct 13 '21 04:10 mohsiniqbalcui

Hi, I am from Upwork and have a solution for this issue! That's how I determined and fixed this issue:

The cause of the problem:

  1. The Popover component for the native version of the application is assigned a BOTTOM_DOCKED type that has a width of 100%.
  2. Also, the popover component for the native version is not wrapped in the withWindowDimensions function and therefore it does not get props that determine which screen size it belongs to.
  3. Also the function withWindowDimensions has a bug due to which the property isMediumScreenWidth can never be true if user rotate device and screen orientations has been changed (variable mediumScreenResponsiveWidthBreakpoint does not exist).

Solution:

  1. Create an additional variable MODAL_TYPE.POPOVER_TABLET and assign it the appropriate styles in the getModalStyles.js file.
  2. In the index.native.js file, wrap Popover in the wisWindowDimensions function.
  3. Pass the condition with the corresponding variables to the type property.
  4. Fix errors with variables

This is the result of all points:

https://user-images.githubusercontent.com/52608209/137121202-bc26069a-cb1b-4db6-80b5-495d2b19631b.mp4

https://user-images.githubusercontent.com/52608209/137121768-affe8c45-1826-4390-a40e-862362413130.mp4

ProkhoDim avatar Oct 13 '21 11:10 ProkhoDim

@johnmlee101 thoughts on the above proposals?

bfitzexpensify avatar Oct 21 '21 18:10 bfitzexpensify

Bump! @johnmlee101

bfitzexpensify avatar Nov 03 '21 13:11 bfitzexpensify

@johnmlee101 it's been 26 days since @ProkhoDim submitted the proposal, can you please review? https://github.com/Expensify/App/issues/5754#issuecomment-942189373

mallenexpensify avatar Nov 08 '21 17:11 mallenexpensify

We are placing all non-critical issues on hold while we're on a company offsite. The hold is expected to be lifted on 11/19 (but could go longer). For any PRs that are submitted before or during the hold, we will add a $250 bonus payment.

mallenexpensify avatar Nov 08 '21 18:11 mallenexpensify

@AlfredoAlc sorry for the delay. I like your proposal so let's go with that!

@ProkhoDim I liked yours as well, but the animation loses its transition and breaks a bit of the existing expectations of a slide in.

@akash191095 I think adding a new constant number to the mix feels less responsive than the solution we're going for, so thats why I prefer the first proposal.

johnmlee101 avatar Nov 08 '21 18:11 johnmlee101

We are placing all non-critical issues on hold while we're on a company offsite. The hold is expected to be lifted on 11/19 (but could go longer). For any PRs that are submitted before or during the hold, we will add a $250 bonus payment.

@johnmlee101 @mallenexpensify Does this means I should wait until the hold is lifted, or I can start working on fixing this issue ??

AlfredoAlc avatar Nov 09 '21 18:11 AlfredoAlc

@AlfredoAlc please start working on the issue now and a submit a PR when it's ready. The bonus will only be applied if you submit your PR before Friday the 19th (or when the hold is lifted if it's after then, which it shouldn't be)

mallenexpensify avatar Nov 09 '21 20:11 mallenexpensify

@mallenexpensify BTW, Upwork sent me a notification that the job has expired. I haven't been hired yet.

AlfredoAlc avatar Nov 11 '21 18:11 AlfredoAlc

@AlfredoAlc , I created a new job, can you apply here plz https://www.upwork.com/jobs/~015cbedc439aa10aac

mallenexpensify avatar Nov 12 '21 16:11 mallenexpensify

This was merged, waiting for deploy!

johnmlee101 avatar Nov 24 '21 19:11 johnmlee101

@mallenexpensify I applied but haven't yet been hired 👀

AlfredoAlc avatar Nov 25 '21 02:11 AlfredoAlc

sorry for the delay @AlfredoAlc! Hired you. I'll end the contract and pay out the amount 7 days after deploy.

bfitzexpensify avatar Nov 29 '21 14:11 bfitzexpensify