-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [IOBP-950] Filter tabs behavior into biz events notices list (#6363
) ## Short description This PR fixes a strange behavior on the filter tabs in the notices list screen. When the user taps on a tab and it become selected, it seems that doesn't stay in "active" mode. This PR fixes it preventing unnecessary rerendering. ## List of changes proposed in this pull request - Memoized the `SectionListHeaderTitle` component to avoid unnecessary re-renders that causes an issue with the component animation of the TabItem that loses the focus state. ## How to test - Open the `Pagamenti` section. - Tap on the CTA `Vedi tutte`. - Tap on any of the three available tabs in the list and check that the color is the one that marks the active state.
- Loading branch information
Showing
3 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
ts/features/payments/bizEventsTransaction/components/PaymentBizEventsSectionListHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as React from "react"; | ||
import { H2, VSpacer } from "@pagopa/io-app-design-system"; | ||
import { LayoutChangeEvent, View } from "react-native"; | ||
import I18n from "../../../../i18n"; | ||
import { PaymentBizEventsCategoryFilter } from "../types"; | ||
import { PaymentsBizEventsFilterTabs } from "./PaymentsBizEventsFilterTabs"; | ||
|
||
type PaymentBizEventsSectionListHeaderProps = { | ||
onLayout: (event: LayoutChangeEvent) => void; | ||
selectedCategory: PaymentBizEventsCategoryFilter; | ||
onCategorySelected: (category: PaymentBizEventsCategoryFilter) => void; | ||
}; | ||
|
||
export const PaymentBizEventsSectionListHeader = React.memo( | ||
({ | ||
onLayout, | ||
selectedCategory, | ||
onCategorySelected | ||
}: PaymentBizEventsSectionListHeaderProps) => ( | ||
<View onLayout={onLayout}> | ||
<H2 | ||
accessibilityLabel={I18n.t("features.payments.transactions.title")} | ||
accessibilityRole="header" | ||
> | ||
{I18n.t("features.payments.transactions.title")} | ||
</H2> | ||
<VSpacer size={16} /> | ||
<PaymentsBizEventsFilterTabs | ||
selectedCategory={selectedCategory} | ||
onCategorySelected={onCategorySelected} | ||
/> | ||
</View> | ||
), | ||
(prevProps, nextProps) => | ||
prevProps.selectedCategory === nextProps.selectedCategory | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters