expo-calendar-kit 2.0.9 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
import UIKit
|
|
3
3
|
import EventKit
|
|
4
|
+
import CalendarKit
|
|
4
5
|
|
|
5
6
|
// MARK: - Event Models
|
|
6
7
|
struct CalendarEvent {
|
|
@@ -109,6 +110,7 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
|
|
|
109
110
|
|
|
110
111
|
private func setupCalendarView() {
|
|
111
112
|
print("🔥 setupCalendarView called")
|
|
113
|
+
|
|
112
114
|
dayView = DayView()
|
|
113
115
|
dayView.delegate = self
|
|
114
116
|
dayView.dataSource = self
|
|
@@ -127,6 +129,8 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
|
|
|
127
129
|
|
|
128
130
|
// Set initial date
|
|
129
131
|
dayView.move(to: currentDate)
|
|
132
|
+
|
|
133
|
+
print("🔥 CalendarKit DayView setup complete")
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
// MARK: - Public Methods
|
|
@@ -137,12 +141,16 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
|
|
|
137
141
|
for (index, event) in self.events.enumerated() {
|
|
138
142
|
print("🔥 Event \(index): \(event.title) from \(event.startDate) to \(event.endDate)")
|
|
139
143
|
}
|
|
140
|
-
dayView
|
|
144
|
+
if let dayView = dayView {
|
|
145
|
+
dayView.reloadData()
|
|
146
|
+
}
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
public func setDate(_ timestamp: Double) {
|
|
144
150
|
self.currentDate = Date(timeIntervalSince1970: timestamp / 1000)
|
|
145
|
-
dayView
|
|
151
|
+
if let dayView = dayView {
|
|
152
|
+
dayView.move(to: currentDate)
|
|
153
|
+
}
|
|
146
154
|
}
|
|
147
155
|
|
|
148
156
|
public func updateStyle(_ styleDict: [String: Any]) {
|
|
@@ -151,11 +159,15 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
|
|
|
151
159
|
}
|
|
152
160
|
|
|
153
161
|
public func scrollToCurrentTime() {
|
|
154
|
-
dayView
|
|
162
|
+
if let dayView = dayView {
|
|
163
|
+
dayView.scrollTo(hour24: Float(Calendar.current.component(.hour, from: Date())))
|
|
164
|
+
}
|
|
155
165
|
}
|
|
156
166
|
|
|
157
167
|
private func applyStyle() {
|
|
158
|
-
|
|
168
|
+
guard let dayView = dayView else { return }
|
|
169
|
+
|
|
170
|
+
var style = CalendarKit.CalendarStyle()
|
|
159
171
|
|
|
160
172
|
// Apply only the colors that are supported by CalendarKit
|
|
161
173
|
if let headerBgColor = customCalendarStyle.headerBackgroundColor {
|