Skip to content

Commit

Permalink
Avoid unnecessary calculation or animation if tooltip is invisible (#…
Browse files Browse the repository at this point in the history
…32289)

Previously an animation would run on a invisible tooltip. This resulted
in the tooltip being rendered, but invisible, indefinitely. This caused
issues for tapping targets rendered beneath the invisible tooltip.
  • Loading branch information
dcalhoun authored May 27, 2021
1 parent 938fc9e commit 7b906f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/components/src/tooltip/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ const Tooltip = ( {

// Manage tooltip visibility and position in relation to keyboard
useEffect( () => {
if ( ! visible ) {
return;
}

// Update tooltip position if keyboard is visible
if ( keyboardVisible ) {
getReferenceElementPosition();
Expand All @@ -129,7 +133,7 @@ const Tooltip = ( {
setAnimating( true );
setVisible( false );
}
}, [ keyboardVisible ] );
}, [ visible, keyboardVisible ] );

// Manage tooltip position during keyboard frame changes
useEffect( () => {
Expand Down

0 comments on commit 7b906f0

Please sign in to comment.