Skip to content

Commit

Permalink
Solve a bug
Browse files Browse the repository at this point in the history
Solve the issue that the component button is rendered in the left top corner at the first frame
  • Loading branch information
luqiuyuan committed Nov 11, 2017
1 parent 257fbe9 commit 03c5a69
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type State = {
oppositeOpacity: ?Animated.Interpolation,
tooltipContainerX: ?Animated.Interpolation,
tooltipContainerY: ?Animated.Interpolation,
buttonComponentOpacity: number,
};
class PopoverTooltip extends React.PureComponent<Props, State> {

Expand Down Expand Up @@ -120,6 +121,7 @@ class PopoverTooltip extends React.PureComponent<Props, State> {
oppositeOpacity: undefined,
tooltipContainerX: undefined,
tooltipContainerY: undefined,
buttonComponentOpacity: 0,
};
}

Expand Down Expand Up @@ -214,6 +216,7 @@ class PopoverTooltip extends React.PureComponent<Props, State> {
tooltipTriangleDown,
tooltipTriangleLeftMargin,
buttonComponentContainerScale,
buttonComponentOpacity: 1,
},
this.showZoomingInAnimation,
);
Expand Down Expand Up @@ -344,7 +347,9 @@ class PopoverTooltip extends React.PureComponent<Props, State> {
width: this.state.width,
height: this.state.height,
backgroundColor: 'transparent',
opacity: 1,
opacity: this.state.buttonComponentOpacity, // At the first frame, the button will be rendered
// in the top-left corner. So we dont render it
// until its position has been calculated.
transform: [
{ scale: this.state.buttonComponentContainerScale },
],
Expand Down

0 comments on commit 03c5a69

Please sign in to comment.