App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-16] [$175] Company cards - Card drop down is not shown for cards with longer card name

Open applause-bot[bot] opened this issue 1 month ago • 42 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.5.18-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/80268778/folder/13176706/41236839/1903874097?sort=%2Bidentifier Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Android 13/ Chrome App Component: Workspace Settings

Action Performed:

  1. sign in to staging.new.expensify.com
  2. Navigate to Workspace > Workspace > Company cards
  3. Click on Add cards
  4. Add cards with commercial feed (can use dummy card details. Don't need to verify card)
  5. After adding a commercial feed card, click on Settings
  6. Change Card Name to have a longer name (eg. The big black fox jumps over the lazy dog)
  7. Navigate to Company card feed

Expected Result:

Card drop down button is displayed in along with the card name

Actual Result:

Card drop down button is not displayed for cards with longer card name

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [x] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [ ] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/4a70d8f2-4917-4096-9255-7bcfd3d74a9f

View all open jobs on GitHub

Applause Internal Information Exported by: Svetlana Lazutkina Bug ID: 7294485

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

applause-bot[bot] avatar Oct 23 '26 15:10 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/d78619382d23b5c112d8da91fd747b3ad41ed271d4385470be093078e084bbc4

applause-bot[bot] avatar Oct 23 '26 15:10 applause-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the Company cards page, a long feed name pushes the dropdown caret off screen.

What is the root cause of that problem?

In FeedSelector, the feed name and the caret sit inside CaretWrapper. That wrapper never gets a shrink style (src/components/FeedSelector.tsx:55).

The wrapper is a row View, and Views default to flexShrink: 0 (src/components/CaretWrapper.tsx:29). So it grows to the full width of the name plus the caret and overflows its parent. The text has flexShrink1 (line 58), but its parent never gets smaller, so the text never truncates. The caret, and the RBR dot if shown, end up past the visible edge.

What changes do you think we should make in order to solve the problem?

In FeedSelector, pass style={[styles.flexShrink1, styles.mw100]} to CaretWrapper. The name then truncates with an ellipsis, and the caret stays visible next to it.

DropdownButton already does this for the same reason (DropdownButton.tsx:88).

The same component also renders the Expensify Card and Card Reconciliation feed selectors, so the fix covers those too.

What alternative solutions did you explore? (Optional)

Add flexShrink1 inside CaretWrapper itself. This would change every caller, so the targeted fix above is safer.

Notes
  • Confidence: medium. The code path and the matching DropdownButton fix support this, but I didn't reproduce it in the app.
  • Company cards renders the selector from WorkspaceCompanyCardsTableHeaderButtons.tsx:128. It passes wrapperStyle={styles.flex1}, so the outer pressable is bounded. Only the inner CaretWrapper overflows.

Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/104864) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Oct 23 '26 15:10 MelvinBot

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

melvin-bot[bot] avatar Oct 23 '26 15:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 23 '26 15:10 melvin-bot[bot]

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 23 '26 15:10 melvin-bot[bot]

VERDICT: POST ROOT_CAUSE_ONELINER: In narrow layout, styles.pre (white-space: pre on web) on the card subtitle TextWithTooltip overrides the white-space: nowrap that numberOfLines={1} relies on for truncation; on iOS Safari this causes the long custom card name to expand the text element beyond the flex cell's bounds, pushing the ArrowRight action button off screen. PROPOSAL_TYPE: FIRST AUTOPOST_SAFE: YES

j3ffffff avatar Oct 23 '26 15:10 j3ffffff

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0139ed4098bdc50182

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the Company cards page, when a company card feed has a long name, the dropdown caret button is not displayed alongside the card name because the feed name overflows its container and pushes the caret off-screen.

What is the root cause of that problem?

In src/components/FeedSelector.tsx:55:

<View style={styles.flex1}>
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
        <CaretWrapper>
            <Text
                numberOfLines={1}
                style={[styles.textStrong, styles.flexShrink1]}
            >
                {feedName}
            </Text>
        </CaretWrapper>
        {shouldShowRBR && (
            <Icon
                src={expensifyIcons.DotIndicator}
                fill={theme.danger}
            />
        )}
    </View>
  1. In FeedSelector.tsx, CaretWrapper is rendered inside <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}> without a style prop.
  2. In CaretWrapper.tsx, the root container is:
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter, style]}>
    
  3. In React Native / CSS flexbox, a flex child View inside a flex row defaults to flexShrink: 0.
  4. Because CaretWrapper has flexShrink: 0 by default and has no width constraints, its layout width expands to the full unconstrained intrinsic width of {feedName} plus the caret icon width.
  5. Even though the inner <Text> component specifies styles.flexShrink1 and numberOfLines={1}, its immediate parent (CaretWrapper's View) never shrinks, preventing text truncation.
  6. Consequently, CaretWrapper overflows the parent View style={styles.flex1}, and the DownArrow icon (as well as DotIndicator if present) is pushed off to the right outside the visible viewport.

What changes do you think we should make in order to solve the problem?

In src/components/FeedSelector.tsx: Pass style={[styles.flexShrink1, styles.mw100]} to CaretWrapper:

--- a/src/components/FeedSelector.tsx
+++ b/src/components/FeedSelector.tsx
@@ -52,7 +52,7 @@ function FeedSelector({onFeedSelect, CardFeedIcon, feedName, supportingText, sho
 
             <View style={styles.flex1}>
                 <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
-                    <CaretWrapper>
+                    <CaretWrapper style={[styles.flexShrink1, styles.mw100]}>
                         <Text
                             numberOfLines={1}
                             style={[styles.textStrong, styles.flexShrink1]}

Why this solution is optimal:

  • This directly follows the established design pattern in src/components/Search/FilterDropdowns/DropdownButton.tsx:88:
    <CaretWrapper
        // Replaces flex1 with flexShrink1 so a long label truncates instead of widening the pill.
        style={[styles.flexShrink1, styles.mw100, caretWrapperStyle]}
    
  • Constraining CaretWrapper with flexShrink1 and mw100 allows it to shrink to the available width within the row (reserving space for shouldShowRBR if active).
  • The inner <Text> component correctly truncates with an ellipsis (...), and the DownArrow caret icon stays anchored immediately adjacent to the truncated name inside the visible container.
  • It is localized surgically to FeedSelector without introducing unintended side effects into other consumers of CaretWrapper.

What alternative solutions did you explore? (Optional)

  • Adding flexShrink1 inside CaretWrapper.tsx globally: Rejected because modifying the shared primitive affects all callers across the app, which could introduce subtle layout shifts in unrelated modals or headers. Applying the style prop in FeedSelector is targeted, safe, and robust.

What automated tests can you add to prevent this from re-occurring?

In tests/unit/FeedSelectorTest.tsx:

  • Render FeedSelector with a very long feedName (e.g. 100 characters).
  • Assert that CaretWrapper receives flexShrink: 1 and maxWidth: '100%'.
  • Verify that both the truncated feed name text and the caret icon are rendered within the component hierarchy.

bonnhatnguyen avatar Oct 23 '26 15:10 bonnhatnguyen

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 23 '26 15:10 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

When a company card has a long name, the dropdown caret associated with the card selector is not displayed because the name overflows its container. This prevents users from interacting with the card's dropdown options.

What is the root cause of that problem?

The root cause lies within the FeedSelector component, specifically how the CaretWrapper handles its children and its own styling. The CaretWrapper is designed to contain both the feed name (Text component) and the caret (Icon component). However, by default, View components in React Native have flexShrink: 0, meaning they do not shrink to fit their content. The CaretWrapper does not have an explicit flexShrink style applied, allowing it to expand to accommodate the full length of the feedName. This expansion causes it to overflow its parent container, pushing the caret icon off-screen. The Text component for the feedName does have flexShrink1 (src/components/FeedSelector.tsx:58), but it can only shrink if its parent allows it to. The CaretWrapper itself is rendered within a View that has styles.flex1 (src/components/Tables/WorkspaceCompanyCardsTable/WorkspaceCompanyCardsTableHeaderButtons.tsx:128), meaning the parent container has a defined width. However, the CaretWrapper's lack of flexShrink causes it to disregard this bound.

What changes do you think we should make in order to solve the problem?

To resolve this, we need to ensure that the CaretWrapper can shrink when its content overflows. This can be achieved by applying flexShrink: 1 and maxWidth: '100%' to the CaretWrapper's style. This will allow the feedName to truncate with an ellipsis when it exceeds the available space, ensuring the caret icon remains visible.

--- a/src/components/FeedSelector.tsx
+++ b/src/components/FeedSelector.tsx
@@ -55,7 +55,7 @@
                 <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
                     <CaretWrapper>
                         <Text
-                            numberOfLines={1}
+                            numberOfLines={1} // Ensures text truncates to a single line
                             style={[styles.textStrong, styles.flexShrink1]}
                         >
                             {feedName}

The CaretWrapper itself does not need modification as its children are styled appropriately. The Text component already has styles.flexShrink1. The issue is that the parent View within FeedSelector that wraps the CaretWrapper needs to allow shrinking, or the CaretWrapper needs to be constrained. A more direct approach is to ensure the Text component within CaretWrapper can be constrained.

Let's reassess the CaretWrapper and its usage:

  • CaretWrapper (src/components/CaretWrapper.tsx) renders a View with styles.flexRow, styles.gap1, and styles.alignItemsCenter. It then renders its children (which will be the Text for the feedName) and the Icon for the caret.
  • FeedSelector (src/components/FeedSelector.tsx) calls CaretWrapper and passes a Text component with numberOfLines={1} and style={[styles.textStrong, styles.flexShrink1]}.

The problem is that CaretWrapper's root View does not have flexShrink: 1. When the feedName (as a Text component with flexShrink1) is rendered inside CaretWrapper, and CaretWrapper itself does not shrink, the text cannot effectively truncate.

The most surgical fix is to apply flexShrink: 1 to the CaretWrapper's View.

--- a/src/components/CaretWrapper.tsx
+++ b/src/components/CaretWrapper.tsx
@@ -18,7 +18,7 @@
     const expensifyIcons = useMemoizedLazyExpensifyIcons(['DownArrow']);
 
     return (
-        <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter, style]}>\
+        <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter, style, styles.flexShrink1]}>
             {children}
             <Icon
                 src={expensifyIcons.DownArrow}

This change directly addresses the overflow issue by allowing the CaretWrapper to shrink, which in turn allows the Text component within it to truncate properly.

User Mutation Edge Cases (Editing/Cancelling):

  • Editing Card Name: If a user edits a card name to be longer, the flexShrink1 on CaretWrapper will ensure the name truncates, and the dropdown remains accessible. If they edit it to be shorter, the name will expand to fill the available space, and the dropdown will still be visible.
  • Cancelling Card Name Edit: If a user cancels an edit, the original card name will be restored. If the original name was short, it will display correctly. If it was long, the flexShrink1 on CaretWrapper would have already handled its display, and upon cancellation, it will render as it was before the (unsuccessful) edit. The fix is non-destructive and doesn't interfere with the state management of edits.

What alternative solutions did you explore? (Optional)

The MelvinBot proposal suggested style={[styles.flexShrink1, styles.mw100]} on CaretWrapper. Applying styles.mw100 (max-width: 100%) to CaretWrapper is redundant when flexShrink1 is present, as flexShrink1 inherently encourages the element to shrink to fit its parent if needed. The core issue is the flexShrink property of the CaretWrapper's root View. Adding flexShrink1 directly to CaretWrapper is the most targeted and efficient solution.

The alternative of adding flexShrink1 inside CaretWrapper itself was correctly identified as potentially impacting other callers. However, the CaretWrapper component's purpose is to encapsulate elements that might overflow, and thus it's a reasonable place to enforce shrinking behavior. The proposed fix directly modifies CaretWrapper.tsx to include styles.flexShrink1.

What automated tests can you add to prevent this from re-occurring?

A unit test for the FeedSelector component to verify the CaretWrapper's behavior with long text.

// src/components/FeedSelector.test.js
import React from 'react';
import {render} from '@testing-library/react-native';
import FeedSelector from '@src/components/FeedSelector';
import useThemeStyles from '@hooks/useThemeStyles';
import { View } from 'react-native';

// Mock useThemeStyles to return mock styles
jest.mock('@hooks/useThemeStyles');
jest.mock('@hooks/useTheme');
jest.mock('@hooks/useLazyAsset');

describe('FeedSelector', () => {
    beforeEach(() => {
        // Provide mock styles that include flex properties
        useThemeStyles.mockReturnValue({
            flexRow: {display: 'flex', flexDirection: 'row'},
            gap1: {gap: 4},
            gap3: {gap: 12},
            alignItemsCenter: {alignItems: 'center'},
            flexShrink1: {flexShrink: 1},
            textStrong: {fontWeight: 'bold'},
            textLabelSupporting: {fontSize: 12},
            flex1: {flex: 1}, // Added for context of parent styling
        });
    });

    const renderFeedSelector = (feedName) =>
        render(
            <FeedSelector
                onFeedSelect={jest.fn()}
                CardFeedIcon={<View testID="card-feed-icon" />}
                feedName={feedName}
            />,
        );

    it('should truncate long feed names and show the caret', () => {
        const longFeedName = 'This is a very very very very very very very very long feed name that should truncate';
        const {getByText, findByTestId} = renderFeedSelector(longFeedName);

        // Check if the feed name is present (it should be, truncated)
        // We are not asserting the exact ellipsis, but that the component renders without overflow
        expect(getByText(longFeedName)).toBeVisible();

        // Ensure the icon is rendered and accessible
        expect(findByTestId('Icon')).toBeDefined(); // Assuming the caret icon has a testID of 'Icon' or similar
    });

    it('should display the full feed name when it is short', () => {
        const shortFeedName = 'Short Name';
        const {getByText} = renderFeedSelector(shortFeedName);

        expect(getByText(shortFeedName)).toBeVisible();
    });
});

Note on CaretWrapper testing: A more robust test might involve mocking the Icon component to specifically test the layout of CaretWrapper when given long text, verifying that the View within CaretWrapper indeed has flexShrink: 1 and that the Text component's width is constrained. However, the proposed test focuses on the observable behavior of FeedSelector with its children. For the purpose of preventing recurrence, ensuring the flexShrink1 is applied and tested is key.

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83

camesenin avatar Oct 23 '26 17:10 camesenin

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 23 '26 17:10 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01b6be874e7d6b47d1

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the Company cards page, when a company card feed has a long name, the dropdown caret button is not displayed alongside the card name because the feed name overflows its container and pushes the caret icon off-screen.

What is the root cause of that problem?

In src/components/FeedSelector.tsx:

<View style={styles.flex1}>
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
        <CaretWrapper>
            <Text
                numberOfLines={1}
                style={[styles.textStrong, styles.flexShrink1]}
            >
                {feedName}
            </Text>
        </CaretWrapper>
        {shouldShowRBR && (
            <Icon
                src={expensifyIcons.DotIndicator}
                fill={theme.danger}
            />
        )}
    </View>
  1. In FeedSelector.tsx, CaretWrapper is rendered inside <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}> without passing a style prop.
  2. In src/components/CaretWrapper.tsx:29, the root view defaults to <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter, style]}>.
  3. In React Native / CSS flexbox, a flex child View inside a flex row defaults to flexShrink: 0.
  4. Because CaretWrapper has flexShrink: 0 by default and no max-width constraint, its layout width expands to the full unconstrained intrinsic width of {feedName} plus the caret icon width.
  5. Even though the inner <Text> component specifies styles.flexShrink1 and numberOfLines={1}, its immediate parent (CaretWrapper's View) never shrinks, preventing text truncation.
  6. Consequently, CaretWrapper overflows the parent View style={styles.flex1}, and the DownArrow icon (as well as DotIndicator if present) is pushed off to the right outside the visible viewport.

What changes do you think we should make in order to solve the problem?

In src/components/FeedSelector.tsx, pass style={[styles.flexShrink1, styles.mw100]} to CaretWrapper:

// src/components/FeedSelector.tsx:55
<View style={styles.flex1}>
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
        <CaretWrapper style={[styles.flexShrink1, styles.mw100]}>
            <Text
                numberOfLines={1}
                style={[styles.textStrong, styles.flexShrink1]}
            >
                {feedName}
            </Text>
        </CaretWrapper>
        {shouldShowRBR && (
            <Icon
                src={expensifyIcons.DotIndicator}
                fill={theme.danger}
            />
        )}
    </View>
    <Text
        numberOfLines={1}
        style={styles.textLabelSupporting}
    >
        {supportingText}
    </Text>
</View>

Why this solution is optimal:

  • This directly follows the established design pattern in src/components/Search/FilterDropdowns/DropdownButton.tsx:88:
    <CaretWrapper
        // Replaces flex1 with flexShrink1 so a long label truncates instead of widening the pill.
        style={[styles.flexShrink1, styles.mw100, caretWrapperStyle]}
    
  • Constraining CaretWrapper with flexShrink1 and mw100 allows it to shrink to the available width within the row (leaving space for shouldShowRBR if active).
  • The inner <Text> component correctly truncates with an ellipsis (...), and the DownArrow caret icon stays anchored immediately adjacent to the truncated name inside the visible container.
  • It is localized surgically to FeedSelector without introducing unintended side effects into other consumers of CaretWrapper.

What specific scenarios should we cover in automated tests?

In tests/unit/FeedSelectorTest.tsx:

  1. Truncation & Caret Visibility with Long Feed Name:
    • Render FeedSelector with a long feed name (e.g. 100 characters).
    • Assert that CaretWrapper receives styles.flexShrink1 and styles.mw100.
    • Verify that both the truncated text and the caret DownArrow icon remain within the component layout hierarchy.
  2. Short Feed Name:
    • Render FeedSelector with a short feed name (e.g. "Chase").
    • Assert that the full text is displayed without unnecessary clipping and the caret sits directly adjacent to it.
  3. RBR Indicator Preservation:
    • Render FeedSelector with a long feed name and shouldShowRBR={true}.
    • Assert that DotIndicator icon remains visible and is not pushed off the row.

What alternative solutions did you explore? (Optional)

  • Adding flexShrink1 inside CaretWrapper.tsx globally: Rejected because modifying the shared primitive affects all callers across the app, which could introduce subtle layout shifts in unrelated modals or headers. Applying the style prop in FeedSelector is targeted, safe, and robust.

ADITYASINGH1206 avatar Oct 24 '26 13:10 ADITYASINGH1206

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 24 '26 13:10 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~010415b62c29eb990f

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the Company cards page, when a company card feed has a long name, the dropdown caret button is pushed off-screen and disappears because the feed name overflows its container.

What is the root cause of that problem?

In src/components/FeedSelector.tsx (lines 53-65):

<View style={styles.flex1}>
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
        <CaretWrapper>
            <Text
                numberOfLines={1}
                style={[styles.textStrong, styles.flexShrink1]}
            >
                {feedName}
            </Text>
        </CaretWrapper>
  1. CaretWrapper is rendered inside a row flex container without an explicit shrink style.
  2. Under React Native / Flexbox layout rules, a View component defaults to flexShrink: 0.
  3. Because CaretWrapper's root View has flexShrink: 0 and unconstrained width, it expands to accommodate the full intrinsic layout width of {feedName} plus the caret icon.
  4. Even though the child <Text> component specifies styles.flexShrink1 and numberOfLines={1}, its immediate parent (CaretWrapper) never contracts. As a result, the text cannot measure an ellipsis boundary, and the entire CaretWrapper (along with the caret icon and any adjacent status indicator) overflows past the right edge of the viewport.

What changes do you think we should make in order to solve the problem?

Following the established pattern in src/components/Search/FilterDropdowns/DropdownButton.tsx (line 88), pass style={[styles.flexShrink1, styles.mw100]} to <CaretWrapper> in src/components/FeedSelector.tsx:

<View style={styles.flex1}>
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
        <CaretWrapper style={[styles.flexShrink1, styles.mw100]}>
            <Text
                numberOfLines={1}
                style={[styles.textStrong, styles.flexShrink1]}
            >
                {feedName}
            </Text>
        </CaretWrapper>
        {shouldShowRBR && (
            <Icon
                src={expensifyIcons.DotIndicator}
                fill={theme.danger}
            />
        )}
    </View>

Why this is the cleanest solution:

  • Applying styles.flexShrink1 and styles.mw100 specifically to the consumer in FeedSelector.tsx ensures CaretWrapper properly contracts within its parent View (flex: 1) without leaking unwanted layout changes to other consumers of CaretWrapper.tsx.
  • The feed name properly truncates with an ellipsis (...) while ensuring both the DownArrow caret and the optional RBR DotIndicator remain fully visible and clickable.

What alternative solutions did you explore? (Optional)

  • Modifying CaretWrapper.tsx directly: Adding flexShrink: 1 inside CaretWrapper.tsx's root container was explored, but modifying shared primitive containers can introduce regressions across other screens that rely on natural intrinsic width. Passing the style at the call site in FeedSelector.tsx aligns with DropdownButton.tsx and eliminates regression risk.

What automated tests can you add to prevent this from re-occurring?

Add a unit test in tests/unit/FeedSelectorTest.tsx:

  • Render <FeedSelector> with a very long card name (e.g. 'A'.repeat(120)).
  • Verify that <CaretWrapper> has flexShrink: 1 and maxWidth: '100%' applied in its style hierarchy.
  • Verify that the dropdown caret icon (DownArrow) is rendered and remains part of the accessible button layout alongside the truncated feed name.

Enes2553 avatar Oct 24 '26 15:10 Enes2553

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 24 '26 15:10 melvin-bot[bot]

Proposal

Please re-state the problem that we are trying to solve in this issue.

On the Company cards page, when a card feed has a long name, the feed name in FeedSelector does not truncate with an ellipsis and instead pushes the dropdown caret icon (and optional RBR dot indicator) off the right edge of the selector button.

What is the root cause of that problem?

In src/components/FeedSelector.tsx:53-65:

<View style={styles.flex1}>
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
        <CaretWrapper>
            <Text
                numberOfLines={1}
                style={[styles.textStrong, styles.flexShrink1]}
            >
                {feedName}
            </Text>
        </CaretWrapper>
        {shouldShowRBR && (
            <Icon
                src={expensifyIcons.DotIndicator}
                fill={theme.danger}
            />
        )}
    </View>
    <Text
        numberOfLines={1}
        style={styles.textLabelSupporting}
    >
        {supportingText}
    </Text>
</View>

And in src/components/CaretWrapper.tsx:29:

<View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter, style]}>
    {children}
    <Icon
        src={expensifyIcons.DownArrow}
        fill={theme.icon}
        width={variables.iconSizeExtraSmall}
        height={variables.iconSizeExtraSmall}
    />
</View>

There are two flex-shrinking constraints missing in FeedSelector.tsx:

  1. CaretWrapper is a View flex item inside <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>, and FeedSelector passes no style prop to <CaretWrapper>. In React Native / React Native Web, View defaults to flexShrink: 0 and minWidth: 'auto'. Because CaretWrapper never shrinks below the intrinsic single-line width of {feedName} plus the DownArrow icon, the inner <Text numberOfLines={1} style={[styles.textStrong, styles.flexShrink1]}> always sees a parent wide enough for the full string and never truncates.
  2. In addition, the outer text column <View style={styles.flex1}> (line 53) and <CaretWrapper> (line 55) need styles.mnw0 (minWidth: 0) alongside styles.flexShrink1, styles.mw100 on <CaretWrapper>. Note that when shouldShowRBR is true, <CaretWrapper> shares the row with the DotIndicator icon (20px + 4px gap); relying on styles.mw100 (maxWidth: '100%') alone without styles.mnw0 allows CaretWrapper to take 100% of the row width and still push DotIndicator out of bounds on web flex layout.

What changes do you think we should make in order to solve the problem?

In src/components/FeedSelector.tsx (lines 53-55), add styles.mnw0 to the styles.flex1 container and pass style={[styles.flexShrink1, styles.mnw0, styles.mw100]} to <CaretWrapper> (matching the pattern in src/components/Search/FilterDropdowns/DropdownButton.tsx:88 while ensuring minWidth: 0 when shouldShowRBR is present):

<View style={[styles.flex1, styles.mnw0]}>
    <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
        <CaretWrapper style={[styles.flexShrink1, styles.mnw0, styles.mw100]}>
            <Text
                numberOfLines={1}
                style={[styles.textStrong, styles.flexShrink1]}
            >
                {feedName}
            </Text>
        </CaretWrapper>
        {shouldShowRBR && (
            <Icon
                src={expensifyIcons.DotIndicator}
                fill={theme.danger}
            />
        )}
    </View>

What alternative solutions did you explore? (Optional)

  • Modifying CaretWrapper.tsx directly to always apply styles.flexShrink1: Rejected because CaretWrapper is a shared primitive used in other components that pass their own layout styles via the style prop. Passing style={[styles.flexShrink1, styles.mnw0, styles.mw100]} in FeedSelector.tsx fixes Company Cards, Expensify Card, and Card Reconciliation feed selectors without affecting unrelated callers.

xian96xx avatar Oct 26 '26 01:10 xian96xx

📣 @xian96xx! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Oct 26 '26 01:10 melvin-bot[bot]

Contributor details

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Workspace > Company cards, when a company card feed has a long name, the dropdown caret button (DownArrow icon) is pushed off-screen and not displayed.

What is the root cause of that problem?

In src/components/FeedSelector.tsx (lines 54–69):

<View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
    <CaretWrapper>
        <Text
            numberOfLines={1}
            style={[styles.textStrong, styles.flexShrink1]}
        >
            {feedName}
        </Text>
    </CaretWrapper>
    {shouldShowRBR && (
        <Icon
            src={expensifyIcons.DotIndicator}
            fill={theme.danger}
        />
    )}
</View>

And inside src/components/CaretWrapper.tsx (lines 28–39):

function CaretWrapper({children, style, caretWidth, caretHeight, isActive = false}: CaretWrapperProps) {
    return (
        <View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter, style]}>
            {children}
            <Icon
                src={expensifyIcons.DownArrow}
...

Even though the inner <Text> element has styles.flexShrink1, its parent container <CaretWrapper> does NOT have styles.flexShrink1. In flexbox layout, <CaretWrapper> expands to accommodate the text measurement and its outer container pushes the caret <Icon> outside the available screen width. Furthermore, <Icon> inside CaretWrapper does not have styles.flexShrink0 to guarantee that the caret remains strictly visible and never shrinks away.

What changes do you think we should make in order to solve the problem?

  1. In src/components/FeedSelector.tsx: Pass style={styles.flexShrink1} to <CaretWrapper>:

    <CaretWrapper style={styles.flexShrink1}>
        <Text
            numberOfLines={1}
            style={[styles.textStrong, styles.flexShrink1]}
        >
            {feedName}
        </Text>
    </CaretWrapper>
    
  2. In src/components/CaretWrapper.tsx:

    • Ensure the caret icon has styles.flexShrink0 so it will never be compressed or pushed off even in very tight constraints:
    <Icon
        src={expensifyIcons.DownArrow}
        fill={theme.icon}
        width={caretWidth ?? variables.iconSizeExtraSmall}
        height={caretHeight ?? variables.iconSizeExtraSmall}
        additionalStyles={[styles.flexShrink0, isActive ? styles.flipUpsideDown : undefined]}
    />
    

What alternative solutions did you explore? (Optional)

Setting maxWidth on the text element, but applying flexShrink1 to CaretWrapper and flexShrink0 to the caret icon is the idiomatic, fully responsive React Native solution across all platforms and font sizes.

fangjian-bit avatar Oct 26 '26 02:10 fangjian-bit

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 26 '26 02:10 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~015ef940ed32e0c10f

xian96xx avatar Oct 26 '26 02:10 xian96xx

⚠️ Invalid email. Please make sure to create an Expensify account with this email first here.

melvin-bot[bot] avatar Oct 26 '26 02:10 melvin-bot[bot]