77 UIManager ,
88 type LayoutRectangle ,
99 Dimensions ,
10+ Platform ,
1011} from 'react-native' ;
1112
1213type TooltipPosition =
@@ -29,6 +30,7 @@ type HighlightOverlayProps = {
2930 tooltipPosition ?: TooltipPosition ;
3031 offset ?: { x ?: number ; y ?: number } ;
3132 allowOverlap ?: boolean ;
33+ androidOffsetY ?: number ;
3234} ;
3335
3436export const HighlightToolTip : React . FC < HighlightOverlayProps > = ( {
@@ -38,6 +40,7 @@ export const HighlightToolTip: React.FC<HighlightOverlayProps> = ({
3840 tooltipPosition = 'bottom' ,
3941 offset = { x : 0 , y : 0 } ,
4042 allowOverlap = false ,
43+ androidOffsetY = 0 ,
4144} ) => {
4245 const [ hole , setHole ] = useState < LayoutRectangle | null > ( null ) ;
4346 const { width : screenWidth , height : screenHeight } = Dimensions . get ( 'window' ) ;
@@ -48,10 +51,16 @@ export const HighlightToolTip: React.FC<HighlightOverlayProps> = ({
4851 UIManager . measureInWindow (
4952 handle ! ,
5053 ( x : number , y : number , width : number , height : number ) => {
51- setHole ( { x, y, width, height } ) ;
54+ const isAndroid = Platform . OS === 'android' ;
55+ setHole ( {
56+ x,
57+ y : isAndroid ? y + androidOffsetY : y ,
58+ width,
59+ height,
60+ } ) ;
5261 }
5362 ) ;
54- } , [ targetRef ] ) ;
63+ } , [ targetRef , androidOffsetY ] ) ;
5564
5665 const getTooltipPosition = ( ) => {
5766 if ( ! hole ) return { top : 0 , left : 0 } ;
0 commit comments