react-datetime icon indicating copy to clipboard operation
react-datetime copied to clipboard

ref on date picker popup

Open DLTKAbelLeal opened this issue 7 years ago • 2 comments

Is it possible to add ref as prop? If not, how can I possibly get the dimension and positions of the date picker popup? The element .rdtPicker height, width, top, left, bottom, right positioning? I can't use getBoundingClientRect() as well. I tried to get the element onFocus but the dimensions only return 0.

DLTKAbelLeal avatar Jan 28 '19 17:01 DLTKAbelLeal

If you have a ref for the react-datetime component, you should be able to call .getElementsByClassName(".rdtPicker") to get the DOM element for the popup.

rikkit avatar Jan 28 '19 18:01 rikkit

@rikkit you mean like this?

<Datetime value={date}
                ref={this.onDatePickerMount}
                dateFormat="MMM DD YYYY" 
                timeFormat={false} 
                closeOnSelect={true} 
                renderDay={this.renderDay}
                onChange={this.onSelectDate}
                onFocus={this.onFocus}
                onBlur={this.onBlur}
                inputProps={{placeholder: dateRange, onKeyPress: this.onKeyPress}}
                isValidDate={this.isValid} /> 

It doesn't return anything aside from the parseDate object. Also when I use getElementsByClassName(".rdtPicker") it only returns 0 on each dimensions, it doesn't return the actual value like the height and width.

DLTKAbelLeal avatar Jan 28 '19 18:01 DLTKAbelLeal