diff options
author | 偏右 <afc163@gmail.com> | 2017-04-14 17:21:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-14 17:21:57 +0800 |
commit | 1630cc0d1942d079a80705cd000a48df9a58b355 (patch) | |
tree | c179b1ccfe954b1df0e2c9a238f604a0e1ba1534 /examples | |
parent | 50d8d304a8b48e0d6ee40de333e15858eb0d7dd0 (diff) | |
parent | 3ab3a128deaf10300b31102b79458528227baa54 (diff) | |
download | time-picker-1630cc0d1942d079a80705cd000a48df9a58b355.tar.gz time-picker-1630cc0d1942d079a80705cd000a48df9a58b355.tar.zst time-picker-1630cc0d1942d079a80705cd000a48df9a58b355.zip |
Merge pull request #41 from react-component/fix-react-15.5-warning
Fix react 15.5 warning
Diffstat (limited to 'examples')
-rw-r--r-- | examples/format.js | 29 | ||||
-rw-r--r-- | examples/open.js | 22 | ||||
-rw-r--r-- | examples/value-and-defaultValue.js | 22 |
3 files changed, 30 insertions, 43 deletions
diff --git a/examples/format.js b/examples/format.js index c9a9539..e9a2614 100644 --- a/examples/format.js +++ b/examples/format.js | |||
@@ -4,23 +4,14 @@ import ReactDom from 'react-dom'; | |||
4 | import moment from 'moment'; | 4 | import moment from 'moment'; |
5 | import TimePicker from 'rc-time-picker'; | 5 | import TimePicker from 'rc-time-picker'; |
6 | 6 | ||
7 | const App = React.createClass({ | ||
8 | render() { | ||
9 | return ( | ||
10 | <div> | ||
11 | <TimePicker defaultValue={moment()} showHour={false} /> | ||
12 | <TimePicker defaultValue={moment()} showMinute={false} /> | ||
13 | <TimePicker defaultValue={moment()} showSecond={false} /> | ||
14 | |||
15 | <TimePicker defaultValue={moment()} showMinute={false} showSecond={false} /> | ||
16 | <TimePicker defaultValue={moment()} showHour={false} showSecond={false}/> | ||
17 | <TimePicker defaultValue={moment()} showHour={false} showMinute={false} /> | ||
18 | </div> | ||
19 | ); | ||
20 | }, | ||
21 | }); | ||
22 | |||
23 | ReactDom.render( | 7 | ReactDom.render( |
24 | <App />, | 8 | <div> |
25 | document.getElementById('__react-content') | 9 | <TimePicker defaultValue={moment()} showHour={false} /> |
26 | ); | 10 | <TimePicker defaultValue={moment()} showMinute={false} /> |
11 | <TimePicker defaultValue={moment()} showSecond={false} /> | ||
12 | |||
13 | <TimePicker defaultValue={moment()} showMinute={false} showSecond={false} /> | ||
14 | <TimePicker defaultValue={moment()} showHour={false} showSecond={false}/> | ||
15 | <TimePicker defaultValue={moment()} showHour={false} showMinute={false} /> | ||
16 | </div> | ||
17 | , document.getElementById('__react-content')); | ||
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 />, |
diff --git a/examples/value-and-defaultValue.js b/examples/value-and-defaultValue.js index 0e1aa14..1e1baf8 100644 --- a/examples/value-and-defaultValue.js +++ b/examples/value-and-defaultValue.js | |||
@@ -7,21 +7,19 @@ import ReactDom from 'react-dom'; | |||
7 | import moment from 'moment'; | 7 | import moment from 'moment'; |
8 | import TimePicker from 'rc-time-picker'; | 8 | import TimePicker from 'rc-time-picker'; |
9 | 9 | ||
10 | const App = React.createClass({ | 10 | class App extends React.Component { |
11 | getInitialState() { | 11 | state = { |
12 | return { | 12 | value: moment(), |
13 | value: moment(), | 13 | }; |
14 | }; | 14 | handleValueChange = (value) => { |
15 | }, | ||
16 | handleValueChange(value) { | ||
17 | console.log(value && value.format('HH:mm:ss')); | 15 | console.log(value && value.format('HH:mm:ss')); |
18 | this.setState({ value }); | 16 | this.setState({ value }); |
19 | }, | 17 | } |
20 | clear() { | 18 | clear = () => { |
21 | this.setState({ | 19 | this.setState({ |
22 | value: undefined, | 20 | value: undefined, |
23 | }); | 21 | }); |
24 | }, | 22 | } |
25 | render() { | 23 | render() { |
26 | return ( | 24 | return ( |
27 | <div> | 25 | <div> |
@@ -36,8 +34,8 @@ const App = React.createClass({ | |||
36 | <button onClick={this.clear}>clear</button> | 34 | <button onClick={this.clear}>clear</button> |
37 | </div> | 35 | </div> |
38 | ); | 36 | ); |
39 | }, | 37 | } |
40 | }); | 38 | } |
41 | 39 | ||
42 | ReactDom.render( | 40 | ReactDom.render( |
43 | <App />, | 41 | <App />, |