expo-calendar-kit 2.2.0 → 2.2.2

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.
@@ -2,6 +2,7 @@ import ExpoModulesCore
2
2
 
3
3
  public class ExpoCalendarKitModule: Module {
4
4
  public func definition() -> ModuleDefinition {
5
+ print("🔥🔥🔥 MODULE DEFINITION() CALLED!")
5
6
  Name("ExpoCalendarKit")
6
7
 
7
8
  // Legacy functions for backward compatibility
@@ -36,22 +37,27 @@ public class ExpoCalendarKitModule: Module {
36
37
  }
37
38
 
38
39
  // Expose the calendar view component
40
+ print("🔥🔥🔥 ABOUT TO REGISTER VIEW!")
39
41
  View(ExpoCalendarKitView.self) {
42
+ print("🔥🔥🔥 VIEW BLOCK EXECUTED!")
40
43
  // Props
41
44
  Prop("events") { (view: ExpoCalendarKitView, events: [[String: Any]]) in
42
- print("🔥 MODULE: Prop setter called with \(events.count) events")
45
+ print("🔥🔥🔥 MODULE: Prop setter called with \(events.count) events")
43
46
  view.setEvents(events)
44
47
  }
45
48
 
46
49
  Prop("date") { (view: ExpoCalendarKitView, timestamp: Double) in
50
+ print("🔥🔥🔥 MODULE: date prop setter called")
47
51
  view.setDate(timestamp)
48
52
  }
49
53
 
50
54
  Prop("calendarStyle") { (view: ExpoCalendarKitView, style: [String: Any]) in
55
+ print("🔥🔥🔥 MODULE: calendarStyle prop setter called")
51
56
  view.updateStyle(style)
52
57
  }
53
58
 
54
59
  Prop("scrollToCurrentTime") { (view: ExpoCalendarKitView, shouldScroll: Bool) in
60
+ print("🔥🔥🔥 MODULE: scrollToCurrentTime prop setter called")
55
61
  if shouldScroll {
56
62
  view.scrollToCurrentTime()
57
63
  }
@@ -157,43 +157,73 @@ final class CalendarViewController: DayViewController {
157
157
 
158
158
  override func viewDidLoad() {
159
159
  super.viewDidLoad()
160
- print("🔥 CalendarViewController viewDidLoad called")
160
+ print("🔥🔥🔥 CalendarViewController viewDidLoad called")
161
+ print("🔥🔥🔥 dynamicEvents count: \(dynamicEvents.count)")
161
162
  // Don't request calendar access - we'll use events from React Native
163
+ print("🔥🔥🔥 CalendarViewController viewDidLoad complete")
162
164
  }
163
165
 
164
166
  // Function to update events from React Native
165
167
  func updateEvents(_ events: [[String: Any]]) {
166
- print("🔥 CalendarViewController updateEvents called with \(events.count) events")
168
+ print("🔥🔥🔥 CalendarViewController updateEvents called with \(events.count) events")
169
+ for (index, event) in events.enumerated() {
170
+ print("🔥🔥🔥 Received Event \(index): \(event)")
171
+ }
172
+ print("🔥🔥🔥 About to update dynamicEvents array")
167
173
  self.dynamicEvents = events
174
+ print("🔥🔥🔥 dynamicEvents updated, new count: \(self.dynamicEvents.count)")
175
+ print("🔥🔥🔥 About to call reloadData")
168
176
  self.reloadData() // Refresh the calendar view
177
+ print("🔥🔥🔥 CalendarViewController reloadData called after updateEvents")
169
178
  }
170
179
 
171
180
  // MARK: - DayViewDataSource
172
181
 
173
182
  // This is the main method - following CalendarApp pattern exactly
174
183
  override func eventsForDate(_ date: Date) -> [EventDescriptor] {
175
- print("🔥 eventsForDate called for \(date) with \(dynamicEvents.count) dynamic events")
184
+ let formatter = DateFormatter()
185
+ formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
186
+ print("🔥🔥🔥🔥🔥 ===== eventsForDate CALLED =====")
187
+ print("🔥🔥🔥🔥🔥 Requested date: \(formatter.string(from: date))")
188
+ print("🔥🔥🔥🔥🔥 dynamicEvents count: \(dynamicEvents.count)")
176
189
 
177
190
  let calendar = Calendar.current
178
191
  var events: [MyEKWrapper] = []
179
192
 
193
+ if dynamicEvents.isEmpty {
194
+ print("🔥🔥🔥🔥🔥 NO DYNAMIC EVENTS TO PROCESS!")
195
+ return []
196
+ }
197
+
180
198
  // Process dynamic events from React Native
181
- for eventDict in dynamicEvents {
199
+ for (index, eventDict) in dynamicEvents.enumerated() {
200
+ print("🔥🔥🔥🔥🔥 Processing event \(index): \(eventDict)")
201
+
182
202
  guard let title = eventDict["title"] as? String,
183
203
  let startTimestamp = eventDict["startDate"] as? Double,
184
204
  let endTimestamp = eventDict["endDate"] as? Double else {
185
- print("🔥 Skipping event with missing data: \(eventDict)")
205
+ print("🔥🔥🔥🔥🔥 SKIPPING event \(index) with missing data: \(eventDict)")
186
206
  continue
187
207
  }
188
208
 
189
209
  let startDate = Date(timeIntervalSince1970: startTimestamp / 1000)
190
210
  let endDate = Date(timeIntervalSince1970: endTimestamp / 1000)
191
211
 
212
+ print("🔥🔥🔥🔥🔥 Event \(index) '\(title)':")
213
+ print("🔥🔥🔥🔥🔥 Start: \(formatter.string(from: startDate))")
214
+ print("🔥🔥🔥🔥🔥 End: \(formatter.string(from: endDate))")
215
+ print("🔥🔥🔥🔥🔥 Requested: \(formatter.string(from: date))")
216
+
217
+ let isSameDay = calendar.isDate(startDate, inSameDayAs: date)
218
+ print("🔥🔥🔥🔥🔥 Same day check: \(isSameDay)")
219
+
192
220
  // Check if this event is on the requested date
193
- guard calendar.isDate(startDate, inSameDayAs: date) else {
221
+ guard isSameDay else {
222
+ print("🔥🔥🔥🔥🔥 NOT on requested date, skipping")
194
223
  continue
195
224
  }
196
225
 
226
+ print("🔥🔥🔥🔥🔥 Creating EKEvent for this event")
197
227
  // Create EKEvent
198
228
  let ekEvent = EKEvent(eventStore: eventStore)
199
229
  ekEvent.title = title
@@ -206,10 +236,12 @@ final class CalendarViewController: DayViewController {
206
236
  ekEvent.calendar = createMockCalendar(color: color)
207
237
 
208
238
  events.append(MyEKWrapper(eventKitEvent: ekEvent))
209
- print("🔥 Added event: \(title) from \(startDate) to \(endDate)")
239
+ print("🔥🔥🔥🔥🔥 SUCCESSFULLY ADDED event: \(title)")
210
240
  }
211
241
 
212
- print("🔥 Returning \(events.count) dynamic events for \(date)")
242
+ print("🔥🔥🔥🔥🔥 ===== FINAL RESULT =====")
243
+ print("🔥🔥🔥🔥🔥 Returning \(events.count) events for \(formatter.string(from: date))")
244
+ print("🔥🔥🔥🔥🔥 ========================")
213
245
  return events
214
246
  }
215
247
 
@@ -234,22 +266,33 @@ public class ExpoCalendarKitView: UIView {
234
266
  private var calendarViewController: CalendarViewController!
235
267
 
236
268
  public override init(frame: CGRect) {
237
- print("🔥 ExpoCalendarKitView init called with frame: \(frame)")
269
+ print("🔥🔥🔥 ExpoCalendarKitView init called with frame: \(frame)")
238
270
  super.init(frame: frame)
271
+ print("🔥🔥🔥 About to call setupCalendarViewController")
239
272
  setupCalendarViewController()
273
+ print("🔥🔥🔥 ExpoCalendarKitView init complete")
240
274
  }
241
275
 
242
276
  required public init?(coder: NSCoder) {
277
+ print("🔥🔥🔥 ExpoCalendarKitView init(coder) called")
243
278
  super.init(coder: coder)
279
+ print("🔥🔥🔥 About to call setupCalendarViewController from coder init")
244
280
  setupCalendarViewController()
281
+ print("🔥🔥🔥 ExpoCalendarKitView init(coder) complete")
245
282
  }
246
283
 
247
284
  private func setupCalendarViewController() {
248
- print("🔥 setupCalendarViewController called")
285
+ print("🔥🔥🔥 setupCalendarViewController called")
249
286
 
287
+ print("🔥🔥🔥 Creating CalendarViewController")
250
288
  calendarViewController = CalendarViewController()
289
+ print("🔥🔥🔥 CalendarViewController created: \(calendarViewController != nil)")
290
+
291
+ print("🔥🔥🔥 Adding calendarViewController.view as subview")
251
292
  addSubview(calendarViewController.view)
293
+ print("🔥🔥🔥 Subview added")
252
294
 
295
+ print("🔥🔥🔥 Setting up constraints")
253
296
  calendarViewController.view.translatesAutoresizingMaskIntoConstraints = false
254
297
  NSLayoutConstraint.activate([
255
298
  calendarViewController.view.topAnchor.constraint(equalTo: topAnchor),
@@ -257,15 +300,29 @@ public class ExpoCalendarKitView: UIView {
257
300
  calendarViewController.view.trailingAnchor.constraint(equalTo: trailingAnchor),
258
301
  calendarViewController.view.bottomAnchor.constraint(equalTo: bottomAnchor)
259
302
  ])
303
+ print("🔥🔥🔥 Constraints activated")
304
+
305
+ print("🔥🔥🔥 CalendarViewController setup complete")
260
306
 
261
- print("🔥 CalendarViewController setup complete")
307
+ // Force initial load
308
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
309
+ print("🔥🔥🔥 About to call initial reloadData")
310
+ self.calendarViewController.reloadData()
311
+ print("🔥🔥🔥 Initial reloadData called")
312
+ }
262
313
  }
263
314
 
264
315
  // MARK: - Public Methods (for React Native bridge)
265
316
  public func setEvents(_ eventDicts: [[String: Any]]) {
266
- print("🔥 setEvents called with \(eventDicts.count) events")
317
+ print("🔥🔥🔥 setEvents called with \(eventDicts.count) events")
318
+ print("🔥🔥🔥 calendarViewController exists: \(calendarViewController != nil)")
319
+ for (index, event) in eventDicts.enumerated() {
320
+ print("🔥🔥🔥 Input Event \(index): \(event)")
321
+ }
322
+ print("🔥🔥🔥 About to call calendarViewController.updateEvents")
267
323
  // Pass events to the calendar controller
268
324
  calendarViewController.updateEvents(eventDicts)
325
+ print("🔥🔥🔥 setEvents complete")
269
326
  }
270
327
 
271
328
  public func setDate(_ timestamp: Double) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-calendar-kit",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Expo module wrapping the native Swift CalendarKit library for React Native apps",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",