react-component / time-picker

React TimePicker
http://react-component.github.io/time-picker/
MIT License
476 stars 201 forks source link

Time picker not working #125

Open ghost opened 6 years ago

ghost commented 6 years ago

This is strange issue because I managed to make time-picker work in another react project, but in this one, even if I try to use the most basic example:

  <TimePicker defaultValue={moment()} showSecond={false} />

It does show visually the textfield like component which has current time in it, but when I click it, the dropdown menu doesn't show up. Neither can I type anything.

React version in package.json "^16.3.2"

Here are my imports

import TimePicker from "rc-time-picker";
import moment from 'moment';
import 'rc-time-picker/assets/index.css';

What can be causing this?

nicubarbaros commented 6 years ago

+1

RayHSY commented 5 years ago

me too

psharath23 commented 5 years ago

possible issue could be that you are not setting the state properly or invalid format string,

this.state={
value:'11:00'
}

<Timepicker
     defaultValue={moment(this.state.value)}
     onChange={(timeValue)=>{
     // for hours and minutes use HH:mm only, not HH:MM
     this.setState({ value: timeValue.format('HH:mm') })
     // for hours and minutes and seconds use HH:mm:ss only, not HH:MM:SS
     this.setState({ value: timeValue.format('HH:mm:ss') })
     }}
/>
sajadZmani commented 5 years ago

are u import style file?

import 'rc-time-picker/assets/index.css';

then check it :-)

sodle commented 5 years ago

Perhaps that import statement should be in the README?

Sid-Busa commented 4 years ago

This is strange issue because I managed to make time-picker work in another react project, but in this one, even if I try to use the most basic example:

  <TimePicker defaultValue={moment()} showSecond={false} />

It does show visually the textfield like component which has current time in it, but when I click it, the dropdown menu doesn't show up. Neither can I type anything.

React version in package.json "^16.3.2"

Here are my imports

import TimePicker from "rc-time-picker";
import moment from 'moment';
import 'rc-time-picker/assets/index.css';

What can be causing this?

Did you find any solution ????