expo-calendar-kit 2.1.5 → 2.1.6

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.
@@ -192,61 +192,54 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
192
192
  // MARK: - EventDataSource
193
193
  public func eventsForDate(_ date: Date) -> [EventDescriptor] {
194
194
  let calendar = Calendar.current
195
- print("🔥 eventsForDate called for \(date), have \(events.count) total events")
195
+ print("🔥 eventsForDate called for \(date)")
196
196
 
197
- // HARDCODED EVENTS FOR TESTING - BYPASS BRIDGING ISSUES
197
+ // HARDCODED EVENTS FOR TESTING - Following CalendarKit docs exactly
198
198
  let today = Date()
199
199
 
200
- let meeting = calendar.date(bySettingHour: 10, minute: 0, second: 0, of: today) ?? today
201
- let meetingEnd = calendar.date(bySettingHour: 11, minute: 0, second: 0, of: today) ?? today
200
+ // Check if the requested date is today
201
+ guard calendar.isDate(date, inSameDayAs: today) else {
202
+ print("🔥 Not today, returning empty events")
203
+ return []
204
+ }
202
205
 
203
- let lunch = calendar.date(bySettingHour: 12, minute: 0, second: 0, of: today) ?? today
204
- let lunchEnd = calendar.date(bySettingHour: 13, minute: 0, second: 0, of: today) ?? today
206
+ print("🔥 Creating hardcoded events for today")
205
207
 
206
- let review = calendar.date(bySettingHour: 14, minute: 0, second: 0, of: today) ?? today
207
- let reviewEnd = calendar.date(bySettingHour: 15, minute: 0, second: 0, of: today) ?? today
208
+ // Create events using CalendarKit's Event class (EventDescriptor)
209
+ var events = [Event]()
208
210
 
209
- let hardcodedEvents: [CalendarEvent] = [
210
- CalendarEvent(from: [
211
- "id": "hardcoded1",
212
- "title": "🔥 HARDCODED Meeting",
213
- "startDate": meeting.timeIntervalSince1970 * 1000,
214
- "endDate": meetingEnd.timeIntervalSince1970 * 1000,
215
- "backgroundColor": "#FF0000",
216
- "color": "#FFFFFF"
217
- ]),
218
- CalendarEvent(from: [
219
- "id": "hardcoded2",
220
- "title": "🔥 HARDCODED Lunch",
221
- "startDate": lunch.timeIntervalSince1970 * 1000,
222
- "endDate": lunchEnd.timeIntervalSince1970 * 1000,
223
- "backgroundColor": "#00FF00",
224
- "color": "#FFFFFF"
225
- ]),
226
- CalendarEvent(from: [
227
- "id": "hardcoded3",
228
- "title": "🔥 HARDCODED Review",
229
- "startDate": review.timeIntervalSince1970 * 1000,
230
- "endDate": reviewEnd.timeIntervalSince1970 * 1000,
231
- "backgroundColor": "#0000FF",
232
- "color": "#FFFFFF"
233
- ])
234
- ]
235
-
236
- print("🔥 Using hardcoded events instead of bridged events")
237
- let result = hardcodedEvents.compactMap { event in
238
- let isToday = calendar.isDate(event.startDate, inSameDayAs: date) ||
239
- calendar.isDate(event.endDate, inSameDayAs: date) ||
240
- (event.startDate < date && event.endDate > date)
241
- print("🔥 Hardcoded Event '\(event.title)': \(event.startDate) - \(event.endDate), isToday: \(isToday)")
242
- if isToday {
243
- let ekEvent = event.toEKEvent()
244
- return EKWrapper(eventKitEvent: ekEvent)
245
- }
246
- return nil
247
- }
248
- print("🔥 Returning \(result.count) hardcoded events for date \(date)")
249
- return result
211
+ // Event 1: Meeting
212
+ let meeting = Event()
213
+ let meetingStart = calendar.date(bySettingHour: 10, minute: 0, second: 0, of: today) ?? today
214
+ let meetingEnd = calendar.date(bySettingHour: 11, minute: 0, second: 0, of: today) ?? today
215
+ meeting.dateInterval = DateInterval(start: meetingStart, end: meetingEnd)
216
+ meeting.text = "🔥 HARDCODED Meeting\nConference Room A\n10:00 - 11:00"
217
+ meeting.color = UIColor.white
218
+ meeting.backgroundColor = UIColor.red
219
+ events.append(meeting)
220
+
221
+ // Event 2: Lunch
222
+ let lunch = Event()
223
+ let lunchStart = calendar.date(bySettingHour: 12, minute: 0, second: 0, of: today) ?? today
224
+ let lunchEnd = calendar.date(bySettingHour: 13, minute: 0, second: 0, of: today) ?? today
225
+ lunch.dateInterval = DateInterval(start: lunchStart, end: lunchEnd)
226
+ lunch.text = "🔥 HARDCODED Lunch\nCafeteria\n12:00 - 13:00"
227
+ lunch.color = UIColor.white
228
+ lunch.backgroundColor = UIColor.green
229
+ events.append(lunch)
230
+
231
+ // Event 3: Review
232
+ let review = Event()
233
+ let reviewStart = calendar.date(bySettingHour: 14, minute: 0, second: 0, of: today) ?? today
234
+ let reviewEnd = calendar.date(bySettingHour: 15, minute: 0, second: 0, of: today) ?? today
235
+ review.dateInterval = DateInterval(start: reviewStart, end: reviewEnd)
236
+ review.text = "🔥 HARDCODED Review\nMeeting Room B\n14:00 - 15:00"
237
+ review.color = UIColor.white
238
+ review.backgroundColor = UIColor.blue
239
+ events.append(review)
240
+
241
+ print("🔥 Returning \(events.count) hardcoded events for today")
242
+ return events
250
243
  }
251
244
 
252
245
  // MARK: - DayViewDelegate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-calendar-kit",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
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",