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