diff --git a/native/navigation/tooltip.react.js b/native/navigation/tooltip.react.js --- a/native/navigation/tooltip.react.js +++ b/native/navigation/tooltip.react.js @@ -432,6 +432,45 @@ return style; } + get reactionSelectionPopoverContainerStyle() { + const { dimensions, route } = this.props; + const { initialCoordinates, verticalBounds } = route.params; + const { x, y, width, height } = initialCoordinates; + const { margin, reactionSelectionPopoverLocation } = this; + + const style = {}; + + style.position = 'absolute'; + (style.alignItems = 'center'), + (style.opacity = this.tooltipContainerOpacity); + style.transform = [{ translateX: this.tooltipHorizontal }]; + + const extraLeftSpace = x; + const extraRightSpace = dimensions.width - width - x; + if (extraLeftSpace < extraRightSpace) { + style.left = 0; + style.minWidth = width + 2 * extraLeftSpace; + } else { + style.right = 0; + style.minWidth = width + 2 * extraRightSpace; + } + + if (reactionSelectionPopoverLocation === 'above') { + style.bottom = + dimensions.height - Math.max(y, verticalBounds.y) + margin; + style.transform.push({ translateY: this.tooltipVerticalAbove }); + } else { + style.top = + Math.min(y + height, verticalBounds.y + verticalBounds.height) + + margin; + style.transform.push({ translateY: this.tooltipVerticalBelow }); + } + + style.transform.push({ scale: this.tooltipScale }); + + return style; + } + render() { const { dimensions,