@@ -173,7 +173,7 @@ class Hint extends Component<HintProps, HintState> {
173
173
animationDuration = 170 ;
174
174
175
175
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 ,
177
177
targetLayout : this . props . targetFrame ,
178
178
hintUnmounted : ! this . props . visible
179
179
} ;
@@ -306,9 +306,8 @@ class Hint extends Component<HintProps, HintState> {
306
306
307
307
getContainerPosition ( ) {
308
308
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 } ;
310
310
}
311
- return { top : 0 , left : 0 } ;
312
311
}
313
312
314
313
getHintPosition ( ) {
@@ -404,11 +403,16 @@ class Hint extends Component<HintProps, HintState> {
404
403
return tipPositionStyle ;
405
404
}
406
405
406
+ isUsingModal = ( ) => {
407
+ const { onBackgroundPress, useModal} = this . props ;
408
+ return onBackgroundPress && useModal ;
409
+ } ;
410
+
407
411
renderOverlay ( ) {
408
412
const { targetLayoutInWindow} = this . state ;
409
413
const { onBackgroundPress, backdropColor, testID} = this . props ;
410
414
if ( targetLayoutInWindow ) {
411
- const containerPosition = this . getContainerPosition ( ) ;
415
+ const containerPosition = this . getContainerPosition ( ) as { top : number ; left : number } ;
412
416
return (
413
417
< Animated . View
414
418
style = { [
@@ -516,7 +520,7 @@ class Hint extends Component<HintProps, HintState> {
516
520
// this view must be collapsable, don't pass testID or backgroundColor etc'.
517
521
collapsable
518
522
testID = { undefined }
519
- style = { [ styles . container , style , this . getContainerPosition ( ) ] }
523
+ style = { [ styles . container , style , this . getContainerPosition ( ) , ! this . isUsingModal ( ) && styles . overlayContainer ] }
520
524
>
521
525
{ this . renderHint ( ) }
522
526
</ View >
@@ -559,7 +563,7 @@ class Hint extends Component<HintProps, HintState> {
559
563
}
560
564
561
565
render ( ) {
562
- const { onBackgroundPress, backdropColor, useModal , testID} = this . props ;
566
+ const { onBackgroundPress, backdropColor, testID} = this . props ;
563
567
564
568
if ( ! this . props . visible && this . state . hintUnmounted ) {
565
569
return this . props . children || null ;
@@ -568,7 +572,7 @@ class Hint extends Component<HintProps, HintState> {
568
572
return (
569
573
< >
570
574
{ this . renderChildren ( ) }
571
- { onBackgroundPress && useModal ? (
575
+ { this . isUsingModal ( ) ? (
572
576
< Modal
573
577
visible = { this . showHint }
574
578
animationType = { backdropColor ? 'fade' : 'none' }
@@ -595,8 +599,11 @@ class Hint extends Component<HintProps, HintState> {
595
599
596
600
const styles = StyleSheet . create ( {
597
601
container : {
598
- position : 'absolute' ,
599
- zIndex : 1
602
+ position : 'absolute'
603
+ } ,
604
+ overlayContainer : {
605
+ zIndex : 10 ,
606
+ elevation : 10
600
607
} ,
601
608
mockChildrenContainer : {
602
609
position : 'absolute'
0 commit comments