Skip to content

Commit

Permalink
revert comment and use function destructure
Browse files Browse the repository at this point in the history
  • Loading branch information
teneeto committed Oct 11, 2023
1 parent 4a26dd7 commit d6f8379
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/components/Hoverable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class Hoverable extends Component {
if (!scrolling && this.isHoveredRef) {
this.setState({isHovered: this.isHoveredRef}, this.props.onHoverIn);
} else if (scrolling && this.isHoveredRef) {
/**
* If the user has started scrolling and the isHoveredRef is true, then we should set the hover state to false.
* This is to hide the existing hover and reaction bar.
*/
this.setState({isHovered: false}, this.props.onHoverOut);
}
this.isScrollingRef = scrolling;
Expand Down
9 changes: 4 additions & 5 deletions src/components/Tooltip/BaseTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'underscore';
import React, {memo, useCallback, useEffect, useRef, useState} from 'react';
import {Animated} from 'react-native';
import {BoundsObserver} from '@react-ng/bounds-observer';
import Str from 'expensify-common/lib/str';
import TooltipRenderedOnPageBody from './TooltipRenderedOnPageBody';
import Hoverable from '../Hoverable';
import * as tooltipPropTypes from './tooltipPropTypes';
Expand Down Expand Up @@ -53,9 +54,7 @@ function chooseBoundingBox(target, clientX, clientY) {
return bbs[0];
}

function Tooltip(props) {
const {children, numberOfLines, maxWidth, text, renderTooltipContent, renderTooltipContentKey, shouldHandleScroll} = props;

function Tooltip({children, numberOfLines, maxWidth, text, renderTooltipContent, renderTooltipContentKey, shouldHandleScroll, shiftHorizontal, shiftVertical}) {
const {preferredLocale} = useLocalize();
const {windowWidth} = useWindowDimensions();

Expand Down Expand Up @@ -183,8 +182,8 @@ function Tooltip(props) {
yOffset={yOffset}
targetWidth={wrapperWidth}
targetHeight={wrapperHeight}
shiftHorizontal={_.result(props, 'shiftHorizontal')}
shiftVertical={_.result(props, 'shiftVertical')}
shiftHorizontal={Str.result(shiftHorizontal)}
shiftVertical={Str.result(shiftVertical)}
text={text}
maxWidth={maxWidth}
numberOfLines={numberOfLines}
Expand Down

0 comments on commit d6f8379

Please sign in to comment.