aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorafc163 <afc163@gmail.com>2017-04-14 17:13:04 +0800
committerafc163 <afc163@gmail.com>2017-04-14 17:13:04 +0800
commit3ab3a128deaf10300b31102b79458528227baa54 (patch)
treec179b1ccfe954b1df0e2c9a238f604a0e1ba1534 /examples
parent16a18e356599ed2b9289314614739802ea5b5191 (diff)
downloadtime-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')
-rw-r--r--examples/format.js29
-rw-r--r--examples/open.js22
-rw-r--r--examples/value-and-defaultValue.js22
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';
4import moment from 'moment'; 4import moment from 'moment';
5import TimePicker from 'rc-time-picker'; 5import TimePicker from 'rc-time-picker';
6 6
7const 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
23ReactDom.render( 7ReactDom.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';
6import ReactDom from 'react-dom'; 6import ReactDom from 'react-dom';
7import TimePicker from 'rc-time-picker'; 7import TimePicker from 'rc-time-picker';
8 8
9const App = React.createClass({ 9class 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
33ReactDom.render( 31ReactDom.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';
7import moment from 'moment'; 7import moment from 'moment';
8import TimePicker from 'rc-time-picker'; 8import TimePicker from 'rc-time-picker';
9 9
10const App = React.createClass({ 10class 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
42ReactDom.render( 40ReactDom.render(
43 <App />, 41 <App />,