Skip to content

Conversation

@kirillzyusko
Copy link
Contributor

@kirillzyusko kirillzyusko commented Dec 18, 2024

Explanation of Change

To keep a consistency I specified includeSafeAreaPaddingBottom on screens that had transparent navigation bar.

Fixed Issues

$ #53186
PROPOSAL: N/A

Tests

  1. Open the app and log in
  2. Create a workspace if there is no any
  3. Navigate to the workspace settings
  4. Enable More features and enable Workflows, Rules and Invoices options
  5. Navigate to Profile, Invoices, Workflows. Rules and More features
  6. Ensure that device buttons navigation bar has borders and visible

Offline tests

N/A

QA Steps

  1. Open the app and log in
  2. Create a workspace if there is no any
  3. Navigate to the workspace settings
  4. Enable More features and enable Workflows, Rules and Invoices options
  5. Navigate to Profile, Invoices, Workflows. Rules and More features
  6. Ensure that device buttons navigation bar has borders and visible

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • if a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

telegram-cloud-photo-size-2-5411137208292861859-y

Android: mWeb Chrome

telegram-cloud-photo-size-2-5411137208292861975-y

iOS: Native

image

iOS: mWeb Safari

image

MacOS: Chrome / Safari image
MacOS: Desktop image

@kirillzyusko kirillzyusko marked this pull request as ready for review December 18, 2024 12:05
@kirillzyusko kirillzyusko requested a review from a team as a code owner December 18, 2024 12:05
@melvin-bot melvin-bot bot requested review from paultsimura and removed request for a team December 18, 2024 12:05
@melvin-bot
Copy link

melvin-bot bot commented Dec 18, 2024

@paultsimura Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@paultsimura
Copy link
Contributor

Thanks @kirillzyusko, I will review it soon. Could you please fix the lint issues in the meantime?

@kirillzyusko
Copy link
Contributor Author

@paultsimura they are coming not because of my changes (I think recently new eslint rule was introduced and it hasn't been fixed yet).

Not sure if I should fix it in this PR (or should I fix it at all?..)

@paultsimura
Copy link
Contributor

They are coming not because of my changes (I think recently new eslint rule was introduced and it hasn't been fixed yet).

Not sure if I should fix it in this PR (or should I fix it at all?..)

This is the same as it was with the useOnyx migration – now, when a file you edit has some default IDs, you should fix it in the PR: https://expensify.slack.com/archives/C01GTK53T8Q/p1734427537784129

@kirillzyusko
Copy link
Contributor Author

now, when a file you edit has some default IDs, you should fix it in the PR

Ah, okay, cool, thanks for clarifications - will do that soon!

@kirillzyusko
Copy link
Contributor Author

@paultsimura I believe PR is ready for review. One remaining failure will be added to exception list in #54288 (comment)

function getWorkspaceAccountID(policyID: string) {
function getWorkspaceAccountID(policyID?: string) {
if (!policyID) {
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use CONST.DEFAULT_NUMBER_ID here and in 2 other places in this function instead of 0.

}

function getWorkspaceAccountID(policyID: string) {
function getWorkspaceAccountID(policyID?: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use string | undefined to always enforce passing the policyID but allow undefined.
A rule of thumb should be: if a function is useful without a param, make it optional using param?. If not – make it required with a possible undefined value: param: T | undefined.

@VickyStash please correct me if I'm wrong on this approach.

Suggested change
function getWorkspaceAccountID(policyID?: string) {
function getWorkspaceAccountID(policyID: string | undefined) {

* Attempts to find a policy expense report in onyx that is owned by ownerAccountID in a given policy
*/
function getPolicyExpenseChat(ownerAccountID: number, policyID: string): OnyxEntry<Report> {
function getPolicyExpenseChat(ownerAccountID: number, policyID?: string): OnyxEntry<Report> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
function getPolicyExpenseChat(ownerAccountID: number, policyID?: string): OnyxEntry<Report> {
function getPolicyExpenseChat(ownerAccountID: number, policyID: string | undefined): OnyxEntry<Report> {

}

function clearPolicyErrorField(policyID: string, fieldName: string) {
function clearPolicyErrorField(policyID?: string, fieldName?: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here.

@paultsimura
Copy link
Contributor

@kirillzyusko could you please share what emulator device did you use, and how I cane add one? All I tried had no buttons on the screen

@kirillzyusko
Copy link
Contributor Author

could you please share what emulator device did you use, and how I cane add one? All I tried had no buttons on the screen

I tested on a real phone and enabled 3 button navigation. You just need to go to Setting -> search for "navigation mode" and select "3 button navigation" instead of "gesture navigation".

Or test on Android 9 for example (there is only one type of 3 button gesture navigation available)

@paultsimura
Copy link
Contributor

paultsimura commented Dec 20, 2024

Same issue on WorkspaceProfilePage.

Screenshot

Screenshot_1734684647

WorkspaceInvoicesPage (to reproduce, just increase the font size in the device settings).

Screenshot

Screenshot_1734685360

And these 2 related to Profile:

Screenshots

Screenshot_1734685653

Screenshot_1734685665

@paultsimura
Copy link
Contributor

Now with all these changes it looks like the majority of WorkspacePageWithSections usages is with includeSafeAreaPaddingBottom=true. Maybe it makes sense to default it to true and pass false in exceptional cases?

@paultsimura
Copy link
Contributor

It looks like now, with includeSafeAreaPaddingBottom=true in most of the profile & workspace pages, we kinda sacrifice the look on the gesture-controlled devices for the sake of those with 3-buttons navigation. I guess there is no win-win solution here.

Here's some before/after:

image image
image image

Do we really want to proceed this way?
@lakchote @mountiny @Expensify/design

@kirillzyusko
Copy link
Contributor Author

we kinda sacrifice the look on the gesture-controlled devices for the sake of those with 3-buttons navigation

Just for an additional context - we already did the same fix for "Search" screens group (and it was accepted) 👀

@kirillzyusko
Copy link
Contributor Author

Same issue on WorkspaceProfilePage.

And

Now with all these changes it looks like the majority of WorkspacePageWithSections usages is with includeSafeAreaPaddingBottom=true. Maybe it makes sense to default it to true and pass false in exceptional cases?

If UX team is happy with a proposed approach in this PR then I'll change includeSafeAreaPaddingBottom=true by default and will check other screens to be sure all screens follow the same pattern 👍

@dannymcclain
Copy link
Contributor

Man I'm pretty torn. I get why we'd want to add in the safe area... But most of the apps I'm looking at on my phone do not include that safe area padding on screens that don't have bottom tabs. @Expensify/design any strong feelings?

image

@shawnborton
Copy link
Contributor

Personally, at least on iOS, I feel strongly that we should do it exactly like you are showing in your examples Danny. I find this version to feel completely broken IMO:
image

That being said, I'm not sure what is standard for Android in this situation.

@dannymcclain
Copy link
Contributor

I agree with you that it looks pretty shoddy on iOS. I'm also not as familiar with standard Android patterns though.

@paultsimura
Copy link
Contributor

What is the plan here then? 🙂

@shawnborton
Copy link
Contributor

@Julesssss or @dubielzyk-expensify - do you know what is expected for Android? Should those buttons have a background behind them, or should they float on top of the content like we'd expect on iOS?

@paultsimura
Copy link
Contributor

@Julesssss or @dubielzyk-expensify - do you know what is expected for Android? Should those buttons have a background behind them, or should they float on top of the content like we'd expect on iOS?

My 2 cents: most Android phones nowadays also use the iOS-like gesture control with a dash at the bottom. This safe area padding will affect them as well

@mountiny
Copy link
Contributor

I agree that with iOS its better without the padding

The problem with android with the buttons is that its bad ux imho when you show interactive elements under the android navigation buttons it leads to confusion as you can see two buttons overlayed - hence i think in that case we should definitely include safe area

@paultsimura
Copy link
Contributor

hence i think in that case we should definitely include safe area

From what I see, there is no way to include the safe area only in some specific case. So we'll have it on iOS as well.

@mountiny
Copy link
Contributor

We could make it android specific, right @kirillzyusko

@kirillzyusko
Copy link
Contributor Author

We could make it android specific, right @kirillzyusko

Yes, we can make it platform specific.

Moreover on Android I think we can also make those padding transparent if it's gesture-navigation bar, and for 3 button navigation - we can apply a padding.

However such refactoring may introduce some problems. Let me explain my concerns.

1️⃣ Non consistent paddings across various screens

As you could observe, somewhere we had transparent navigation bar (Search screens, workspaces screen). On some screens we always applied padding (settings screen).

The current approach that we aim to follow is to always have that padding. But as you can see in this PR some screens are still have old behavior and not always add the padding.

2️⃣ Additional padding from ScreenWrapper gets removed when keyboard is shown

Me and @hannojg (while re-working the approach with insets handling) discovered, that in all cases we don't want this navigation bar padding to be present when keyboard gets shown, so we re-structured the code to make it by default.

If we are goind to refactor that code again, we should also consider this point and try to change the ScreenWrapper API with as small as possible changes.


Now, when we want to make changes again I would prefer to have a codebase in a valid state and move atomically from one consistent state to another.

So I have several steps in my head:

  • merge this PR as is, because it adds consistency on how we handle paddings on screens (always include padding and be consistent on all screens)
  • to remove unused code in app (at the moment we often specify includeSafeAreaPaddingBottom={true} property, even if it's true by default) - something that I planned to do when app will be in a stable form after all our changes.
  • to add a conditional code, that will apply transparent padding on gesture-based nav bar and will keep padding for 3 buttons navigation.

I think such approach will help us to have as small as possible intermediate issues and will assure we are always in consistent state. Let me know what do you think 👀 🙌

@paultsimura
Copy link
Contributor

  • merge this PR as is, because it adds consistency on how we handle paddings on screens (always include padding and be consistent on all screens)

If we go this way, I would encourage to cover more pages than these in the PR. At least add the ones I've mentioned during the initial review.

@kirillzyusko
Copy link
Contributor Author

If we go this way, I would encourage to cover more pages than these in the PR. At least add the ones I've mentioned during the initial review.

Yeah, sure, absolutely agree 🙂 Just want to understand whether we are okay to follow a proposed approach or not and then I can proceed and make corresponding changes based on a chosen decision 👀

@mountiny
Copy link
Contributor

@kirillzyusko Thanks for the explanation. Would your proposed steps lead to the state where the iOS native wont have the extra padding either (same as android without the navigation buttons)?

If yes, I am fine with this atomic approach.

@kirillzyusko
Copy link
Contributor Author

Would your proposed steps lead to the state where the iOS native wont have the extra padding either (same as android without the navigation buttons)?

@mountiny yes, the last step will lead to this 😊

@paultsimura
Copy link
Contributor

@mountiny, what should be the next steps here, considering the conversation above?

@mountiny
Copy link
Contributor

mountiny commented Jan 7, 2025

I think we can go ahead with this plan, but lets prepare it a bit more, I dont like that ios would have this extra padding for more time than needed cc @lakchote

Also we can use this thread to discuss https://expensify.slack.com/archives/C049HHMV9SM/p1736238279772929

@lakchote
Copy link
Contributor

lakchote commented Jan 8, 2025

Posted in Slack here for the next steps.

@chrispader
Copy link
Contributor

chrispader commented Feb 19, 2025

Ok, so this PR now removes includeSafeAreaPaddingBottom={false} from all screens/components, which will apply (additional) bottom safe area padding to all components/screens, that disabled this before.

Ideally we'll want to merge #55633 right after this. That PR also removes includeSafeAreaPadding={true} (or simply includeSafeAreaPadding), and disables bottom safe area padding in ScreenWrapper alltogether. In that PR, i fix the paddings based on both of these changes. The changes from the first PR (removing includeSafeAreaPaddingBottom={false}) will effectively cancel out, because the safe area padding is disabled completely.

Still, there are some more issues to consider, that i'm explaining in a comment in the original issue.

@mountiny
Copy link
Contributor

cc @lakchote for visibility.

@chrispader would be great to write down the plan anad also I think we should ask QA to test these on adhoc builds. Should it just be this pr to start with?

@chrispader
Copy link
Contributor

chrispader commented Feb 19, 2025

@chrispader would be great to write down the plan anad also I think we should ask QA to test these on adhoc builds. Should it just be this pr to start with?

i'm on it right now. I going deeper into the plan and potential follow-up or split up PRs in the issue. #53186 (comment)

@chrispader
Copy link
Contributor

@kirillzyusko i think we can close this PR, since we decided to go with a new plan discussed here

This is the new "Base PR" that we'll use instead: #57128

@paultsimura
Copy link
Contributor

@kirillzyusko please close this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants