style: update code style for Anchor

This commit is contained in:
Benjy Cui 2016-11-18 17:25:30 +08:00
parent db035aa691
commit c94f577416
2 changed files with 2 additions and 12 deletions

View File

@ -19,10 +19,6 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
anchorHelper: React.PropTypes.any,
};
static childContextTypes = {
anchorHelper: React.PropTypes.any,
};
static defaultProps = {
href: '#',
prefixCls: 'ant-anchor',
@ -34,12 +30,6 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
private _component: Element;
getChildContext() {
return {
anchorHelper: this.context.anchorHelper,
};
}
setActiveAnchor() {
const { bounds, href, affix } = this.props;
const { anchorHelper } = this.context;
@ -75,9 +65,9 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
}
scrollTo = (e) => {
e.preventDefault();
const { onClick, href } = this.props;
const { anchorHelper } = this.context;
e.preventDefault();
if (onClick) {
onClick(href, this._component);
} else {

View File

@ -136,7 +136,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
</div>
);
return affix === false ? anchorContent : (
return !affix ? anchorContent : (
<Affix offsetTop={offsetTop}>
{anchorContent}
</Affix>