Skip to content

Commit adab45b

Browse files
authored
Merge pull request Expensify#71876 from dmkt9/fix/71353
Fix/71353 - The tooltip does not follow the Manager's icon properly
2 parents 26e9e00 + e3e378e commit adab45b

6 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {BaseListItemProps, ExtendedTargetedEvent, ListItem, SelectionListPr
1111
type BaseSelectionListItemRendererProps<TItem extends ListItem> = Omit<BaseListItemProps<TItem>, 'onSelectRow'> &
1212
Pick<SelectionListProps<TItem>, 'ListItem' | 'shouldIgnoreFocus' | 'shouldSingleExecuteRowSelect' | 'canShowProductTrainingTooltip'> & {
1313
index: number;
14+
sectionIndex?: number;
1415
selectRow: (item: TItem, indexToFocus?: number) => void;
1516
setFocusedIndex: ReturnType<typeof useArrowKeyFocusManager>[1];
1617
normalizedIndex: number;
@@ -27,6 +28,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
2728
ListItem,
2829
item,
2930
index,
31+
sectionIndex,
3032
isFocused,
3133
isDisabled,
3234
showTooltip,
@@ -113,6 +115,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
113115
userBillingFundID={userBillingFundID}
114116
index={index}
115117
shouldShowRightCaret={shouldShowRightCaret}
118+
sectionIndex={sectionIndex}
116119
/>
117120
{item.footerContent && item.footerContent}
118121
</>

src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
658658
}}
659659
shouldUseDefaultRightHandSideCheckmark={shouldUseDefaultRightHandSideCheckmark}
660660
index={index}
661+
sectionIndex={section?.indexOffset}
661662
isFocused={isItemFocused}
662663
isDisabled={isDisabled}
663664
showTooltip={shouldShowTooltips}

src/components/SelectionListWithSections/InviteMemberListItem.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ function InviteMemberListItem<TItem extends ListItem>({
3434
shouldSyncFocus,
3535
wrapperStyle,
3636
canShowProductTrainingTooltip = true,
37+
index = 0,
38+
sectionIndex = 0,
3739
}: InviteMemberListItemProps<TItem>) {
3840
const styles = useThemeStyles();
3941
const theme = useTheme();
@@ -107,6 +109,7 @@ function InviteMemberListItem<TItem extends ListItem>({
107109
shiftHorizontal={variables.inviteMemberListItemTooltipShiftHorizontal}
108110
shouldHideOnNavigate
109111
wrapperStyle={styles.productTrainingTooltipWrapper}
112+
uniqueID={`${sectionIndex}-${index}`}
110113
>
111114
<View style={[styles.flexRow, styles.alignItemsCenter, styles.flex1]}>
112115
{(!!item.reportID || !!accountID || !!item.text || !!item.alternateText) && (

src/components/SelectionListWithSections/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ type TransactionSelectionListItem<TItem extends ListItem> = ListItemProps<TItem>
487487
type InviteMemberListItemProps<TItem extends ListItem> = UserListItemProps<TItem> & {
488488
/** Whether product training tooltips can be displayed */
489489
canShowProductTrainingTooltip?: boolean;
490+
index?: number;
491+
sectionIndex?: number;
490492
};
491493

492494
type UserSelectionListItemProps<TItem extends ListItem> = UserListItemProps<TItem>;

src/components/Tooltip/EducationalTooltip/BaseEducationalTooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type LayoutChangeEventWithTarget = NativeSyntheticEvent<{layout: LayoutRectangle
1616
* A component used to wrap an element intended for displaying a tooltip.
1717
* This tooltip would show immediately without user's interaction and hide after 5 seconds.
1818
*/
19-
function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNavigate = true, shouldHideOnScroll = false, ...props}: EducationalTooltipProps) {
19+
function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNavigate = true, shouldHideOnScroll = false, uniqueID, ...props}: EducationalTooltipProps) {
2020
const genericTooltipStateRef = useRef<GenericTooltipState | undefined>(undefined);
2121
const tooltipElementRef = useRef<Readonly<NativeMethods> | undefined>(undefined);
2222

@@ -82,7 +82,7 @@ function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNav
8282
// This is necessary to ensure the tooltip is positioned correctly after resizing
8383
renderTooltip();
8484
}
85-
}, [isResizing, renderTooltip, shouldRender]);
85+
}, [isResizing, renderTooltip, shouldRender, uniqueID]);
8686

8787
const setTooltipPosition = useCallback(
8888
(isScrolling: boolean) => {

src/components/Tooltip/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ type EducationalTooltipProps = ChildrenProps &
103103

104104
/** Whether the tooltip should hide during scrolling */
105105
shouldHideOnScroll?: boolean;
106+
107+
uniqueID?: string;
106108
};
107109

108110
type TooltipExtendedProps = (EducationalTooltipProps | TooltipProps) & {

0 commit comments

Comments
 (0)