App icon indicating copy to clipboard operation
App copied to clipboard

[Tracking] Update navigation to support wide layouts on native

Open roryabraham opened this issue 4 months ago ā€¢ 3 comments

Problem

We have an iPad app, and it doesn't work as expected, because we have code that assumes that any code in index.native.js must be representing a narrow layout. Using platform as a proxy for:

  • device layout
  • presence of a mouse/hoverability
  • keyboard handling

is a bad practice and a source for technical debt. It also violates one of the driving philosophies of this app - cross platform 99.99%.

For the sake of scope management, this issue will focus on removing instances where platform is used as a proxy for device layout, specifically these known issues, which will soon be fixed via a temporary workaround.

  • https://github.com/Expensify/App/issues/35753
  • https://github.com/Expensify/App/issues/35755
  • https://github.com/Expensify/App/issues/35752
  • https://github.com/Expensify/App/issues/35758
  • https://github.com/Expensify/App/issues/35759
  • https://github.com/Expensify/App/issues/35764

Solution

Remove code in index.native.js files that assumes it will be running on a narrow layout. Let's get wide layouts working on an iPad Pro (in portrait mode). When this was investigated before, one of the key difficulties found was that we rely on position: fixed in wide layouts on web, but that style is not currently supported in React Native.

roryabraham avatar Feb 05 '24 20:02 roryabraham

cc @mountiny @hayata-suenaga @adamgrzybowski @WojtekBoman @mateuuszzzzz @kosmydel @MaciejSWM

roryabraham avatar Feb 05 '24 20:02 roryabraham

Maybe one alternative to using position: fixed would be to leverage @gorhom/portal to move the view outside the positional scope, as suggested here

roryabraham avatar Feb 05 '24 20:02 roryabraham

What if we create a parent component that fills the entire screen with its position set to relative, and then make the target component a child of this parent component, setting its position to absolute?

hayata-suenaga avatar Feb 05 '24 23:02 hayata-suenaga

Job added to Upwork: https://www.upwork.com/jobs/~01290d6331a572c985

melvin-bot[bot] avatar Feb 06 '24 10:02 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

melvin-bot[bot] avatar Feb 06 '24 10:02 melvin-bot[bot]

Triggered auto assignment to @sakluger (NewFeature), see https://stackoverflowteams.com/c/expensify/questions/14418#:~:text=BugZero%20process%20steps%20for%20feature%20requests for more details.

melvin-bot[bot] avatar Feb 06 '24 10:02 melvin-bot[bot]

Noted in the OP we still do not want to allow the landscape mode. Making this External to get proposals going. If anything is not clear, please ask. Thanks

mountiny avatar Feb 06 '24 10:02 mountiny

Can I close my issue Unable to navigate away from Profile page using the back button (which is already linked on the OP) as the issue will be fixed in this issue?

hayata-suenaga avatar Feb 06 '24 17:02 hayata-suenaga

@hayata-suenaga that issue is linked to the PR so I would just leave it open so we can confirm it was fixed in staging once the PR is deployed

mountiny avatar Feb 06 '24 18:02 mountiny

From Nick Gerleman at Meta:

We actually just spent a couple months adding support for position: "static" in the new architecture.

I will warn that adding position: "fixed" would be fairly complicated, and break a good number of assumptions in both Yoga and Fabric. E.g. beyond layout, it we would need to change Fabric mounting layer as well (e.g. we couldn't put a fixed item under a scrolling container. IIRC fixed has stacking context implications as well).

I would discourage trying to take it on without previous experience in both Yoga and Fabric's mounting later.

roryabraham avatar Feb 07 '24 20:02 roryabraham

It sounds like that would be a potentially valuable improvement, but we'd need to assemble a dream team to do it and recognize that it would be a big initiative that would take a lot of time and might not be a top priority for Meta.

An alternate solution, if possible, would be much more expedient.

roryabraham avatar Feb 07 '24 20:02 roryabraham

The position fixed is used because we need to modify the position of cards inside the StackView component provided by react-navigation, to display them side by side.

As a potential idea to investigate, we could try to use two or more StackViews in the custom navigator. This should give us more flexibility with positioning.

Alternatively, we could create our own / modify the StackView.

However, I am not sure how it would work with native stacks

adamgrzybowski avatar Feb 08 '24 10:02 adamgrzybowski

šŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? šŸ’ø

melvin-bot[bot] avatar Feb 13 '24 16:02 melvin-bot[bot]

Upwork job price has been updated to $1000

melvin-bot[bot] avatar Feb 14 '24 13:02 melvin-bot[bot]

Bumping this to hopefully get some proposals here

mountiny avatar Feb 14 '24 13:02 mountiny

šŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? šŸ’ø

melvin-bot[bot] avatar Feb 21 '24 16:02 melvin-bot[bot]

Posted in the Callstack Slack room to ask for volunteers.

sakluger avatar Feb 22 '24 18:02 sakluger

Hi, Iā€™m Michael (Mykhailo) from Callstack and I would like to work on this issue.

rezkiy37 avatar Feb 26 '24 11:02 rezkiy37

Does this issue still need proposal?

badeggg avatar Feb 27 '24 08:02 badeggg

I am already working to prepare a proposal.

rezkiy37 avatar Feb 27 '24 10:02 rezkiy37

Actively working on the issue. Resolving a problem with 2 active stacks on a screen at the same moment.

rezkiy37 avatar Feb 27 '24 17:02 rezkiy37

Still trying to implement 2 active stacks on a screen at the same moment.

rezkiy37 avatar Feb 28 '24 17:02 rezkiy37

Discuss internally how to handle the feature with 2 active stacks on a screen at the same moment.

rezkiy37 avatar Mar 01 '24 15:03 rezkiy37

I need to create a custom navigator to handle this case on native devices (iPads). So, I am going to develop it. Btw, looks like it is a hard task, therefore I need some time to investigate and implement.

rezkiy37 avatar Mar 04 '24 16:03 rezkiy37

šŸ‘‹ can someone catch me up on why this one was added to #wave8, and should it now be transfered to #wave-collect?

trjExpensify avatar Mar 05 '24 12:03 trjExpensify

Going to integrate something similar to what they described in this article. Testing on a bare project now.

rezkiy37 avatar Mar 08 '24 16:03 rezkiy37

@rezkiy37 Just wanted point you also towards this ideal nav PR which makes some updates to the navigators https://github.com/Expensify/App/pull/37421

@trjExpensify This is a follow up to the ideal nav / app navigation reboot updates, we want to clean up how the layout is handled based on the device size.

At the moment, some actions are decided based on the screen width which because on native devices we struggled to achieve the desktop layout due to some RN styling limitations. We want to remove this debt.

It was added as a follow up to ideal nav then

mountiny avatar Mar 08 '24 20:03 mountiny

Okay, so @mountiny I'm putting this one in #wave-collect polish. I've also added [Ideal Nav] in the issue title to associate it with that project.

trjExpensify avatar Mar 11 '24 13:03 trjExpensify

Thank you!

mountiny avatar Mar 11 '24 16:03 mountiny

I have some progress on the issue. The idea is to have 2 NavigationContainers. Continue working on it.

Screenshot 2024-03-12 at 18 47 22 Screenshot 2024-03-12 at 18 47 27

rezkiy37 avatar Mar 12 '24 17:03 rezkiy37