expo-calendar-kit 2.1.0 → 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 {
@@ -110,36 +111,6 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
110
111
  private func setupCalendarView() {
111
112
  print("🔥 setupCalendarView called")
112
113
 
113
- // TEMPORARY: Create a simple test view instead of CalendarKit
114
- let testView = UIView()
115
- testView.backgroundColor = UIColor.systemBlue
116
- testView.translatesAutoresizingMaskIntoConstraints = false
117
- addSubview(testView)
118
-
119
- NSLayoutConstraint.activate([
120
- testView.topAnchor.constraint(equalTo: topAnchor),
121
- testView.leadingAnchor.constraint(equalTo: leadingAnchor),
122
- testView.trailingAnchor.constraint(equalTo: trailingAnchor),
123
- testView.bottomAnchor.constraint(equalTo: bottomAnchor)
124
- ])
125
-
126
- // Add a label for debugging
127
- let label = UILabel()
128
- label.text = "🔥 NATIVE VIEW WORKING!"
129
- label.textColor = UIColor.white
130
- label.textAlignment = .center
131
- label.font = UIFont.boldSystemFont(ofSize: 24)
132
- label.translatesAutoresizingMaskIntoConstraints = false
133
- testView.addSubview(label)
134
-
135
- NSLayoutConstraint.activate([
136
- label.centerXAnchor.constraint(equalTo: testView.centerXAnchor),
137
- label.centerYAnchor.constraint(equalTo: testView.centerYAnchor)
138
- ])
139
-
140
- print("🔥 Test view setup complete")
141
-
142
- /* COMMENTED OUT CALENDARKIT FOR NOW
143
114
  dayView = DayView()
144
115
  dayView.delegate = self
145
116
  dayView.dataSource = self
@@ -158,7 +129,8 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
158
129
 
159
130
  // Set initial date
160
131
  dayView.move(to: currentDate)
161
- */
132
+
133
+ print("🔥 CalendarKit DayView setup complete")
162
134
  }
163
135
 
164
136
  // MARK: - Public Methods
@@ -169,12 +141,16 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
169
141
  for (index, event) in self.events.enumerated() {
170
142
  print("🔥 Event \(index): \(event.title) from \(event.startDate) to \(event.endDate)")
171
143
  }
172
- dayView.reloadData()
144
+ if let dayView = dayView {
145
+ dayView.reloadData()
146
+ }
173
147
  }
174
148
 
175
149
  public func setDate(_ timestamp: Double) {
176
150
  self.currentDate = Date(timeIntervalSince1970: timestamp / 1000)
177
- dayView.move(to: currentDate)
151
+ if let dayView = dayView {
152
+ dayView.move(to: currentDate)
153
+ }
178
154
  }
179
155
 
180
156
  public func updateStyle(_ styleDict: [String: Any]) {
@@ -183,11 +159,15 @@ public class ExpoCalendarKitView: UIView, DayViewDelegate, EventDataSource {
183
159
  }
184
160
 
185
161
  public func scrollToCurrentTime() {
186
- dayView.scrollTo(hour24: Float(Calendar.current.component(.hour, from: Date())))
162
+ if let dayView = dayView {
163
+ dayView.scrollTo(hour24: Float(Calendar.current.component(.hour, from: Date())))
164
+ }
187
165
  }
188
166
 
189
167
  private func applyStyle() {
190
- var style = CalendarStyle()
168
+ guard let dayView = dayView else { return }
169
+
170
+ var style = CalendarKit.CalendarStyle()
191
171
 
192
172
  // Apply only the colors that are supported by CalendarKit
193
173
  if let headerBgColor = customCalendarStyle.headerBackgroundColor {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-calendar-kit",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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",