From f7a8b11243c311c7b88ae9092d047dd56a758170 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 21 Oct 2015 17:59:57 +0800 Subject: [PATCH] chore: remove deprecated APIs --- README-zh_CN.md | 2 +- README.md | 2 +- components/affix/index.jsx | 5 +++-- components/alert/index.jsx | 3 ++- components/tag/index.jsx | 3 ++- docs/getting-started.md | 3 ++- docs/introduce.md | 2 +- spec/colors.md | 4 ++-- spec/motion.md | 4 ++-- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/README-zh_CN.md b/README-zh_CN.md index c2b2b8be4a..1ac4037c43 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -21,7 +21,7 @@ ```jsx import { Datepicker } from 'antd'; -React.render(, mountNode); +ReactDOM.render(, mountNode); ``` ## 链接 diff --git a/README.md b/README.md index f8f2137808..44f1820af6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ An enterprise-class UI design language and React-based implementation. ```jsx import { Datepicker } from 'antd'; -React.render(, mountNode); +ReactDOM.render(, mountNode); ``` ## Links diff --git a/components/affix/index.jsx b/components/affix/index.jsx index 770017ff23..32e3cf939b 100644 --- a/components/affix/index.jsx +++ b/components/affix/index.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import ReactDOM from 'react-dom'; import rcUtil from 'rc-util'; function getScroll(w, top) { @@ -52,7 +53,7 @@ let Affix = React.createClass({ handleScroll() { let affix = this.state.affix; let scrollTop = getScroll(window, true); - let elemOffset = getOffset(this.getDOMNode()); + let elemOffset = getOffset(ReactDOM.findDOMNode(this)); if (!affix && (elemOffset.top - this.props.offset) < scrollTop) { this.setState({ @@ -60,7 +61,7 @@ let Affix = React.createClass({ affixStyle: { top: this.props.offset, left: elemOffset.left, - width: this.getDOMNode().offsetWidth + width: ReactDOM.findDOMNode(this).offsetWidth } }); } diff --git a/components/alert/index.jsx b/components/alert/index.jsx index 7cbb92a013..0806e9390c 100644 --- a/components/alert/index.jsx +++ b/components/alert/index.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import ReactDOM from 'react-dom'; import Animate from 'rc-animate'; import Icon from '../iconfont'; @@ -15,7 +16,7 @@ export default React.createClass({ }; }, handleClose(e) { - let dom = React.findDOMNode(this); + let dom = ReactDOM.findDOMNode(this); dom.style.height = dom.offsetHeight + 'px'; // Magic code // 重复一次后才能正确设置 height diff --git a/components/tag/index.jsx b/components/tag/index.jsx index 2675a737ba..78ea54952f 100644 --- a/components/tag/index.jsx +++ b/components/tag/index.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import ReactDOM from 'react-dom'; import Animate from 'rc-animate'; import Icon from '../iconfont'; const prefixCls = 'ant-tag'; @@ -14,7 +15,7 @@ class AntTag extends React.Component { } close(e) { - let dom = React.findDOMNode(this); + let dom = ReactDOM.findDOMNode(this); dom.style.width = dom.offsetWidth + 'px'; // It's Magic Code, don't know why dom.style.width = dom.offsetWidth + 'px'; diff --git a/docs/getting-started.md b/docs/getting-started.md index 56719c45e7..3398c0c3d6 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -36,6 +36,7 @@ $ npm install ```jsx import React from 'react'; +import ReactDOM from 'react-dom'; import { Datepicker, message } from 'antd'; var App = React.createClass({ @@ -58,7 +59,7 @@ var App = React.createClass({ } }); -React.render(, document.body); +ReactDOM.render(, document.body); ``` > `var Datepicker = require('antd/lib/datepicker')` 单独引入需要的组件文件可以有效减少最终构建文件的大小。 diff --git a/docs/introduce.md b/docs/introduce.md index b794b3327c..84c4747fec 100644 --- a/docs/introduce.md +++ b/docs/introduce.md @@ -37,7 +37,7 @@ ```jsx import { Datepicker } from 'antd'; -React.render(, mountNode); +ReactDOM.render(, mountNode); ``` ## 版本 diff --git a/spec/colors.md b/spec/colors.md index 019a1112e3..02d02a9be8 100644 --- a/spec/colors.md +++ b/spec/colors.md @@ -189,7 +189,7 @@ let ExtendPalettes = React.createClass({ ; } }); -React.render(, document.getElementById('extend-palettes')); +ReactDOM.render(, document.getElementById('extend-palettes')); ````` ## 色彩换算工具 @@ -265,5 +265,5 @@ let TintShadeTool = React.createClass({ } }); -React.render(, document.getElementById('color-tint-shade-tool')); +ReactDOM.render(, document.getElementById('color-tint-shade-tool')); ````` diff --git a/spec/motion.md b/spec/motion.md index 239dd59a7b..1de435adb5 100644 --- a/spec/motion.md +++ b/spec/motion.md @@ -203,7 +203,7 @@ var Test = React.createClass({ }, componentDidMount() { - this.demoNode = React.findDOMNode(this.refs.demo); + this.demoNode = ReactDOM.findDOMNode(this.refs.demo); }, render() { @@ -225,7 +225,7 @@ var Test = React.createClass({ } }); -React.render(, document.getElementById('components-motion-demo-basic')); +ReactDOM.render(, document.getElementById('components-motion-demo-basic')); `````