Skip to content

Commit

Permalink
Merge pull request #28598 from bernhardoj/fix/27545-display-name-tool…
Browse files Browse the repository at this point in the history
…tips

Fix LHN display name ellipsis doesn't show tooltip when the text is updated
  • Loading branch information
Beamanator authored Oct 2, 2023
2 parents 19a5119 + c515d6f commit 1f31305
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/components/DisplayNames/DisplayNamesWithTooltip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {Fragment, useCallback, useEffect, useRef, useState} from 'react';
import React, {Fragment, useCallback, useRef} from 'react';
import {View} from 'react-native';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import styles from '../../styles/styles';
import Text from '../Text';
import Tooltip from '../Tooltip';
Expand All @@ -10,13 +11,7 @@ import {defaultProps, propTypes} from './displayNamesPropTypes';
function DisplayNamesWithToolTip(props) {
const containerRef = useRef(null);
const childRefs = useRef([]);
const [isEllipsisActive, setIsEllipsisActive] = useState(false);

useEffect(() => {
setIsEllipsisActive(
containerRef.current && containerRef.current.offsetWidth && containerRef.current.scrollWidth && containerRef.current.offsetWidth < containerRef.current.scrollWidth,
);
}, []);
const isEllipsisActive = lodashGet(containerRef.current, 'offsetWidth') < lodashGet(containerRef.current, 'scrollWidth');

/**
* We may need to shift the Tooltip horizontally as some of the inline text wraps well with ellipsis,
Expand Down

0 comments on commit 1f31305

Please sign in to comment.