diff options
author | afc163 <afc163@gmail.com> | 2017-04-14 17:13:04 +0800 |
---|---|---|
committer | afc163 <afc163@gmail.com> | 2017-04-14 17:13:04 +0800 |
commit | 3ab3a128deaf10300b31102b79458528227baa54 (patch) | |
tree | c179b1ccfe954b1df0e2c9a238f604a0e1ba1534 /examples/open.js | |
parent | 16a18e356599ed2b9289314614739802ea5b5191 (diff) | |
download | time-picker-3ab3a128deaf10300b31102b79458528227baa54.tar.gz time-picker-3ab3a128deaf10300b31102b79458528227baa54.tar.zst time-picker-3ab3a128deaf10300b31102b79458528227baa54.zip |
fix react createClass and PropTypes warningfix-react-15.5-warning
Diffstat (limited to 'examples/open.js')
-rw-r--r-- | examples/open.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/examples/open.js b/examples/open.js index 100bf35..8e4f5de 100644 --- a/examples/open.js +++ b/examples/open.js | |||
@@ -6,20 +6,18 @@ import React from 'react'; | |||
6 | import ReactDom from 'react-dom'; | 6 | import ReactDom from 'react-dom'; |
7 | import TimePicker from 'rc-time-picker'; | 7 | import TimePicker from 'rc-time-picker'; |
8 | 8 | ||
9 | const App = React.createClass({ | 9 | class App extends React.Component { |
10 | getInitialState() { | 10 | state = { |
11 | return { | 11 | open: false, |
12 | open: false, | 12 | }; |
13 | }; | 13 | setOpen = ({ open }) => { |
14 | }, | ||
15 | setOpen({ open }) { | ||
16 | this.setState({ open }); | 14 | this.setState({ open }); |
17 | }, | 15 | } |
18 | toggleOpen() { | 16 | toggleOpen = () => { |
19 | this.setState({ | 17 | this.setState({ |
20 | open: !this.state.open, | 18 | open: !this.state.open, |
21 | }); | 19 | }); |
22 | }, | 20 | } |
23 | render() { | 21 | render() { |
24 | return ( | 22 | return ( |
25 | <div> | 23 | <div> |
@@ -27,8 +25,8 @@ const App = React.createClass({ | |||
27 | <TimePicker open={this.state.open} onOpen={this.setOpen} onClose={this.setOpen} /> | 25 | <TimePicker open={this.state.open} onOpen={this.setOpen} onClose={this.setOpen} /> |
28 | </div> | 26 | </div> |
29 | ); | 27 | ); |
30 | }, | 28 | } |
31 | }); | 29 | } |
32 | 30 | ||
33 | ReactDom.render( | 31 | ReactDom.render( |
34 | <App />, | 32 | <App />, |