@@ -173,7 +173,7 @@ class Hint extends Component<HintProps, HintState> {
173173 animationDuration = 170 ;
174174
175175 state = {
176- targetLayoutInWindow : undefined as { x : number , y : number , width : number , height : number } | undefined ,
176+ targetLayoutInWindow : undefined as { x : number ; y : number ; width : number ; height : number } | undefined ,
177177 targetLayout : this . props . targetFrame ,
178178 hintUnmounted : ! this . props . visible
179179 } ;
@@ -306,9 +306,8 @@ class Hint extends Component<HintProps, HintState> {
306306
307307 getContainerPosition ( ) {
308308 if ( this . targetLayout ) {
309- return { top : this . targetLayout . y || 0 , left : this . targetLayout . x || 0 } ;
309+ return { top : this . targetLayout . y , left : this . targetLayout . x } ;
310310 }
311- return { top : 0 , left : 0 } ;
312311 }
313312
314313 getHintPosition ( ) {
@@ -404,11 +403,16 @@ class Hint extends Component<HintProps, HintState> {
404403 return tipPositionStyle ;
405404 }
406405
406+ isUsingModal = ( ) => {
407+ const { onBackgroundPress, useModal} = this . props ;
408+ return onBackgroundPress && useModal ;
409+ } ;
410+
407411 renderOverlay ( ) {
408412 const { targetLayoutInWindow} = this . state ;
409413 const { onBackgroundPress, backdropColor, testID} = this . props ;
410414 if ( targetLayoutInWindow ) {
411- const containerPosition = this . getContainerPosition ( ) ;
415+ const containerPosition = this . getContainerPosition ( ) as { top : number ; left : number } ;
412416 return (
413417 < Animated . View
414418 style = { [
@@ -516,7 +520,7 @@ class Hint extends Component<HintProps, HintState> {
516520 // this view must be collapsable, don't pass testID or backgroundColor etc'.
517521 collapsable
518522 testID = { undefined }
519- style = { [ styles . container , style , this . getContainerPosition ( ) ] }
523+ style = { [ styles . container , style , this . getContainerPosition ( ) , ! this . isUsingModal ( ) && styles . overlayContainer ] }
520524 >
521525 { this . renderHint ( ) }
522526 </ View >
@@ -559,7 +563,7 @@ class Hint extends Component<HintProps, HintState> {
559563 }
560564
561565 render ( ) {
562- const { onBackgroundPress, backdropColor, useModal , testID} = this . props ;
566+ const { onBackgroundPress, backdropColor, testID} = this . props ;
563567
564568 if ( ! this . props . visible && this . state . hintUnmounted ) {
565569 return this . props . children || null ;
@@ -568,7 +572,7 @@ class Hint extends Component<HintProps, HintState> {
568572 return (
569573 < >
570574 { this . renderChildren ( ) }
571- { onBackgroundPress && useModal ? (
575+ { this . isUsingModal ( ) ? (
572576 < Modal
573577 visible = { this . showHint }
574578 animationType = { backdropColor ? 'fade' : 'none' }
@@ -595,8 +599,11 @@ class Hint extends Component<HintProps, HintState> {
595599
596600const styles = StyleSheet . create ( {
597601 container : {
598- position : 'absolute' ,
599- zIndex : 1
602+ position : 'absolute'
603+ } ,
604+ overlayContainer : {
605+ zIndex : 10 ,
606+ elevation : 10
600607 } ,
601608 mockChildrenContainer : {
602609 position : 'absolute'
0 commit comments