Skip to content

Commit

Permalink
convert to a simple var
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Oct 2, 2023
1 parent 09e3d0d commit c515d6f
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 c515d6f

Please sign in to comment.