Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Touch is working for touch and drag selection of date range on DateRa…
…ngePicker, however, this is still a WIP and needs cleanup (removing DOM manipulation in favor of lifting up the state) and testing to ensure that this isn't breaking anything in other use cases
  • Loading branch information
jsweet-dev committed May 25, 2023
commit 2c2c2464f4c35ad861c2b13fe3c4bd698dadd675
6 changes: 4 additions & 2 deletions src/components/DayCell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ class DayCell extends Component {
? document.elementsFromPoint(event.touches[0].clientX, event.touches[0].clientY)
: null;

// console.log(`targetElements: ${targetElement.length}`);
switch (event.type) {
case 'touchmove':
console.log(`touchmove event on ${day}`);
// console.log(`Event: ${JSON.stringify(event)}`);
if (targetElement && targetElement[2].className === 'rdrDay') {
if (targetElement[2] !== this.state.targetElement) {
console.log(`targetElement Day: ${targetElement[0].innerText}`);
const targetDayString = targetElement[2].getAttribute('data-day');
onMouseEnter(new Date(targetDayString));
onPreviewChange(new Date(targetDayString));
this.setState({ targetElement: targetElement[2] });
}
}
Expand Down Expand Up @@ -190,6 +191,7 @@ class DayCell extends Component {
return (
<button
type="button"
data-day={this.props.day.toISOString()}
onMouseEnter={this.handleMouseEvent}
onMouseOver={this.handleMouseEvent}
onMouseLeave={this.handleMouseEvent}
Expand Down