@@ -50,12 +50,11 @@ interface HintTargetFrame {
50
50
height ?: number ;
51
51
}
52
52
53
- type Position = Pick < ViewStyle , 'top' | 'bottom' | 'left' | 'right' >
53
+ type Position = Pick < ViewStyle , 'top' | 'bottom' | 'left' | 'right' > ;
54
54
55
- type HintPositionStyle = Position & Pick < ViewStyle , 'alignItems' >
56
-
57
- type Paddings = Pick < ViewStyle , 'paddingLeft' | 'paddingRight' | 'paddingVertical' | 'paddingHorizontal' >
55
+ type HintPositionStyle = Position & Pick < ViewStyle , 'alignItems' > ;
58
56
57
+ type Paddings = Pick < ViewStyle , 'paddingLeft' | 'paddingRight' | 'paddingVertical' | 'paddingHorizontal' > ;
59
58
60
59
export interface HintProps {
61
60
/**
@@ -110,7 +109,7 @@ export interface HintProps {
110
109
* Callback for Hint press
111
110
*/
112
111
onPress ?: ( ) => void ;
113
- /**
112
+ /**
114
113
* Callback for the background press
115
114
*/
116
115
onBackgroundPress ?: ( event : GestureResponderEvent ) => void ;
@@ -195,7 +194,7 @@ class Hint extends Component<HintProps, HintState> {
195
194
const { message} = this . props ;
196
195
const targetRefTag = findNodeHandle ( this . targetRef ) ;
197
196
const hintRefTag = findNodeHandle ( this . hintRef ) ;
198
-
197
+
199
198
if ( targetRefTag && _ . isString ( message ) ) {
200
199
AccessibilityInfo . setAccessibilityFocus ( targetRefTag ) ;
201
200
} else if ( hintRefTag ) {
@@ -217,7 +216,7 @@ class Hint extends Component<HintProps, HintState> {
217
216
if ( ! _ . isEqual ( this . state . targetLayout , layout ) ) {
218
217
this . setState ( { targetLayout : layout } ) ;
219
218
}
220
-
219
+
221
220
if ( ! this . state . targetLayoutInWindow || this . props . onBackgroundPress ) {
222
221
setTimeout ( ( ) => {
223
222
this . targetRef ?. measureInWindow ( ( x : number , y : number , width : number , height : number ) => {
@@ -286,7 +285,7 @@ class Hint extends Component<HintProps, HintState> {
286
285
getTargetPositionOnScreen ( ) {
287
286
if ( this . targetLayout ?. x && this . targetLayout ?. width ) {
288
287
const targetMidPosition = this . targetLayout . x + this . targetLayout . width / 2 ;
289
-
288
+
290
289
if ( targetMidPosition > this . containerWidth * ( 2 / 3 ) ) {
291
290
return TARGET_POSITIONS . RIGHT ;
292
291
} else if ( targetMidPosition < this . containerWidth * ( 1 / 3 ) ) {
@@ -329,7 +328,7 @@ class Hint extends Component<HintProps, HintState> {
329
328
330
329
getHintPadding ( ) {
331
330
const paddings : Paddings = { paddingVertical : this . hintOffset , paddingHorizontal : this . edgeMargins } ;
332
-
331
+
333
332
if ( this . useSideTip && this . targetLayout ?. x ) {
334
333
const targetPositionOnScreen = this . getTargetPositionOnScreen ( ) ;
335
334
if ( targetPositionOnScreen === TARGET_POSITIONS . LEFT ) {
@@ -345,7 +344,7 @@ class Hint extends Component<HintProps, HintState> {
345
344
getHintAnimatedStyle = ( ) => {
346
345
const { position} = this . props ;
347
346
const translateY = position === HintPositions . TOP ? - 10 : 10 ;
348
-
347
+
349
348
return {
350
349
opacity : this . visibleAnimated ,
351
350
transform : [
@@ -431,25 +430,19 @@ class Hint extends Component<HintProps, HintState> {
431
430
transform : [ { scaleY : flipVertically ? - 1 : 1 } , { scaleX : flipHorizontally ? - 1 : 1 } ]
432
431
} ;
433
432
434
- return (
435
- < Image
436
- tintColor = { color }
437
- source = { source }
438
- style = { [ styles . hintTip , this . getTipPosition ( ) , flipStyle ] }
439
- />
440
- ) ;
433
+ return < Image tintColor = { color } source = { source } style = { [ styles . hintTip , this . getTipPosition ( ) , flipStyle ] } /> ;
441
434
}
442
435
443
436
renderContent ( ) {
444
437
const {
445
- message,
446
- messageStyle,
447
- icon,
448
- iconStyle,
449
- borderRadius,
450
- color = DEFAULT_COLOR ,
451
- customContent,
452
- removePaddings,
438
+ message,
439
+ messageStyle,
440
+ icon,
441
+ iconStyle,
442
+ borderRadius,
443
+ color = DEFAULT_COLOR ,
444
+ customContent,
445
+ removePaddings,
453
446
enableShadow,
454
447
visible,
455
448
testID
@@ -463,7 +456,7 @@ class Hint extends Component<HintProps, HintState> {
463
456
style = { [
464
457
styles . hint ,
465
458
! removePaddings && styles . hintPaddings ,
466
- visible && enableShadow && styles . containerShadow ,
459
+ visible && enableShadow && styles . containerShadow ,
467
460
{ backgroundColor : color } ,
468
461
! _ . isUndefined ( borderRadius ) && { borderRadius}
469
462
] }
@@ -508,7 +501,7 @@ class Hint extends Component<HintProps, HintState> {
508
501
return (
509
502
< View
510
503
{ ...others }
511
- // this view must be collapsable, don't pass testID or backgroundColor etc'.
504
+ // this view must be collapsable, don't pass testID or backgroundColor etc'.
512
505
collapsable
513
506
testID = { undefined }
514
507
style = { [ styles . container , style , this . getContainerPosition ( ) ] }
@@ -533,7 +526,7 @@ class Hint extends Component<HintProps, HintState> {
533
526
534
527
render ( ) {
535
528
const { onBackgroundPress, testID} = this . props ;
536
-
529
+
537
530
if ( ! this . props . visible && this . state . hintUnmounted ) {
538
531
return this . props . children || null ;
539
532
}
0 commit comments