fix: resolve merge conflict

pull/2795/head
Benjy Cui 9 years ago
parent e6280a7ea6
commit 5d39bd9c54

@ -20,7 +20,7 @@ function getScroll(target, top) {
return ret;
}
function getTargetRect(target) {
function getTargetRect(target): any {
return target !== window ?
target.getBoundingClientRect() :
{ top: 0, left: 0, bottom: 0 };
@ -55,6 +55,7 @@ export interface AffixProps {
offsetBottom?: number;
style?: React.CSSProperties;
onChange?: (affixed?: boolean) => any;
target?: () => Window | HTMLElement;
}
export default class Affix extends React.Component<AffixProps, any> {
@ -123,7 +124,8 @@ export default class Affix extends React.Component<AffixProps, any> {
// Backwards support
offsetTop = offsetTop || offset;
const scrollTop = getScroll(targetNode, true);
const elemOffset = getOffset(ReactDOM.findDOMNode(this), targetNode);
const affixNode = ReactDOM.findDOMNode(this) as HTMLElement;
const elemOffset = getOffset(affixNode, targetNode);
const elemSize = {
width: this.refs.fixedNode.offsetWidth,
height: this.refs.fixedNode.offsetHeight,
@ -150,7 +152,7 @@ export default class Affix extends React.Component<AffixProps, any> {
position: 'fixed',
top: targetRect.top + offsetTop,
left: targetRect.left + elemOffset.left,
width: ReactDOM.findDOMNode(this).offsetWidth,
width: affixNode.offsetWidth,
});
this.setPlaceholderStyle(e, {
width: affixNode.offsetWidth,
@ -166,7 +168,7 @@ export default class Affix extends React.Component<AffixProps, any> {
position: 'fixed',
bottom: targetBottomOffet + offsetBottom,
left: targetRect.left + elemOffset.left,
width: ReactDOM.findDOMNode(this).offsetWidth,
width: affixNode.offsetWidth,
});
this.setPlaceholderStyle(e, {
width: affixNode.offsetWidth,

@ -26,17 +26,11 @@ function getScroll(target, top) {
interface BackTopProps {
visibilityHeight?: number;
onClick?: (event) => void;
target?: () => HTMLElement | Window;
prefixCls?: string;
className?: string;
}
export default class BackTop extends React.Component {
static propTypes = {
visibilityHeight: React.PropTypes.number,
target: React.PropTypes.func,
}
export default class BackTop extends React.Component<BackTopProps, any> {
static defaultProps = {
onClick() {},
@ -71,7 +65,7 @@ export default class BackTop extends React.Component<BackTopProps, any> {
document.body.scrollTop = value;
document.documentElement.scrollTop = value;
} else {
targetNode.scrollTop = value;
(targetNode as HTMLElement).scrollTop = value;
}
}

Loading…
Cancel
Save