Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LHN display name ellipsis doesn't show tooltip when the text is updated #28598

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading