Skip to content

Commit

Permalink
Merge pull request #17118 from ant-design/fix-lgtm-errors
Browse files Browse the repository at this point in the history
refactor: Fix lgtm errors
  • Loading branch information
afc163 committed Jun 16, 2019
2 parents 6c60092 + e3565ac commit 30ac0a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
8 changes: 7 additions & 1 deletion components/affix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,13 @@ class Affix extends React.Component<AffixProps, AffixState> {
return (
<div {...props} style={mergedPlaceholderStyle} ref={this.savePlaceholderNode}>
<div className={className} ref={this.saveFixedNode} style={this.state.affixStyle}>
<ResizeObserver onResize={this.updatePosition}>{children}</ResizeObserver>
<ResizeObserver
onResize={() => {
this.updatePosition();
}}
>
{children}
</ResizeObserver>
</div>
</div>
);
Expand Down
20 changes: 11 additions & 9 deletions components/badge/ScrollNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,24 @@ class ScrollNumber extends Component<ScrollNumberProps, ScrollNumberState> {
componentDidUpdate(_: any, prevState: ScrollNumberState) {
this.lastCount = prevState.count;
const { animateStarted } = this.state;
const { onAnimated } = this.props;
if (animateStarted) {
this.setState(
{
(__, props) => ({
animateStarted: false,
count: this.props.count,
},
() => {
if (onAnimated) {
onAnimated();
}
},
count: props.count,
}),
this.onAnimated,
);
}
}

onAnimated = () => {
const { onAnimated } = this.props;
if (onAnimated) {
onAnimated();
}
}

renderNumberList(position: number) {
const childrenToReturn: React.ReactElement<any>[] = [];
for (let i = 0; i < 30; i++) {
Expand Down
4 changes: 1 addition & 3 deletions components/descriptions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Descriptions extends React.Component<
size: 'default',
column: defaultColumnMap,
};
static Item: typeof DescriptionsItem;
static Item: typeof DescriptionsItem = DescriptionsItem;
state: {
screens: BreakpointMap;
} = {
Expand Down Expand Up @@ -251,6 +251,4 @@ class Descriptions extends React.Component<
}
}

Descriptions.Item = DescriptionsItem;

export default Descriptions;

0 comments on commit 30ac0a0

Please sign in to comment.