Skip to content

Android - Onboarding - FAB button in task description is misaligned with small/large font #56341

Closed

Description

@IuliiaHerets

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


Version Number: 9.0.94-1
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): applausetester+sj9032@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Samsung Galaxy Z Fold 4 / Android 14
App Component: Money Requests

Action Performed:

Precondition:

  • Device font size should be the smallest or the largest.
  1. Go to staging.new.expensify.com
  2. Create a new Gmail account.
  3. Select "Track and budget expenses" and complete the onboarding.
  4. Log in with the same account on Android app.
  5. Go to Concierge chat.
  6. Tap "Track an expense" task.

Expected Result:

FAB button in the task description should be aligned properly when the device font is the smallest or the largest.

Actual Result:

FAB button in the task description is not aligned properly when the device font is the smallest or the largest.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6733095_1738670367254.1738670079771_Screen_Recording_20250204_195237_Expensify.1.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerCashThis issue or pull request should block deployment
    on Feb 4, 2025
  2. melvin-bot commented on Feb 4, 2025

    @melvin-bot

    Triggered auto assignment to @Christinadobrzyn (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. melvin-bot commented on Feb 4, 2025

    @melvin-bot

    Triggered auto assignment to @stitesExpensify (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Feb 4, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  5. github-actions commented on Feb 4, 2025

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. changed the title [-]Android - Onboarding - FAB button in task description is misaligned when device font is[/-] [+] Android - Onboarding - FAB button in task description is misaligned with small/large font?[/+] on Feb 4, 2025
  7. changed the title [-] Android - Onboarding - FAB button in task description is misaligned with small/large font?[/-] [+] Android - Onboarding - FAB button in task description is misaligned with small/large font[/+] on Feb 4, 2025
  8. roryabraham commented on Feb 4, 2025

    @roryabraham
    Contributor

    Ok, looks like we have some special HTML rendering for a custom tag: <custom_emoji> the one we've got is here:

    '1. Press the <custom-emoji emoji="actionMenuIcon" pressablewithdefaultaction /> button.\n' +

  9. roryabraham commented on Feb 4, 2025

    @roryabraham
    Contributor

    Looks like we just need to use dynamic icon size here

  10. roryabraham commented on Feb 4, 2025

    @roryabraham
    Contributor

    I can work on this one

  11. roryabraham commented on Feb 4, 2025

    @roryabraham
    Contributor

    Due to other issues, I think we'll be reverting the offending PR: #56362

  12. roryabraham commented on Feb 4, 2025

    @roryabraham
    Contributor

    It looks like we can get the font scale dynamically from useWindowDimensions: https://reactnative.dev/docs/usewindowdimensions#fontscale

    So I wrote some code to fix this in a pretty simple way:

    diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx
    index dab8c89013d..f0e82b22f93 100644
    --- a/src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx
    +++ b/src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx
    @@ -6,6 +6,7 @@ import type {SvgProps} from 'react-native-svg';
     import GlobalCreateIcon from '@assets/images/customEmoji/global-create.svg';
     import CustomEmojiWithDefaultPressableAction from '@components/HTMLEngineProvider/CustomEmojiWithDefaultPressableAction';
     import ImageSVG from '@components/ImageSVG';
    +import useResponsiveLayout from '@hooks/useResponsiveLayout';
     import useThemeStyles from '@hooks/useThemeStyles';
     import variables from '@styles/variables';
     
    @@ -15,6 +16,7 @@ const emojiMap: Record<string, FC<SvgProps>> = {
     
     function CustomEmojiRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) {
         const styles = useThemeStyles();
    +    const {fontScale} = useResponsiveLayout();
         const emojiKey = tnode.attributes.emoji;
     
         if (emojiMap[emojiKey]) {
    @@ -22,8 +24,8 @@ function CustomEmojiRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) {
                 <View style={styles.customEmoji}>
                     <ImageSVG
                         src={emojiMap[emojiKey]}
    -                    width={variables.iconSizeNormal}
    -                    height={variables.iconSizeNormal}
    +                    width={variables.iconSizeNormal * fontScale}
    +                    height={variables.iconSizeNormal * fontScale}
                     />
                 </View>
             );
    diff --git a/src/hooks/useResponsiveLayout/index.native.ts b/src/hooks/useResponsiveLayout/index.native.ts
    index 10f8506caf4..245d77de33d 100644
    --- a/src/hooks/useResponsiveLayout/index.native.ts
    +++ b/src/hooks/useResponsiveLayout/index.native.ts
    @@ -23,7 +23,7 @@ import type ResponsiveLayoutResult from './types';
      * For more details on the various modal types we've defined for this app and implemented using react-native-modal, see `ModalType`.
      */
     export default function useResponsiveLayout(): ResponsiveLayoutResult {
    -    const {windowWidth, windowHeight} = useWindowDimensions();
    +    const {windowWidth, windowHeight, fontScale} = useWindowDimensions();
     
         const isExtraSmallScreenHeight = windowHeight <= variables.extraSmallMobileResponsiveHeightBreakpoint;
         const isSmallScreenWidth = true;
    @@ -74,5 +74,6 @@ export default function useResponsiveLayout(): ResponsiveLayoutResult {
             onboardingIsMediumOrLargerScreenWidth,
             isLargeScreenWidth,
             isSmallScreen,
    +        fontScale,
         };
     }
    diff --git a/src/hooks/useResponsiveLayout/index.ts b/src/hooks/useResponsiveLayout/index.ts
    index 3aa698e6d65..2d7082438ad 100644
    --- a/src/hooks/useResponsiveLayout/index.ts
    +++ b/src/hooks/useResponsiveLayout/index.ts
    @@ -24,7 +24,7 @@ import type ResponsiveLayoutResult from './types';
      * For more details on the various modal types we've defined for this app and implemented using react-native-modal, see `ModalType`.
      */
     export default function useResponsiveLayout(): ResponsiveLayoutResult {
    -    const {windowWidth, windowHeight} = useWindowDimensions();
    +    const {windowWidth, windowHeight, fontScale} = useWindowDimensions();
     
         // When the soft keyboard opens on mWeb, the window height changes. Use static screen height instead to get real screenHeight.
         const screenHeight = Dimensions.get('screen').height;
    @@ -77,5 +77,6 @@ export default function useResponsiveLayout(): ResponsiveLayoutResult {
             onboardingIsMediumOrLargerScreenWidth,
             isLargeScreenWidth,
             isSmallScreen,
    +        fontScale,
         };
     }
    diff --git a/src/hooks/useResponsiveLayout/types.ts b/src/hooks/useResponsiveLayout/types.ts
    index c7bb021389f..b2731d3dde3 100644
    --- a/src/hooks/useResponsiveLayout/types.ts
    +++ b/src/hooks/useResponsiveLayout/types.ts
    @@ -8,5 +8,6 @@ type ResponsiveLayoutResult = {
         isExtraSmallScreenWidth: boolean;
         isSmallScreen: boolean;
         onboardingIsMediumOrLargerScreenWidth: boolean;
    +    fontScale: number;
     };
     export default ResponsiveLayoutResult;
    diff --git a/src/hooks/useWindowDimensions/index.native.ts b/src/hooks/useWindowDimensions/index.native.ts
    index bb4b7244247..21cc252bb59 100644
    --- a/src/hooks/useWindowDimensions/index.native.ts
    +++ b/src/hooks/useWindowDimensions/index.native.ts
    @@ -1,3 +1,4 @@
    +import {useWindowDimensions} from 'react-native';
     // eslint-disable-next-line no-restricted-imports
     import {useSafeAreaFrame} from 'react-native-safe-area-context';
     import type WindowDimensions from './types';
    @@ -8,8 +9,10 @@ import type WindowDimensions from './types';
     export default function (): WindowDimensions {
         // we need to use `useSafeAreaFrame` instead of `useWindowDimensions` because of https://github.com/facebook/react-native/issues/41918
         const {width: windowWidth, height: windowHeight} = useSafeAreaFrame();
    +    const {fontScale} = useWindowDimensions();
         return {
             windowWidth,
             windowHeight,
    +        fontScale,
         };
     }
    diff --git a/src/hooks/useWindowDimensions/index.ts b/src/hooks/useWindowDimensions/index.ts
    index 8666c3f666b..59ee2985c98 100644
    --- a/src/hooks/useWindowDimensions/index.ts
    +++ b/src/hooks/useWindowDimensions/index.ts
    @@ -26,7 +26,7 @@ export default function (useCachedViewportHeight = false): WindowDimensions {
     
         const isCachedViewportHeight = useCachedViewportHeight && Browser.isMobileWebKit();
         const cachedViewportHeightWithKeyboardRef = useRef(initalViewportHeight);
    -    const {width: windowWidth, height: windowHeight} = useWindowDimensions();
    +    const {width: windowWidth, height: windowHeight, fontScale} = useWindowDimensions();
     
         // These are the same as the ones in useResponsiveLayout, but we need to redefine them here to avoid cyclic dependency.
         // When the soft keyboard opens on mWeb, the window height changes. Use static screen height instead to get real screenHeight.
    @@ -106,6 +106,7 @@ export default function (useCachedViewportHeight = false): WindowDimensions {
         const windowDimensions = {
             windowWidth,
             windowHeight: isCachedViewportHeight ? cachedViewportHeight : windowHeight,
    +        fontScale,
             responsiveLayoutResults,
         };
     
    @@ -133,8 +134,8 @@ export default function (useCachedViewportHeight = false): WindowDimensions {
         if (lockedWindowDimensionsRef.current && !isFullScreenRef.current) {
             const lastLockedWindowDimensions = {...lockedWindowDimensionsRef.current};
             unlockWindowDimensions();
    -        return {windowWidth: lastLockedWindowDimensions.windowWidth, windowHeight: lastLockedWindowDimensions.windowHeight};
    +        return {windowWidth: lastLockedWindowDimensions.windowWidth, windowHeight: lastLockedWindowDimensions.windowHeight, fontScale};
         }
     
    -    return {windowWidth: lockedWindowDimensionsRef.current.windowWidth, windowHeight: lockedWindowDimensionsRef.current.windowHeight};
    +    return {windowWidth: lockedWindowDimensionsRef.current.windowWidth, windowHeight: lockedWindowDimensionsRef.current.windowHeight, fontScale};
     }
    diff --git a/src/hooks/useWindowDimensions/types.ts b/src/hooks/useWindowDimensions/types.ts
    index 4aa19a6943f..084624ed967 100644
    --- a/src/hooks/useWindowDimensions/types.ts
    +++ b/src/hooks/useWindowDimensions/types.ts
    @@ -1,6 +1,7 @@
     type WindowDimensions = {
         windowWidth: number;
         windowHeight: number;
    +    fontScale: number;
     };
     
     export default WindowDimensions;
    
  13. roryabraham commented on Feb 5, 2025

    @roryabraham
    Contributor

    offending PR has been reverted. Closing this out

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions