@@ -37,6 +37,8 @@ export type State = {
3737 result : Result | null ,
3838} ;
3939
40+ type Style = { [ string ] : string | number } ;
41+
4042export type Props = {
4143 /** DOMRect (or similar shaped object) of target position. */
4244 target : RectLike | null ,
@@ -76,12 +78,12 @@ export type Props = {
7678 /** Constrain the content at the bottom boundary. */
7779 constrainLeft : boolean ,
7880 content : React . ComponentType < {
79- style : Object ,
81+ style : Style ,
8082 result : Result ,
8183 children ?: React . Node ,
8284 } > | string ,
8385 tail ?: React . ComponentType < {
84- style : Object ,
86+ style : Style ,
8587 result : Result ,
8688 children ?: React . Node ,
8789 } > ,
@@ -314,7 +316,10 @@ class FlowTip extends React.Component<Props, State> {
314316
315317 let result = null ;
316318
317- if ( bounds && target && content && ( ! nextProps . Tail || tail ) ) {
319+ if (
320+ bounds && target && content &&
321+ ( typeof nextProps . Tail !== 'function' || tail )
322+ ) {
318323 const config = {
319324 offset : this . _getOffset ( nextProps ) ,
320325 overlap : this . _getOverlap ( nextProps ) ,
@@ -504,12 +509,12 @@ class FlowTip extends React.Component<Props, State> {
504509 * @param {Object } result - A `flowtip` layout result.
505510 * @returns {Object } Content position style.
506511 */
507- _getContentStyle ( result : Result ) : Object {
512+ _getContentStyle ( result : Result ) : Style {
508513 const { containingBlock} = this . state ;
509514
510515 // Hide the result with css clip - preserving its ability to be measured -
511516 // when working with a static layout result mock.
512- if ( ! result || result . _static ) {
517+ if ( ! result || result . _static === true ) {
513518 return {
514519 position : 'absolute' ,
515520 clip : 'rect(0 0 0 0)' ,
@@ -530,7 +535,7 @@ class FlowTip extends React.Component<Props, State> {
530535 * @param {Object } result - A `flowtip` layout result.
531536 * @returns {Object } Tail position style.
532537 */
533- _getTailStyle ( result : Result ) : Object {
538+ _getTailStyle ( result : Result ) : Style {
534539 const { tailOffset} = this . props ;
535540 const { tail} = this . state ;
536541
@@ -540,7 +545,7 @@ class FlowTip extends React.Component<Props, State> {
540545
541546 const tailAttached = result . offset >= this . _getOffset ( this . props ) ;
542547
543- const style : Object = {
548+ const style : Style = {
544549 position : 'absolute' ,
545550 visibility : tailAttached ? 'visible' : 'hidden' ,
546551 } ;
0 commit comments