javascript - onSelectSlot 在 Mobile React Big calendar 中不起作用

标签 javascript reactjs fullcalendar react-big-calendar

OnSelectSlot 在移动浏览器中不起作用。 在 Android 设备中,我用 chrome 浏览器调试它,但它没有工作。 在 IOS 设备中,我使用 Safari 浏览器进行了调试,但它也不起作用。 在计算机浏览器中,单击它时它可以顺利运行,但在手机上则不然。有谁知道解决这个问题的方法吗?

下面是代码--------------------

           <BigCalendar
                selectable
                events={[
                    {
                        id: 0,
                        title: <div>{this.state.morningShiftAppointments + this.state.eveningShiftAppointments}<br/>
                            <div>{this.state.morningShiftAppointments}/{this.state.eveningShiftAppointments}</div>
                        </div>,
                        allDay: true,
                        start: new Date(this.state.year, this.state.month, this.state.date),
                        end: new Date(this.state.year, this.state.month, this.state.date),
                    }
                ]}
                views={['month']}
                onSelectSlot={this.onSelectSlot.bind(this)}
                dayPropGetter={customDayPropGetter}
                longPressThreshold={1}
                defaultDate={new Date()}
                eventPropGetter={
                    (event, start, end, isSelected) => {
                        let newStyle = {
                            backgroundColor: "lightgrey",
                            color: 'black',
                            borderRadius: "0px",
                            border: "none",
                            minWidth: "100%"
                        };
                        return {
                            className: "",
                            style: newStyle
                        };
                    }
                }
            />

最佳答案

来自 React-Big-Calendar 文档:

longPressThreshold Specifies the number of milliseconds the user must press and hold on the screen for a touch to be considered a "long press." Long presses are used for time slot selection on touch devices.

type: number default: 250

关于javascript - onSelectSlot 在 Mobile React Big calendar 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54572237/

相关文章:

javascript - 当单元格内的文本更改为另一个值时,如何在单元格内添加样式元素

javascript - 如何预测或获取默认的 fullCalendar firstDay

javascript - react & typescript : Property 'id' does not exist on type 'number'

javascript - js 提交按钮显示 'submit query' ,不起作用,仅在 IE Edge/IE * 中

javascript - 如何在指令中切换div的位置

jquery - fullCalendar json 与 php 在 "agendaWeek"

javascript - fullcalendar.js 插件上的单击事件不起作用

javascript - 使用参数作为属性

javascript - 将 .then() 中的 String 作为 JSX 元素解析到外部

javascript - react : how to set focus from a click handler