react-native-platform-components 0.1.1 → 0.3.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.
- package/PlatformComponents.podspec +1 -1
- package/android/src/main/java/com/platformcomponents/PCDatePickerView.kt +5 -7
- package/android/src/main/java/com/platformcomponents/PCSelectionMenuView.kt +273 -146
- package/android/src/main/java/com/platformcomponents/PCSelectionMenuViewManager.kt +5 -4
- package/ios/PCDatePickerView.swift +2 -11
- package/ios/PCSelectionMenu.mm +0 -10
- package/ios/PCSelectionMenu.swift +145 -179
- package/lib/module/DatePicker.js +3 -1
- package/lib/module/DatePicker.js.map +1 -1
- package/lib/module/SelectionMenu.js +4 -10
- package/lib/module/SelectionMenu.js.map +1 -1
- package/lib/module/SelectionMenuNativeComponent.ts +0 -9
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/DatePicker.d.ts +2 -0
- package/lib/typescript/src/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/SelectionMenu.d.ts +6 -10
- package/lib/typescript/src/SelectionMenu.d.ts.map +1 -1
- package/lib/typescript/src/SelectionMenuNativeComponent.d.ts +0 -7
- package/lib/typescript/src/SelectionMenuNativeComponent.d.ts.map +1 -1
- package/package.json +16 -9
- package/src/DatePicker.tsx +5 -1
- package/src/SelectionMenu.tsx +8 -33
- package/src/SelectionMenuNativeComponent.ts +0 -9
- package/lib/module/SelectionMenu.web.js +0 -57
- package/lib/module/SelectionMenu.web.js.map +0 -1
- package/lib/typescript/src/SelectionMenu.web.d.ts +0 -19
- package/lib/typescript/src/SelectionMenu.web.d.ts.map +0 -1
- package/src/SelectionMenu.web.tsx +0 -93
package/ios/PCSelectionMenu.mm
CHANGED
|
@@ -144,16 +144,6 @@ static inline bool OptionsEqual(
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
// presentation: "auto" | "popover" | "sheet"
|
|
148
|
-
if (!prevProps || newProps.presentation != prevProps->presentation) {
|
|
149
|
-
if (!newProps.presentation.empty()) {
|
|
150
|
-
_view.presentation =
|
|
151
|
-
[NSString stringWithUTF8String:newProps.presentation.c_str()];
|
|
152
|
-
} else {
|
|
153
|
-
_view.presentation = @"auto";
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
147
|
// visible: "open" | "closed"
|
|
158
148
|
if (!prevProps || newProps.visible != prevProps->visible) {
|
|
159
149
|
if (!newProps.visible.empty()) {
|
|
@@ -56,10 +56,7 @@ private struct PCSelectionMenuInlinePickerView: View {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
@objcMembers
|
|
59
|
-
public final class PCSelectionMenuView: UIControl
|
|
60
|
-
UIPopoverPresentationControllerDelegate,
|
|
61
|
-
UIAdaptivePresentationControllerDelegate
|
|
62
|
-
{
|
|
59
|
+
public final class PCSelectionMenuView: UIControl {
|
|
63
60
|
// MARK: - Props (set from ObjC++)
|
|
64
61
|
|
|
65
62
|
/// ObjC++ sets this as an array of dictionaries: [{label,data}]
|
|
@@ -81,9 +78,6 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
81
78
|
/// "open" | "closed" (headless only)
|
|
82
79
|
public var visible: String = "closed" { didSet { updatePresentation() } }
|
|
83
80
|
|
|
84
|
-
/// "auto" | "popover" | "sheet" (headless only)
|
|
85
|
-
public var presentation: String = "auto" { didSet { updatePresentation() } }
|
|
86
|
-
|
|
87
81
|
/// "inline" | "headless"
|
|
88
82
|
public var anchorMode: String = "headless" { didSet { updateAnchorMode() } }
|
|
89
83
|
|
|
@@ -97,10 +91,9 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
97
91
|
|
|
98
92
|
// MARK: - Internal
|
|
99
93
|
|
|
100
|
-
private weak var presentedVC: UIViewController?
|
|
101
|
-
|
|
102
94
|
private let model = PCSelectionMenuModel()
|
|
103
|
-
private var hostingController: UIHostingController<
|
|
95
|
+
private var hostingController: UIHostingController<AnyView>?
|
|
96
|
+
private var headlessMenuView: UIView?
|
|
104
97
|
|
|
105
98
|
private var parsedOptions: [PCSelectionMenuOption] {
|
|
106
99
|
options.compactMap { any in
|
|
@@ -141,12 +134,13 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
141
134
|
|
|
142
135
|
private func updateAnchorMode() {
|
|
143
136
|
if anchorMode == "inline" {
|
|
144
|
-
|
|
137
|
+
uninstallHeadlessIfNeeded()
|
|
145
138
|
installInlineIfNeeded()
|
|
146
139
|
sync()
|
|
147
140
|
} else {
|
|
148
141
|
uninstallInlineIfNeeded()
|
|
149
|
-
|
|
142
|
+
installHeadlessIfNeeded()
|
|
143
|
+
sync()
|
|
150
144
|
}
|
|
151
145
|
}
|
|
152
146
|
|
|
@@ -156,16 +150,14 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
156
150
|
model.placeholder = placeholder ?? "Select"
|
|
157
151
|
model.interactivity = interactivity
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
hostingController?.rootView = makeInlineRootView()
|
|
161
|
-
}
|
|
153
|
+
hostingController?.rootView = makeRootView()
|
|
162
154
|
|
|
163
155
|
invalidateIntrinsicContentSize()
|
|
164
156
|
setNeedsLayout()
|
|
165
157
|
}
|
|
166
158
|
|
|
167
|
-
private func
|
|
168
|
-
PCSelectionMenuInlinePickerView(
|
|
159
|
+
private func makeRootView() -> AnyView {
|
|
160
|
+
return AnyView(PCSelectionMenuInlinePickerView(
|
|
169
161
|
model: model,
|
|
170
162
|
onSelectIndex: { [weak self] idx in
|
|
171
163
|
guard let self else { return }
|
|
@@ -175,13 +167,51 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
175
167
|
self.selectedData = opt.data
|
|
176
168
|
self.onSelect?(idx, opt.label, opt.data)
|
|
177
169
|
}
|
|
178
|
-
)
|
|
170
|
+
))
|
|
179
171
|
}
|
|
180
172
|
|
|
181
173
|
private func installInlineIfNeeded() {
|
|
182
174
|
guard hostingController == nil else { return }
|
|
175
|
+
installHostingController()
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private func uninstallInlineIfNeeded() {
|
|
179
|
+
guard let host = hostingController else { return }
|
|
180
|
+
hostingController = nil
|
|
183
181
|
|
|
184
|
-
|
|
182
|
+
host.willMove(toParent: nil)
|
|
183
|
+
host.view.removeFromSuperview()
|
|
184
|
+
host.removeFromParent()
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private func installHeadlessIfNeeded() {
|
|
188
|
+
guard headlessMenuView == nil else { return }
|
|
189
|
+
|
|
190
|
+
// Create an invisible anchor view
|
|
191
|
+
let view = UIView()
|
|
192
|
+
view.translatesAutoresizingMaskIntoConstraints = false
|
|
193
|
+
view.backgroundColor = .clear
|
|
194
|
+
view.isHidden = true
|
|
195
|
+
|
|
196
|
+
addSubview(view)
|
|
197
|
+
NSLayoutConstraint.activate([
|
|
198
|
+
view.topAnchor.constraint(equalTo: topAnchor),
|
|
199
|
+
view.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
200
|
+
view.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
201
|
+
view.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
202
|
+
])
|
|
203
|
+
|
|
204
|
+
headlessMenuView = view
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private func uninstallHeadlessIfNeeded() {
|
|
208
|
+
guard let view = headlessMenuView else { return }
|
|
209
|
+
headlessMenuView = nil
|
|
210
|
+
view.removeFromSuperview()
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
private func installHostingController() {
|
|
214
|
+
let host = UIHostingController(rootView: makeRootView())
|
|
185
215
|
host.view.translatesAutoresizingMaskIntoConstraints = false
|
|
186
216
|
host.view.backgroundColor = .clear
|
|
187
217
|
|
|
@@ -201,15 +231,6 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
201
231
|
hostingController = host
|
|
202
232
|
}
|
|
203
233
|
|
|
204
|
-
private func uninstallInlineIfNeeded() {
|
|
205
|
-
guard let host = hostingController else { return }
|
|
206
|
-
hostingController = nil
|
|
207
|
-
|
|
208
|
-
host.willMove(toParent: nil)
|
|
209
|
-
host.view.removeFromSuperview()
|
|
210
|
-
host.removeFromParent()
|
|
211
|
-
}
|
|
212
|
-
|
|
213
234
|
private func nearestViewController() -> UIViewController? {
|
|
214
235
|
var r: UIResponder? = self
|
|
215
236
|
while let next = r?.next {
|
|
@@ -226,134 +247,53 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
226
247
|
guard interactivity != "disabled" else { return }
|
|
227
248
|
|
|
228
249
|
if visible == "open" {
|
|
229
|
-
|
|
230
|
-
} else {
|
|
231
|
-
dismissIfNeeded(emitClose: false)
|
|
250
|
+
presentHeadlessMenuIfNeeded()
|
|
232
251
|
}
|
|
252
|
+
// Note: dismissal is handled by the menu itself calling onRequestClose
|
|
233
253
|
}
|
|
234
254
|
|
|
235
|
-
private func
|
|
236
|
-
guard
|
|
237
|
-
guard let
|
|
255
|
+
private func presentHeadlessMenuIfNeeded() {
|
|
256
|
+
guard headlessMenuView != nil else { return }
|
|
257
|
+
guard let vc = nearestViewController() else { return }
|
|
238
258
|
|
|
239
259
|
let opts = parsedOptions
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
let rectInTopView = self.convert(self.bounds, to: top.view)
|
|
268
|
-
pop.sourceRect = rectInTopView
|
|
269
|
-
pop.permittedArrowDirections = [.up, .down]
|
|
270
|
-
pop.backgroundColor = list.view.backgroundColor
|
|
260
|
+
guard !opts.isEmpty else { return }
|
|
261
|
+
|
|
262
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
263
|
+
let menuVC = PCMenuViewController(
|
|
264
|
+
options: opts,
|
|
265
|
+
onSelect: { [weak self] idx in
|
|
266
|
+
guard let self else { return }
|
|
267
|
+
let opt = opts[idx]
|
|
268
|
+
self.selectedData = opt.data
|
|
269
|
+
self.onSelect?(idx, opt.label, opt.data)
|
|
270
|
+
},
|
|
271
|
+
onCancel: { [weak self] in
|
|
272
|
+
self?.onRequestClose?()
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
menuVC.modalPresentationStyle = .popover
|
|
277
|
+
menuVC.preferredContentSize = CGSize(
|
|
278
|
+
width: 250,
|
|
279
|
+
height: min(CGFloat(opts.count) * 44 + 16, 400) // Account for top/bottom padding
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
if let popover = menuVC.popoverPresentationController {
|
|
283
|
+
popover.sourceView = self
|
|
284
|
+
popover.sourceRect = self.bounds
|
|
285
|
+
popover.permittedArrowDirections = [] // Remove arrow to match inline
|
|
286
|
+
popover.delegate = menuVC
|
|
271
287
|
}
|
|
272
|
-
} else {
|
|
273
|
-
nav.modalPresentationStyle = .pageSheet
|
|
274
|
-
nav.presentationController?.delegate = self
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
nav.presentationController?.delegate = self
|
|
278
|
-
|
|
279
|
-
presentedVC = nav
|
|
280
|
-
top.present(nav, animated: true)
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
private func dismissIfNeeded(emitClose: Bool) {
|
|
284
|
-
guard let vc = presentedVC else { return }
|
|
285
|
-
presentedVC = nil
|
|
286
|
-
vc.dismiss(animated: true) { [weak self] in
|
|
287
|
-
guard let self else { return }
|
|
288
|
-
if emitClose { self.onRequestClose?() }
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private func resolvedModalStyle(for top: UIViewController) -> UIModalPresentationStyle {
|
|
293
|
-
let isPad = (top.traitCollection.userInterfaceIdiom == .pad)
|
|
294
|
-
switch presentation {
|
|
295
|
-
case "popover":
|
|
296
|
-
return .popover
|
|
297
|
-
case "sheet":
|
|
298
|
-
return .pageSheet
|
|
299
|
-
default:
|
|
300
|
-
return isPad ? .popover : .pageSheet
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// MARK: - Dismiss callbacks
|
|
305
|
-
|
|
306
|
-
public func popoverPresentationControllerDidDismissPopover(
|
|
307
|
-
_ popoverPresentationController: UIPopoverPresentationController
|
|
308
|
-
) {
|
|
309
|
-
presentedVC = nil
|
|
310
|
-
onRequestClose?()
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
public func presentationControllerDidDismiss(_ presentationController: UIPresentationController)
|
|
314
|
-
{
|
|
315
|
-
presentedVC = nil
|
|
316
|
-
onRequestClose?()
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
public func adaptivePresentationStyle(for controller: UIPresentationController)
|
|
320
|
-
-> UIModalPresentationStyle
|
|
321
|
-
{
|
|
322
|
-
.none
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// MARK: - Top VC helper
|
|
326
|
-
|
|
327
|
-
private func topViewController() -> UIViewController? {
|
|
328
|
-
guard
|
|
329
|
-
var top = UIApplication.shared.connectedScenes
|
|
330
|
-
.compactMap({ $0 as? UIWindowScene })
|
|
331
|
-
.flatMap({ $0.windows })
|
|
332
|
-
.first(where: { $0.isKeyWindow })?.rootViewController
|
|
333
|
-
else { return nil }
|
|
334
288
|
|
|
335
|
-
|
|
336
|
-
if let presented = top.presentedViewController {
|
|
337
|
-
top = presented
|
|
338
|
-
continue
|
|
339
|
-
}
|
|
340
|
-
if let nav = top as? UINavigationController, let visible = nav.visibleViewController {
|
|
341
|
-
top = visible
|
|
342
|
-
continue
|
|
343
|
-
}
|
|
344
|
-
if let tab = top as? UITabBarController, let selected = tab.selectedViewController {
|
|
345
|
-
top = selected
|
|
346
|
-
continue
|
|
347
|
-
}
|
|
348
|
-
break
|
|
289
|
+
vc.present(menuVC, animated: true)
|
|
349
290
|
}
|
|
350
|
-
return top
|
|
351
291
|
}
|
|
352
292
|
|
|
353
|
-
// MARK: - sizing
|
|
293
|
+
// MARK: - sizing
|
|
354
294
|
|
|
355
295
|
public override func sizeThatFits(_ size: CGSize) -> CGSize {
|
|
356
|
-
if anchorMode != "inline" { return CGSize(width: size.width, height:
|
|
296
|
+
if anchorMode != "inline" { return CGSize(width: size.width, height: 1) }
|
|
357
297
|
|
|
358
298
|
let minH: CGFloat = 44
|
|
359
299
|
guard let host = hostingController else {
|
|
@@ -367,7 +307,7 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
367
307
|
|
|
368
308
|
public override var intrinsicContentSize: CGSize {
|
|
369
309
|
if anchorMode != "inline" {
|
|
370
|
-
return CGSize(width: UIView.noIntrinsicMetric, height:
|
|
310
|
+
return CGSize(width: UIView.noIntrinsicMetric, height: 1)
|
|
371
311
|
}
|
|
372
312
|
let h = max(
|
|
373
313
|
44, sizeThatFits(CGSize(width: bounds.width, height: .greatestFiniteMagnitude)).height)
|
|
@@ -375,60 +315,86 @@ public final class PCSelectionMenuView: UIControl,
|
|
|
375
315
|
}
|
|
376
316
|
}
|
|
377
317
|
|
|
378
|
-
// MARK: -
|
|
379
|
-
|
|
380
|
-
private final class PCSelectionMenuListViewController: UITableViewController {
|
|
318
|
+
// MARK: - Custom Menu View Controller (matches SwiftUI Menu appearance)
|
|
381
319
|
|
|
382
|
-
|
|
320
|
+
private class PCMenuViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UIPopoverPresentationControllerDelegate {
|
|
383
321
|
private let options: [PCSelectionMenuOption]
|
|
384
|
-
private let
|
|
385
|
-
private let onSelectIndex: (Int) -> Void
|
|
322
|
+
private let onSelect: (Int) -> Void
|
|
386
323
|
private let onCancel: () -> Void
|
|
324
|
+
private var tableView: UITableView!
|
|
387
325
|
|
|
388
|
-
init(
|
|
389
|
-
titleText: String,
|
|
390
|
-
options: [PCSelectionMenuOption],
|
|
391
|
-
selectedData: String,
|
|
392
|
-
onSelect: @escaping (Int) -> Void,
|
|
393
|
-
onCancel: @escaping () -> Void
|
|
394
|
-
) {
|
|
395
|
-
self.titleText = titleText
|
|
326
|
+
init(options: [PCSelectionMenuOption], onSelect: @escaping (Int) -> Void, onCancel: @escaping () -> Void) {
|
|
396
327
|
self.options = options
|
|
397
|
-
self.
|
|
398
|
-
self.onSelectIndex = onSelect
|
|
328
|
+
self.onSelect = onSelect
|
|
399
329
|
self.onCancel = onCancel
|
|
400
|
-
super.init(
|
|
401
|
-
title = titleText
|
|
330
|
+
super.init(nibName: nil, bundle: nil)
|
|
402
331
|
}
|
|
403
332
|
|
|
404
|
-
required init?(coder: NSCoder) {
|
|
333
|
+
required init?(coder: NSCoder) {
|
|
334
|
+
fatalError("init(coder:) has not been implemented")
|
|
335
|
+
}
|
|
405
336
|
|
|
406
337
|
override func viewDidLoad() {
|
|
407
338
|
super.viewDidLoad()
|
|
408
|
-
|
|
339
|
+
|
|
340
|
+
// Add blur effect (liquid glass)
|
|
341
|
+
let blurEffect = UIBlurEffect(style: .systemMaterial)
|
|
342
|
+
let blurView = UIVisualEffectView(effect: blurEffect)
|
|
343
|
+
blurView.translatesAutoresizingMaskIntoConstraints = false
|
|
344
|
+
view.addSubview(blurView)
|
|
345
|
+
|
|
346
|
+
tableView = UITableView(frame: .zero, style: .plain)
|
|
347
|
+
tableView.delegate = self
|
|
348
|
+
tableView.dataSource = self
|
|
349
|
+
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell")
|
|
350
|
+
tableView.backgroundColor = .clear
|
|
351
|
+
tableView.separatorStyle = .none // Remove dividers to match inline
|
|
352
|
+
tableView.isScrollEnabled = true
|
|
353
|
+
tableView.rowHeight = 44
|
|
354
|
+
tableView.contentInset = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0) // Add top/bottom padding
|
|
355
|
+
tableView.translatesAutoresizingMaskIntoConstraints = false
|
|
356
|
+
|
|
357
|
+
blurView.contentView.addSubview(tableView)
|
|
358
|
+
|
|
359
|
+
NSLayoutConstraint.activate([
|
|
360
|
+
blurView.topAnchor.constraint(equalTo: view.topAnchor),
|
|
361
|
+
blurView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
|
362
|
+
blurView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
|
363
|
+
blurView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
|
364
|
+
|
|
365
|
+
tableView.topAnchor.constraint(equalTo: blurView.contentView.topAnchor),
|
|
366
|
+
tableView.bottomAnchor.constraint(equalTo: blurView.contentView.bottomAnchor),
|
|
367
|
+
tableView.leadingAnchor.constraint(equalTo: blurView.contentView.leadingAnchor),
|
|
368
|
+
tableView.trailingAnchor.constraint(equalTo: blurView.contentView.trailingAnchor),
|
|
369
|
+
])
|
|
409
370
|
}
|
|
410
371
|
|
|
411
|
-
|
|
412
|
-
options.count
|
|
372
|
+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
373
|
+
return options.count
|
|
413
374
|
}
|
|
414
375
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
cell.
|
|
421
|
-
cell.accessoryType =
|
|
422
|
-
(opt.data == selectedData && !selectedData.isEmpty) ? .checkmark : .none
|
|
376
|
+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
377
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
|
|
378
|
+
cell.textLabel?.text = options[indexPath.row].label
|
|
379
|
+
cell.textLabel?.font = .systemFont(ofSize: 17)
|
|
380
|
+
cell.backgroundColor = .clear
|
|
381
|
+
cell.selectionStyle = .default
|
|
423
382
|
return cell
|
|
424
383
|
}
|
|
425
384
|
|
|
426
|
-
|
|
385
|
+
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
427
386
|
tableView.deselectRow(at: indexPath, animated: true)
|
|
428
|
-
|
|
387
|
+
dismiss(animated: true) { [weak self] in
|
|
388
|
+
self?.onSelect(indexPath.row)
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
|
|
393
|
+
onCancel()
|
|
429
394
|
}
|
|
430
395
|
|
|
431
|
-
func
|
|
432
|
-
|
|
396
|
+
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
|
|
397
|
+
return .none
|
|
433
398
|
}
|
|
434
399
|
}
|
|
400
|
+
|
package/lib/module/DatePicker.js
CHANGED
|
@@ -27,7 +27,8 @@ export function DatePicker(props) {
|
|
|
27
27
|
onConfirm,
|
|
28
28
|
onClosed,
|
|
29
29
|
ios,
|
|
30
|
-
android
|
|
30
|
+
android,
|
|
31
|
+
testID
|
|
31
32
|
} = props;
|
|
32
33
|
const handleConfirm = useCallback(e => {
|
|
33
34
|
onConfirm?.(new Date(e.nativeEvent.timestampMs));
|
|
@@ -63,6 +64,7 @@ export function DatePicker(props) {
|
|
|
63
64
|
} : undefined
|
|
64
65
|
};
|
|
65
66
|
return /*#__PURE__*/_jsx(NativeDatePicker, {
|
|
67
|
+
testID: testID,
|
|
66
68
|
...nativeProps
|
|
67
69
|
});
|
|
68
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","StyleSheet","NativeDatePicker","jsx","_jsx","dateToMsOrMinusOne","d","getTime","normalizeVisible","presentation","visible","undefined","DatePicker","props","style","date","minDate","maxDate","locale","timeZoneName","mode","onConfirm","onClosed","ios","android","handleConfirm","e","Date","nativeEvent","timestampMs","handleClosed","styles","createStyles","nativeProps","picker","dateMs","minDateMs","maxDateMs","preferredStyle","countDownDurationSeconds","minuteInterval","roundsToMinuteInterval","firstDayOfWeek","material","dialogTitle","positiveButtonTitle","negativeButtonTitle","create"],"sourceRoot":"../../src","sources":["DatePicker.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAEnD,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAOC,gBAAgB,MAShB,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","StyleSheet","NativeDatePicker","jsx","_jsx","dateToMsOrMinusOne","d","getTime","normalizeVisible","presentation","visible","undefined","DatePicker","props","style","date","minDate","maxDate","locale","timeZoneName","mode","onConfirm","onClosed","ios","android","testID","handleConfirm","e","Date","nativeEvent","timestampMs","handleClosed","styles","createStyles","nativeProps","picker","dateMs","minDateMs","maxDateMs","preferredStyle","countDownDurationSeconds","minuteInterval","roundsToMinuteInterval","firstDayOfWeek","material","dialogTitle","positiveButtonTitle","negativeButtonTitle","create"],"sourceRoot":"../../src","sources":["DatePicker.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAEnD,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAOC,gBAAgB,MAShB,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA+CrC,SAASC,kBAAkBA,CAACC,CAA0B,EAAU;EAC9D,OAAOA,CAAC,GAAGA,CAAC,CAACC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;AAC7B;AAEA,SAASC,gBAAgBA,CACvBC,YAA+D,EAC/DC,OAA4B,EACP;EACrB;EACA,IAAID,YAAY,KAAK,OAAO,EAAE,OAAOE,SAAS;EAC9C,OAAOD,OAAO,GAAG,MAAM,GAAG,QAAQ;AACpC;AAEA,OAAO,SAASE,UAAUA,CAACC,KAAsB,EAAsB;EACrE,MAAM;IACJC,KAAK;IACLC,IAAI;IACJC,OAAO;IACPC,OAAO;IACPC,MAAM;IACNC,YAAY;IACZC,IAAI;IACJX,YAAY,GAAG,OAAO;IACtBC,OAAO;IACPW,SAAS;IACTC,QAAQ;IACRC,G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pB,OAAO,CAACoB,QAAe;MACjCC,WAAW,EAAErB,OAAO,CAACqB,WAAW;MAChCC,mBAAmB,EAAEtB,OAAO,CAACsB,mBAAmB;MAChDC,mBAAmB,EAAEvB,OAAO,CAACuB;IAC/B,CAAC,GACDpC;EACN,CAAC;EAED,oBAAOP,IAAA,CAACF,gBAAgB;IAACuB,MAAM,EAAEA,MAAO;IAAA,GAAKS;EAAW,CAAG,CAAC;AAC9D;AAEA,SAASD,YAAYA,CAAA,EAAG;EACtB,OAAOhC,UAAU,CAAC+C,MAAM,CAAC;IACvBb,MAAM,EAAE,CAAC;EACX,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -13,11 +13,6 @@ function normalizeNativeVisible(inlineMode, visible) {
|
|
|
13
13
|
if (inlineMode) return undefined;
|
|
14
14
|
return visible ? 'open' : 'closed';
|
|
15
15
|
}
|
|
16
|
-
function normalizeNativePresentation(inlineMode, presentation) {
|
|
17
|
-
// Inline mode ignores presentation.
|
|
18
|
-
if (inlineMode) return undefined;
|
|
19
|
-
return presentation ?? 'auto';
|
|
20
|
-
}
|
|
21
16
|
export function SelectionMenu(props) {
|
|
22
17
|
const {
|
|
23
18
|
style,
|
|
@@ -27,15 +22,14 @@ export function SelectionMenu(props) {
|
|
|
27
22
|
placeholder,
|
|
28
23
|
inlineMode,
|
|
29
24
|
visible,
|
|
30
|
-
presentation,
|
|
31
25
|
onSelect,
|
|
32
26
|
onRequestClose,
|
|
33
27
|
ios,
|
|
34
|
-
android
|
|
28
|
+
android,
|
|
29
|
+
...viewProps
|
|
35
30
|
} = props;
|
|
36
31
|
const selectedData = useMemo(() => normalizeSelectedData(selected), [selected]);
|
|
37
32
|
const nativeVisible = useMemo(() => normalizeNativeVisible(inlineMode, visible), [inlineMode, visible]);
|
|
38
|
-
const nativePresentation = useMemo(() => normalizeNativePresentation(inlineMode, presentation), [inlineMode, presentation]);
|
|
39
33
|
const handleSelect = useCallback(e => {
|
|
40
34
|
const {
|
|
41
35
|
index,
|
|
@@ -64,11 +58,11 @@ export function SelectionMenu(props) {
|
|
|
64
58
|
placeholder: placeholder,
|
|
65
59
|
anchorMode: inlineMode ? 'inline' : 'headless',
|
|
66
60
|
visible: nativeVisible,
|
|
67
|
-
presentation: nativePresentation,
|
|
68
61
|
onSelect: onSelect ? handleSelect : undefined,
|
|
69
62
|
onRequestClose: onRequestClose ? handleRequestClose : undefined,
|
|
70
63
|
ios: ios,
|
|
71
|
-
android: nativeAndroid
|
|
64
|
+
android: nativeAndroid,
|
|
65
|
+
...viewProps
|
|
72
66
|
});
|
|
73
67
|
}
|
|
74
68
|
const styles = StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","Platform","StyleSheet","NativeSelectionMenu","jsx","_jsx","normalizeSelectedData","selected","normalizeNativeVisible","inlineMode","visible","undefined","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","Platform","StyleSheet","NativeSelectionMenu","jsx","_jsx","normalizeSelectedData","selected","normalizeNativeVisible","inlineMode","visible","undefined","SelectionMenu","props","style","options","disabled","placeholder","onSelect","onRequestClose","ios","android","viewProps","selectedData","nativeVisible","handleSelect","e","index","label","data","nativeEvent","handleRequestClose","nativeAndroid","material","isAndroidM3Inline","OS","styles","androidInline","interactivity","anchorMode","create","minHeight"],"sourceRoot":"../../src","sources":["SelectionMenu.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,QAAQ,EAAEC,UAAU,QAAwB,cAAc;AAEnE,OAAOC,mBAAmB,MAGnB,gCAAgC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAsDxC,SAASC,qBAAqBA,CAACC,QAAuB,EAAU;EAC9D,OAAOA,QAAQ,IAAI,EAAE;AACvB;AAEA,SAASC,sBAAsBA,CAC7BC,UAA+B,EAC/BC,OAA4B,EACG;EAC/B;EACA,IAAID,UAAU,EAAE,OAAOE,SAAS;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9B,IAAA,CAACF,mBAAmB;IAClBW,KAAK,EAAE,CAACA,KAAK,EAAEoB,iBAAiB,IAAIE,MAAM,CAACC,aAAa,CAAE;IAC1DtB,OAAO,EAAEA,OAAQ;IACjBQ,YAAY,EAAEA,YAAa;IAC3Be,aAAa,EAAEtB,QAAQ,GAAG,UAAU,GAAG,SAAU;IACjDC,WAAW,EAAEA,WAAY;IACzBsB,UAAU,EAAE9B,UAAU,GAAG,QAAQ,GAAG,UAAW;IAC/CC,OAAO,EAAEc,aAAc;IACvBN,QAAQ,EAAEA,QAAQ,GAAGO,YAAY,GAAGd,SAAU;IAC9CQ,cAAc,EAAEA,cAAc,GAAGY,kBAAkB,GAAGpB,SAAU;IAChES,GAAG,EAAEA,GAAI;IACTC,OAAO,EAAEW,aAAc;IAAA,GACnBV;EAAS,CACd,CAAC;AAEN;AAEA,MAAMc,MAAM,GAAGlC,UAAU,CAACsC,MAAM,CAAC;EAC/BH,aAAa,EAAE;IAAEI,SAAS,EAAE;EAAG;AACjC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -27,9 +27,6 @@ export type SelectionMenuSelectEvent = Readonly<{
|
|
|
27
27
|
/** Visibility state (headless mode only). */
|
|
28
28
|
export type SelectionMenuVisible = 'open' | 'closed';
|
|
29
29
|
|
|
30
|
-
/** Presentation hint (headless mode only). */
|
|
31
|
-
export type SelectionMenuPresentation = 'auto' | 'popover' | 'sheet';
|
|
32
|
-
|
|
33
30
|
/** Interactivity state (no booleans). */
|
|
34
31
|
export type SelectionMenuInteractivity = 'enabled' | 'disabled';
|
|
35
32
|
|
|
@@ -83,12 +80,6 @@ export interface SelectionMenuProps extends ViewProps {
|
|
|
83
80
|
*/
|
|
84
81
|
visible?: string; // SelectionMenuVisible
|
|
85
82
|
|
|
86
|
-
/**
|
|
87
|
-
* Headless mode only:
|
|
88
|
-
* presentation hint.
|
|
89
|
-
*/
|
|
90
|
-
presentation?: string; // SelectionMenuPresentation
|
|
91
|
-
|
|
92
83
|
/**
|
|
93
84
|
* Fired when the user selects an option.
|
|
94
85
|
*/
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,iBAAc;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,iBAAc;AAC5B,cAAc,oBAAiB;AAC/B,cAAc,kBAAe","ignoreList":[]}
|
|
@@ -20,6 +20,8 @@ export type DatePickerProps = {
|
|
|
20
20
|
visible?: boolean;
|
|
21
21
|
onConfirm?: (dateTime: Date) => void;
|
|
22
22
|
onClosed?: () => void;
|
|
23
|
+
/** Test identifier */
|
|
24
|
+
testID?: string;
|
|
23
25
|
ios?: {
|
|
24
26
|
preferredStyle?: IOSDatePickerStyle;
|
|
25
27
|
countDownDurationSeconds?: NativeIOSProps['countDownDurationSeconds'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/DatePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAwB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAyB,EAGvB,KAAK,QAAQ,IAAI,cAAc,EAC/B,KAAK,YAAY,IAAI,kBAAkB,EACvC,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,mBAAmB,EAAW,MAAM,eAAe,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,2DAA2D;IAC3D,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAElB,mDAAmD;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AAkB,CAAC,aAAa,CAAC,CAAC;QAChD,mBAAmB,CAAC,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;QAChE,mBAAmB,CAAC,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;KACjE,CAAC;CACH,CAAC;AAeF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,YAAY,CAqErE"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
import { type SelectionMenuOption
|
|
2
|
+
import { type ViewProps } from 'react-native';
|
|
3
|
+
import { type SelectionMenuOption } from './SelectionMenuNativeComponent';
|
|
4
4
|
import type { AndroidMaterialMode } from './sharedTypes';
|
|
5
|
-
export
|
|
6
|
-
style?: StyleProp<ViewStyle>;
|
|
5
|
+
export interface SelectionMenuProps extends ViewProps {
|
|
7
6
|
/** Options are label + data (payload) */
|
|
8
7
|
options: readonly SelectionMenuOption[];
|
|
9
8
|
/**
|
|
@@ -23,11 +22,6 @@ export type SelectionMenuProps = {
|
|
|
23
22
|
* controls whether the native menu UI is presented.
|
|
24
23
|
*/
|
|
25
24
|
visible?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Headless mode only (inlineMode === false):
|
|
28
|
-
* presentation hint ("auto" | "popover" | "sheet").
|
|
29
|
-
*/
|
|
30
|
-
presentation?: SelectionMenuPresentation;
|
|
31
25
|
/**
|
|
32
26
|
* Called when the user selects an option.
|
|
33
27
|
* Receives the selected `data` payload, plus label/index for convenience.
|
|
@@ -45,6 +39,8 @@ export type SelectionMenuProps = {
|
|
|
45
39
|
/** Material preference ("auto" | "m2" | "m3"). */
|
|
46
40
|
material?: AndroidMaterialMode;
|
|
47
41
|
};
|
|
48
|
-
|
|
42
|
+
/** Test identifier */
|
|
43
|
+
testID?: string;
|
|
44
|
+
}
|
|
49
45
|
export declare function SelectionMenu(props: SelectionMenuProps): React.ReactElement;
|
|
50
46
|
//# sourceMappingURL=SelectionMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionMenu.d.ts","sourceRoot":"","sources":["../../../src/SelectionMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectionMenu.d.ts","sourceRoot":"","sources":["../../../src/SelectionMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAA4B,EAC1B,KAAK,mBAAmB,EAEzB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,yCAAyC;IACzC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAExC;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhE;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,CAAC;IAET,OAAO,CAAC,EAAE;QACR,kDAAkD;QAClD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;KAChC,CAAC;IAEF,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAkE3E"}
|