Skip to content

[HOLD for payment 2024-10-30] [$1000] Create a useResponsiveLayout hook #30528

Closed

Description

@roryabraham

Slack context: https://expensify.slack.com/archives/C01GTK53T8Q/p1698364514493649

Problem

There are some times when we want to use the same layout on mobile devices or in the RHP on wide screens. In these cases, we can't rely on isSmallScreenWidth from useWindowDimensions to determine which layout to use, so we have hard-coded and/or different solutions we use to address the same problem.

Solution

  1. In the navigation stack, add an isInRHP route prop to all screens in the RHP.

  2. Write a custom hook called useResponsiveLayout that does something like this:

    function useResponsiveLayout() {
        const {isSmallScreenWidth} = useWindowDimensions();
        const {params} = useRoute();
        return {
            shouldUseNarrowLayout = isSmallScreenWidth || params.isInRHP,
        };
    }
  3. Replace most layout-motivated uses of useWindowDimensions with useResponsiveLayout like so:

    - const {isSmallScreenWidth} = useWindowDimensions();
    + const {shouldUseNarrowLayout} = useResponsiveLayout();
  4. Introduce a new lint rule that prohibits using isSmallScreenWidth from useWindowDimensions, advising developers to use shouldUseNarrowLayout instead.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f36dcb081cdf74b2
  • Upwork Job ID: 1717949899365408768
  • Last Price Increase: 2023-12-29
Issue OwnerCurrent Issue Owner: @alexpensify

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    NewFeatureSomething to build that is a new item.
    on Oct 27, 2023
  2. self-assigned this
    on Oct 27, 2023
  3. melvin-bot commented on Oct 27, 2023

    @melvin-bot
  4. changed the title [-]Create a useResponsiveLayout hook[/-] [+][$500] Create a useResponsiveLayout hook[/+] on Oct 27, 2023
  5. melvin-bot commented on Oct 27, 2023

    @melvin-bot
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    and removed on Oct 27, 2023
  7. melvin-bot commented on Oct 27, 2023

    @melvin-bot

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

  8. 170 remaining items

  9. rayane-d commented on Oct 31, 2024

    @rayane-d
    Contributor

    @alexpensify The payment amount for this issue is $1000 - #30528 (comment)

  10. rayane-d commented on Oct 31, 2024

    @rayane-d
    Contributor

    @alexpensify Offer accepted, thanks!

  11. alexpensify commented on Oct 31, 2024

    @alexpensify
    Contributor

    🤦🏼 good catch - Upwork was right. I've updated the summary here and paid @rayane-djouah via Upwork. I'm waiting for @getusha to accept.

  12. alexpensify commented on Nov 2, 2024

    @alexpensify
    Contributor

    Status: Waiting for @getusha to accept in Upwork

  13. rayane-d commented on Nov 3, 2024

    @rayane-d
    Contributor

    @alexpensify I think that @getusha is being paid in NewDot, we can close this issue

  14. alexpensify commented on Nov 5, 2024

    @alexpensify
    Contributor

    Thanks for flagging! This GH is from 2023. I think it needs to be paid via Chat, but let me double-check.

  15. alexpensify commented on Nov 7, 2024

    @alexpensify
    Contributor

    I confirmed that this one is from 2023. It will need to be paid via Upwork. I will move this to weekly since I'm OOO until Tuesday. @getusha, keep me posted when you accept it in Upwork. I'll complete the process when I'm back online.

  16. getusha commented on Nov 7, 2024

    @getusha
    Contributor

    @alexpensify accepted, thanks!

  17. alexpensify commented on Nov 7, 2024

    @alexpensify
    Contributor

    All set, everyone has been paid via Upwork: #30528 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionExternalAdded to denote the issue can be worked on by a contributorNewFeatureSomething to build that is a new item.WeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions