Skip to content

[HOLD for payment 2024-08-09] [$250] Distance - Page is not scrollable after adding multiple stops #42577

Closed

Description

@izarutskaya

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: 1.4.75-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4572868
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Click on FAB > Submit expense > Distance tab
  2. Add a start waypoint, a finish waypoint, and multiple stops
  3. Try to Scroll the page
  4. Do step 1 - 3 on mWeb

Expected Result:

Page becomes scrollable to view the whole content after adding multiple waypoints (Same behavior as in mWeb)

Actual Result:

Page is not scrollable to view the whole content after adding multiple waypoints which is a different behavior compared to mWeb.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6490254_1716535967530.Screen_Recording_20240524_102844_New_Expensify.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014d91998739178ee2
  • Upwork Job ID: 1795722148596056064
  • Last Price Increase: 2024-06-05
  • Automatic offers:
    • Krishna2323 | Contributor | 102695130
Issue OwnerCurrent Issue Owner: @stephanieelliott

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 24, 2024
  2. melvin-bot commented on May 24, 2024

    @melvin-bot

    Triggered auto assignment to @stephanieelliott (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. izarutskaya commented on May 24, 2024

    @izarutskaya
    Author

    We think this issue might be related to the #collect project.

  4. Krishna2323 commented on May 24, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Distance - Page is not scrollable after adding multiple stops

    What is the root cause of that problem?

    The footer (map) for android is rendered separately from the DraggableFlatList (not as a footer of the list) and DraggableFlatList and ListFooterComponent is wrapped in a View instead of ScrollView.

    <View style={styles.flex1}>
    <DraggableFlatList
    ref={ref}
    containerStyle={ListFooterComponent ? undefined : styles.flex1}
    contentContainerStyle={ListFooterComponent ? undefined : styles.flexGrow1}
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...viewProps}
    />
    {React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
    </View>
    );

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

    We can use NestableScrollContainer & NestableDraggableFlatList.

            <NestableScrollContainer
                ref={ref}
                contentContainerStyle={styles.flexGrow1}
            >
                <NestableDraggableFlatList
                    contentContainerStyle={styles.flex1}
                    // eslint-disable-next-line react/jsx-props-no-spreading
                    {...viewProps}
                />
                {React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
            </NestableScrollContainer>

    There will be a console error when we will use NestableDraggableFlatList.tsx and thats because of this code using findNodeHandle(scrollableRef.current); instead of passing scrollableRef.current directly to ontainerRef.current.measureLayout. It is also mentioned here. We can open an issue/PR to update that in react-native-draggable-flatlist.

    Result

    scroll_issue_distance_page.mp4
    Alternatives

    What alternative solutions did you explore? (Optional)

    1. Remove the view and wrap
                <ScrollView style={styles.flex1}>
                    <DraggableList
                        data={waypointsList}
                        keyExtractor={(item) => item}
                        shouldUsePortal
                        onDragEnd={updateWaypoints}
                        ref={scrollViewRef}
                        renderItem={renderItem}
                        ListFooterComponent={
                            <DistanceRequestFooter
                                waypoints={waypoints}
                                navigateToWaypointEditPage={navigateToWaypointEditPage}
                                transaction={transaction}
                            />
                        }
                    />
                </ScrollView>
    1. This only happens on android, so we can in the android file only, We can't use the ListFooterComponent because it was removed intentionally to solve [HOLD for payment 2024-05-20] CRITICAL: [P2P Distance] [$500] Enable immediate slide scrolling without tap #40211.

    <View style={styles.flex1}>
    <DraggableFlatList
    ref={ref}
    containerStyle={ListFooterComponent ? undefined : styles.flex1}
    contentContainerStyle={ListFooterComponent ? undefined : styles.flexGrow1}
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...viewProps}
    />
    {React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
    </View>

    To:

            <ScrollView contentContainerStyle={{flexGrow: 1}}>
                <DraggableFlatList
                    ref={ref}
                    containerStyle={ListFooterComponent ? undefined : styles.flex1}
                    contentContainerStyle={ListFooterComponent ? undefined : styles.flexGrow1}
                    // eslint-disable-next-line react/jsx-props-no-spreading
                    {...viewProps}
                />
                {React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
            </ScrollView>

    We can wrap both elements in ScrollView and disable the scroll functionality of DraggableFlatList.

            <ScrollView contentContainerStyle={styles.flexGrow1}>
                <DraggableFlatList
                    ref={ref}
                    containerStyle={ListFooterComponent ? undefined : styles.flex1}
                    contentContainerStyle={ListFooterComponent ? undefined : styles.flexGrow1}
                    scrollEnabled={false}
                    // eslint-disable-next-line react/jsx-props-no-spreading
                    {...viewProps}
                />
                {React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
            </ScrollView>

    Result

    distance_rate_scroll_issue.mp4
  5. allgandalf commented on May 25, 2024

    @allgandalf
    Contributor

    Proposal

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

    Only for Android, Page is not scrollabe when we add multiple stops for distance request.

    What is the root cause of that problem?

    This is bug is for android specific platform because in the Native file, we have wrapped the DraggableList in a View:

    <View style={styles.flex1}>
    <DraggableFlatList

    This was because we also display the component ListFooterComponent:

    {React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
    </View>

    Due to which we are unable to scroll on Android.

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

    We need to make a function for ListFooterComponent and pass it as a prop ListFooterComponent to DraggableFlatList:

    diff --git a/src/components/DraggableList/index.android.tsx b/src/components/DraggableList/index.android.tsx
    index 30bf7c927b..70b2557e8b 100644
    --- a/src/components/DraggableList/index.android.tsx
    +++ b/src/components/DraggableList/index.android.tsx
    @@ -7,17 +7,20 @@ import type {DraggableListProps} from './types';
     
     function DraggableList<T>({renderClone, shouldUsePortal, ListFooterComponent, ...viewProps}: DraggableListProps<T>, ref: React.ForwardedRef<FlatList<T>>) {
         const styles = useThemeStyles();
    +
    +    const FooterComponent = () => {
    +        return <View style={styles.flexGrow1}>{React.isValidElement(ListFooterComponent) && ListFooterComponent}</View>;
    +    };
    +
         return (
    -        <View style={styles.flex1}>
    -            <DraggableFlatList
    -                ref={ref}
    -                containerStyle={ListFooterComponent ? undefined : styles.flex1}
    -                contentContainerStyle={ListFooterComponent ? undefined : styles.flexGrow1}
    -                // eslint-disable-next-line react/jsx-props-no-spreading
    -                {...viewProps}
    -            />
    -            {React.isValidElement(ListFooterComponent) && <View style={styles.flexGrow1}>{ListFooterComponent}</View>}
    -        </View>
    +        <DraggableFlatList
    +            ref={ref}
    +            containerStyle={ListFooterComponent ? undefined : styles.flex1}
    +            contentContainerStyle={ListFooterComponent ? undefined : styles.flexGrow1}
    +            // eslint-disable-next-line react/jsx-props-no-spreading
    +            {...viewProps}
    +            ListFooterComponent={FooterComponent}
    +        />
         );
     }
     

    Result Video

    Details
    Screen.Recording.2024-05-25.at.2.45.49.PM.mov
  6. Krishna2323 commented on May 25, 2024

    @Krishna2323
    Contributor

    Proposal updated

    • Added alternative option 2
  7. melvin-bot commented on May 27, 2024

    @melvin-bot

    @stephanieelliott Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 29, 2024
  9. changed the title [-]Distance - Page is not scrollable after adding multiple stops[/-] [+][$250] Distance - Page is not scrollable after adding multiple stops[/+] on May 29, 2024
  10. melvin-bot commented on May 29, 2024

    @melvin-bot
  11. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on May 29, 2024
  12. 56 remaining items

  13. melvin-bot commented on Aug 2, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.15-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-08-09. 🎊

    For reference, here are some details about the assignees on this issue:

  14. melvin-bot commented on Aug 2, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
    • [@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@mollfpr] Determine if we should create a regression test for this bug.
    • [@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@stephanieelliott] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  15. stephanieelliott commented on Aug 10, 2024

    @stephanieelliott
    Contributor

    Summarizing payment on this issue:

    • Contributor: @Krishna2323 $250 - PAID via Upwork
    • Contributor+: @mollfpr $250 - please request via ND

    Upwork job is here: https://www.upwork.com/jobs/~1737876297360310272

  16. stephanieelliott commented on Aug 10, 2024

    @stephanieelliott
    Contributor

    @mollfpr can you please complete the BZ checklist for this issue?

  17. mollfpr commented on Aug 12, 2024

    @mollfpr
    Contributor

    [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
    [@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

    I couldn't find the offending PR.

    [@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

    The regression step should be good.

    [@mollfpr] Determine if we should create a regression test for this bug.
    [@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

    1. Click on FAB > Submit expense > Distance tab
    2. Add a start waypoint, a finish waypoint, and multiple stops
    3. Verify page is scrollable after the content overflows
    4. 👍 or 👎
  18. JmillsExpensify commented on Aug 12, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @mollfpr

  19. melvin-bot commented on Aug 13, 2024

    @melvin-bot

    @mollfpr, @stephanieelliott, @stitesExpensify, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  20. stephanieelliott commented on Aug 13, 2024

    @stephanieelliott
    Contributor

    Test case issue created: https://github.com/Expensify/Expensify/issues/420216

    All done here, thanks!

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 productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions