react-native-nitro-modal 0.2.0 → 0.3.1-rc
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/README.md +52 -4
- package/android/src/main/java/com/margelo/nitro/nitromodal/BottomSheetPresenter.kt +399 -34
- package/android/src/main/java/com/margelo/nitro/nitromodal/HybridNitroModal.kt +67 -22
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalConfig.kt +35 -1
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalContentRoot.kt +48 -5
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalPresenter.kt +63 -4
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalHostView.kt +68 -8
- package/ios/HybridNitroModal.swift +115 -20
- package/ios/ModalConfig.swift +48 -2
- package/ios/NitroModalHostView.swift +73 -8
- package/ios/SheetView.swift +647 -0
- package/ios/SheetViewController.swift +19 -450
- package/lib/module/NitroModal.js +54 -6
- package/lib/module/NitroModal.js.map +1 -1
- package/lib/module/NitroModalView.web.js +86 -26
- package/lib/module/NitroModalView.web.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/web/AnimatedValue.js +3 -0
- package/lib/module/web/AnimatedValue.js.map +1 -1
- package/lib/module/web/ModalConfig.js +10 -4
- package/lib/module/web/ModalConfig.js.map +1 -1
- package/lib/module/web/ModalController.js +29 -2
- package/lib/module/web/ModalController.js.map +1 -1
- package/lib/module/web/ModalPresenter.js +47 -12
- package/lib/module/web/ModalPresenter.js.map +1 -1
- package/lib/module/web/SheetPresenter.js +118 -34
- package/lib/module/web/SheetPresenter.js.map +1 -1
- package/lib/module/web/dom.js +16 -0
- package/lib/module/web/dom.js.map +1 -1
- package/lib/typescript/src/NitroModal.d.ts +42 -2
- package/lib/typescript/src/NitroModal.d.ts.map +1 -1
- package/lib/typescript/src/NitroModal.nitro.d.ts +37 -2
- package/lib/typescript/src/NitroModal.nitro.d.ts.map +1 -1
- package/lib/typescript/src/NitroModalView.web.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/web/AnimatedValue.d.ts +1 -0
- package/lib/typescript/src/web/AnimatedValue.d.ts.map +1 -1
- package/lib/typescript/src/web/ModalConfig.d.ts +10 -0
- package/lib/typescript/src/web/ModalConfig.d.ts.map +1 -1
- package/lib/typescript/src/web/ModalController.d.ts +5 -0
- package/lib/typescript/src/web/ModalController.d.ts.map +1 -1
- package/lib/typescript/src/web/ModalPresenter.d.ts +13 -0
- package/lib/typescript/src/web/ModalPresenter.d.ts.map +1 -1
- package/lib/typescript/src/web/SheetPresenter.d.ts +13 -2
- package/lib/typescript/src/web/SheetPresenter.d.ts.map +1 -1
- package/lib/typescript/src/web/dom.d.ts +4 -0
- package/lib/typescript/src/web/dom.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.cpp +78 -6
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.hpp +14 -2
- package/nitrogen/generated/android/c++/JNamedSheetDetent.hpp +64 -0
- package/nitrogen/generated/android/c++/JSheetDetent.cpp +26 -0
- package/nitrogen/generated/android/c++/JSheetDetent.hpp +42 -37
- package/nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.cpp +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/HybridNitroModalSpec.kt +52 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/NamedSheetDetent.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/SheetDetent.kt +47 -10
- package/nitrogen/generated/android/nitromodal+autolinking.cmake +1 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Bridge.hpp +68 -8
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Umbrella.hpp +4 -3
- package/nitrogen/generated/ios/c++/HybridNitroModalSpecSwift.hpp +46 -5
- package/nitrogen/generated/ios/c++/views/HybridNitroModalComponent.mm +36 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec.swift +6 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec_cxx.swift +158 -5
- package/nitrogen/generated/ios/swift/NamedSheetDetent.swift +48 -0
- package/nitrogen/generated/ios/swift/SheetDetent.swift +15 -33
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.cpp +12 -0
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.hpp +18 -5
- package/nitrogen/generated/shared/c++/{SheetDetent.hpp → NamedSheetDetent.hpp} +17 -17
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.cpp +13 -1
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.hpp +21 -2
- package/nitrogen/generated/shared/json/NitroModalConfig.json +6 -0
- package/package.json +1 -1
- package/src/NitroModal.nitro.ts +38 -2
- package/src/NitroModal.tsx +93 -4
- package/src/NitroModalView.web.tsx +79 -12
- package/src/index.tsx +2 -0
- package/src/web/AnimatedValue.ts +4 -0
- package/src/web/ModalConfig.ts +19 -3
- package/src/web/ModalController.ts +35 -2
- package/src/web/ModalPresenter.ts +50 -11
- package/src/web/SheetPresenter.ts +169 -37
- package/src/web/dom.ts +20 -0
|
@@ -143,20 +143,50 @@ open class HybridNitroModalSpec_cxx {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
public final var
|
|
146
|
+
public final var isInline: Bool {
|
|
147
147
|
@inline(__always)
|
|
148
148
|
get {
|
|
149
|
-
return
|
|
150
|
-
|
|
149
|
+
return self.__implementation.isInline
|
|
150
|
+
}
|
|
151
|
+
@inline(__always)
|
|
152
|
+
set {
|
|
153
|
+
self.__implementation.isInline = newValue
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public final var detents: bridge.std__vector_std__variant_NamedSheetDetent__double__ {
|
|
158
|
+
@inline(__always)
|
|
159
|
+
get {
|
|
160
|
+
return { () -> bridge.std__vector_std__variant_NamedSheetDetent__double__ in
|
|
161
|
+
var __vector = bridge.create_std__vector_std__variant_NamedSheetDetent__double__(self.__implementation.detents.count)
|
|
151
162
|
for __item in self.__implementation.detents {
|
|
152
|
-
__vector.push_back(
|
|
163
|
+
__vector.push_back({ () -> bridge.std__variant_NamedSheetDetent__double_ in
|
|
164
|
+
switch __item {
|
|
165
|
+
case .first(let __value):
|
|
166
|
+
return bridge.create_std__variant_NamedSheetDetent__double_(__value)
|
|
167
|
+
case .second(let __value):
|
|
168
|
+
return bridge.create_std__variant_NamedSheetDetent__double_(__value)
|
|
169
|
+
}
|
|
170
|
+
}().variant)
|
|
153
171
|
}
|
|
154
172
|
return __vector
|
|
155
173
|
}()
|
|
156
174
|
}
|
|
157
175
|
@inline(__always)
|
|
158
176
|
set {
|
|
159
|
-
self.__implementation.detents = newValue.map({ __item in
|
|
177
|
+
self.__implementation.detents = newValue.map({ __item in { () -> SheetDetent in
|
|
178
|
+
let __variant = bridge.std__variant_NamedSheetDetent__double_(__item)
|
|
179
|
+
switch __variant.index() {
|
|
180
|
+
case 0:
|
|
181
|
+
let __actual = __variant.get_0()
|
|
182
|
+
return .first(__actual)
|
|
183
|
+
case 1:
|
|
184
|
+
let __actual = __variant.get_1()
|
|
185
|
+
return .second(__actual)
|
|
186
|
+
default:
|
|
187
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
188
|
+
}
|
|
189
|
+
}() })
|
|
160
190
|
}
|
|
161
191
|
}
|
|
162
192
|
|
|
@@ -305,6 +335,65 @@ open class HybridNitroModalSpec_cxx {
|
|
|
305
335
|
}
|
|
306
336
|
}
|
|
307
337
|
|
|
338
|
+
public final var pullToRefreshEnabled: Bool {
|
|
339
|
+
@inline(__always)
|
|
340
|
+
get {
|
|
341
|
+
return self.__implementation.pullToRefreshEnabled
|
|
342
|
+
}
|
|
343
|
+
@inline(__always)
|
|
344
|
+
set {
|
|
345
|
+
self.__implementation.pullToRefreshEnabled = newValue
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
public final var refreshing: bridge.std__optional_bool_ {
|
|
350
|
+
@inline(__always)
|
|
351
|
+
get {
|
|
352
|
+
return { () -> bridge.std__optional_bool_ in
|
|
353
|
+
if let __unwrappedValue = self.__implementation.refreshing {
|
|
354
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
355
|
+
} else {
|
|
356
|
+
return .init()
|
|
357
|
+
}
|
|
358
|
+
}()
|
|
359
|
+
}
|
|
360
|
+
@inline(__always)
|
|
361
|
+
set {
|
|
362
|
+
self.__implementation.refreshing = { () -> Bool? in
|
|
363
|
+
if bridge.has_value_std__optional_bool_(newValue) {
|
|
364
|
+
let __unwrapped = bridge.get_std__optional_bool_(newValue)
|
|
365
|
+
return __unwrapped
|
|
366
|
+
} else {
|
|
367
|
+
return nil
|
|
368
|
+
}
|
|
369
|
+
}()
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
public final var refreshIndicatorColor: bridge.std__optional_double_ {
|
|
374
|
+
@inline(__always)
|
|
375
|
+
get {
|
|
376
|
+
return { () -> bridge.std__optional_double_ in
|
|
377
|
+
if let __unwrappedValue = self.__implementation.refreshIndicatorColor {
|
|
378
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
379
|
+
} else {
|
|
380
|
+
return .init()
|
|
381
|
+
}
|
|
382
|
+
}()
|
|
383
|
+
}
|
|
384
|
+
@inline(__always)
|
|
385
|
+
set {
|
|
386
|
+
self.__implementation.refreshIndicatorColor = { () -> Double? in
|
|
387
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
388
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
389
|
+
return __unwrapped
|
|
390
|
+
} else {
|
|
391
|
+
return nil
|
|
392
|
+
}
|
|
393
|
+
}()
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
308
397
|
public final var onPresent: bridge.std__optional_std__function_void____ {
|
|
309
398
|
@inline(__always)
|
|
310
399
|
get {
|
|
@@ -496,6 +585,70 @@ open class HybridNitroModalSpec_cxx {
|
|
|
496
585
|
}()
|
|
497
586
|
}
|
|
498
587
|
}
|
|
588
|
+
|
|
589
|
+
public final var onPullToRefresh: bridge.std__optional_std__function_void____ {
|
|
590
|
+
@inline(__always)
|
|
591
|
+
get {
|
|
592
|
+
return { () -> bridge.std__optional_std__function_void____ in
|
|
593
|
+
if let __unwrappedValue = self.__implementation.onPullToRefresh {
|
|
594
|
+
return bridge.create_std__optional_std__function_void____({ () -> bridge.Func_void in
|
|
595
|
+
let __closureWrapper = Func_void(__unwrappedValue)
|
|
596
|
+
return bridge.create_Func_void(__closureWrapper.toUnsafe())
|
|
597
|
+
}())
|
|
598
|
+
} else {
|
|
599
|
+
return .init()
|
|
600
|
+
}
|
|
601
|
+
}()
|
|
602
|
+
}
|
|
603
|
+
@inline(__always)
|
|
604
|
+
set {
|
|
605
|
+
self.__implementation.onPullToRefresh = { () -> (() -> Void)? in
|
|
606
|
+
if bridge.has_value_std__optional_std__function_void____(newValue) {
|
|
607
|
+
let __unwrapped = bridge.get_std__optional_std__function_void____(newValue)
|
|
608
|
+
return { () -> () -> Void in
|
|
609
|
+
let __wrappedFunction = bridge.wrap_Func_void(__unwrapped)
|
|
610
|
+
return { () -> Void in
|
|
611
|
+
__wrappedFunction.call()
|
|
612
|
+
}
|
|
613
|
+
}()
|
|
614
|
+
} else {
|
|
615
|
+
return nil
|
|
616
|
+
}
|
|
617
|
+
}()
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
public final var onRestingTopChange: bridge.std__optional_std__function_void_double____top______ {
|
|
622
|
+
@inline(__always)
|
|
623
|
+
get {
|
|
624
|
+
return { () -> bridge.std__optional_std__function_void_double____top______ in
|
|
625
|
+
if let __unwrappedValue = self.__implementation.onRestingTopChange {
|
|
626
|
+
return bridge.create_std__optional_std__function_void_double____top______({ () -> bridge.Func_void_double in
|
|
627
|
+
let __closureWrapper = Func_void_double(__unwrappedValue)
|
|
628
|
+
return bridge.create_Func_void_double(__closureWrapper.toUnsafe())
|
|
629
|
+
}())
|
|
630
|
+
} else {
|
|
631
|
+
return .init()
|
|
632
|
+
}
|
|
633
|
+
}()
|
|
634
|
+
}
|
|
635
|
+
@inline(__always)
|
|
636
|
+
set {
|
|
637
|
+
self.__implementation.onRestingTopChange = { () -> ((_ top: Double) -> Void)? in
|
|
638
|
+
if bridge.has_value_std__optional_std__function_void_double____top______(newValue) {
|
|
639
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_double____top______(newValue)
|
|
640
|
+
return { () -> (Double) -> Void in
|
|
641
|
+
let __wrappedFunction = bridge.wrap_Func_void_double(__unwrapped)
|
|
642
|
+
return { (__top: Double) -> Void in
|
|
643
|
+
__wrappedFunction.call(__top)
|
|
644
|
+
}
|
|
645
|
+
}()
|
|
646
|
+
} else {
|
|
647
|
+
return nil
|
|
648
|
+
}
|
|
649
|
+
}()
|
|
650
|
+
}
|
|
651
|
+
}
|
|
499
652
|
|
|
500
653
|
// Methods
|
|
501
654
|
@inline(__always)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NamedSheetDetent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `NamedSheetDetent`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias NamedSheetDetent = margelo.nitro.nitromodal.NamedSheetDetent
|
|
12
|
+
|
|
13
|
+
public extension NamedSheetDetent {
|
|
14
|
+
/**
|
|
15
|
+
* Get a NamedSheetDetent for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "small":
|
|
21
|
+
self = .small
|
|
22
|
+
case "medium":
|
|
23
|
+
self = .medium
|
|
24
|
+
case "large":
|
|
25
|
+
self = .large
|
|
26
|
+
case "fitContent":
|
|
27
|
+
self = .fitcontent
|
|
28
|
+
default:
|
|
29
|
+
return nil
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the String value this NamedSheetDetent represents.
|
|
35
|
+
*/
|
|
36
|
+
var stringValue: String {
|
|
37
|
+
switch self {
|
|
38
|
+
case .small:
|
|
39
|
+
return "small"
|
|
40
|
+
case .medium:
|
|
41
|
+
return "medium"
|
|
42
|
+
case .large:
|
|
43
|
+
return "large"
|
|
44
|
+
case .fitcontent:
|
|
45
|
+
return "fitContent"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -5,44 +5,26 @@
|
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `enum | number`
|
|
10
13
|
*/
|
|
11
|
-
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum SheetDetent {
|
|
16
|
+
case first(NamedSheetDetent)
|
|
17
|
+
case second(Double)
|
|
18
|
+
}
|
|
12
19
|
|
|
13
20
|
public extension SheetDetent {
|
|
14
|
-
|
|
15
|
-
* Get a SheetDetent for the given String value, or
|
|
16
|
-
* return `nil` if the given value was invalid/unknown.
|
|
17
|
-
*/
|
|
18
|
-
init?(fromString string: String) {
|
|
19
|
-
switch string {
|
|
20
|
-
case "small":
|
|
21
|
-
self = .small
|
|
22
|
-
case "medium":
|
|
23
|
-
self = .medium
|
|
24
|
-
case "large":
|
|
25
|
-
self = .large
|
|
26
|
-
case "fitContent":
|
|
27
|
-
self = .fitcontent
|
|
28
|
-
default:
|
|
29
|
-
return nil
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Get the String value this SheetDetent represents.
|
|
35
|
-
*/
|
|
36
|
-
var stringValue: String {
|
|
21
|
+
func asType<T>(_ type: T.Type = T.self) -> T? {
|
|
37
22
|
switch self {
|
|
38
|
-
case .
|
|
39
|
-
|
|
40
|
-
case .medium:
|
|
41
|
-
return "medium"
|
|
42
|
-
case .large:
|
|
43
|
-
return "large"
|
|
44
|
-
case .fitcontent:
|
|
45
|
-
return "fitContent"
|
|
23
|
+
case .first(let value): return value as? T
|
|
24
|
+
case .second(let value): return value as? T
|
|
46
25
|
}
|
|
47
26
|
}
|
|
27
|
+
func isType<T>(_ type: T.Type = T.self) -> Bool {
|
|
28
|
+
return self.asType(type) != nil
|
|
29
|
+
}
|
|
48
30
|
}
|
|
@@ -18,6 +18,8 @@ namespace margelo::nitro::nitromodal {
|
|
|
18
18
|
prototype.registerHybridSetter("isOpen", &HybridNitroModalSpec::setIsOpen);
|
|
19
19
|
prototype.registerHybridGetter("mode", &HybridNitroModalSpec::getMode);
|
|
20
20
|
prototype.registerHybridSetter("mode", &HybridNitroModalSpec::setMode);
|
|
21
|
+
prototype.registerHybridGetter("isInline", &HybridNitroModalSpec::getIsInline);
|
|
22
|
+
prototype.registerHybridSetter("isInline", &HybridNitroModalSpec::setIsInline);
|
|
21
23
|
prototype.registerHybridGetter("detents", &HybridNitroModalSpec::getDetents);
|
|
22
24
|
prototype.registerHybridSetter("detents", &HybridNitroModalSpec::setDetents);
|
|
23
25
|
prototype.registerHybridGetter("initialDetentIndex", &HybridNitroModalSpec::getInitialDetentIndex);
|
|
@@ -44,6 +46,12 @@ namespace margelo::nitro::nitromodal {
|
|
|
44
46
|
prototype.registerHybridSetter("keyboardBehavior", &HybridNitroModalSpec::setKeyboardBehavior);
|
|
45
47
|
prototype.registerHybridGetter("popupAnimation", &HybridNitroModalSpec::getPopupAnimation);
|
|
46
48
|
prototype.registerHybridSetter("popupAnimation", &HybridNitroModalSpec::setPopupAnimation);
|
|
49
|
+
prototype.registerHybridGetter("pullToRefreshEnabled", &HybridNitroModalSpec::getPullToRefreshEnabled);
|
|
50
|
+
prototype.registerHybridSetter("pullToRefreshEnabled", &HybridNitroModalSpec::setPullToRefreshEnabled);
|
|
51
|
+
prototype.registerHybridGetter("refreshing", &HybridNitroModalSpec::getRefreshing);
|
|
52
|
+
prototype.registerHybridSetter("refreshing", &HybridNitroModalSpec::setRefreshing);
|
|
53
|
+
prototype.registerHybridGetter("refreshIndicatorColor", &HybridNitroModalSpec::getRefreshIndicatorColor);
|
|
54
|
+
prototype.registerHybridSetter("refreshIndicatorColor", &HybridNitroModalSpec::setRefreshIndicatorColor);
|
|
47
55
|
prototype.registerHybridGetter("onPresent", &HybridNitroModalSpec::getOnPresent);
|
|
48
56
|
prototype.registerHybridSetter("onPresent", &HybridNitroModalSpec::setOnPresent);
|
|
49
57
|
prototype.registerHybridGetter("onDismiss", &HybridNitroModalSpec::getOnDismiss);
|
|
@@ -56,6 +64,10 @@ namespace margelo::nitro::nitromodal {
|
|
|
56
64
|
prototype.registerHybridSetter("onBackButtonPress", &HybridNitroModalSpec::setOnBackButtonPress);
|
|
57
65
|
prototype.registerHybridGetter("onContentAreaChange", &HybridNitroModalSpec::getOnContentAreaChange);
|
|
58
66
|
prototype.registerHybridSetter("onContentAreaChange", &HybridNitroModalSpec::setOnContentAreaChange);
|
|
67
|
+
prototype.registerHybridGetter("onPullToRefresh", &HybridNitroModalSpec::getOnPullToRefresh);
|
|
68
|
+
prototype.registerHybridSetter("onPullToRefresh", &HybridNitroModalSpec::setOnPullToRefresh);
|
|
69
|
+
prototype.registerHybridGetter("onRestingTopChange", &HybridNitroModalSpec::getOnRestingTopChange);
|
|
70
|
+
prototype.registerHybridSetter("onRestingTopChange", &HybridNitroModalSpec::setOnRestingTopChange);
|
|
59
71
|
prototype.registerHybridMethod("present", &HybridNitroModalSpec::present);
|
|
60
72
|
prototype.registerHybridMethod("dismiss", &HybridNitroModalSpec::dismiss);
|
|
61
73
|
prototype.registerHybridMethod("snapToDetent", &HybridNitroModalSpec::snapToDetent);
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
// Forward declaration of `ModalMode` to properly resolve imports.
|
|
17
17
|
namespace margelo::nitro::nitromodal { enum class ModalMode; }
|
|
18
|
-
// Forward declaration of `
|
|
19
|
-
namespace margelo::nitro::nitromodal { enum class
|
|
18
|
+
// Forward declaration of `NamedSheetDetent` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitromodal { enum class NamedSheetDetent; }
|
|
20
20
|
// Forward declaration of `KeyboardBehavior` to properly resolve imports.
|
|
21
21
|
namespace margelo::nitro::nitromodal { enum class KeyboardBehavior; }
|
|
22
22
|
// Forward declaration of `PopupAnimation` to properly resolve imports.
|
|
@@ -27,7 +27,8 @@ namespace margelo::nitro::nitromodal { enum class DismissReason; }
|
|
|
27
27
|
namespace margelo::nitro::nitromodal { struct ModalContentArea; }
|
|
28
28
|
|
|
29
29
|
#include "ModalMode.hpp"
|
|
30
|
-
#include "
|
|
30
|
+
#include "NamedSheetDetent.hpp"
|
|
31
|
+
#include <variant>
|
|
31
32
|
#include <vector>
|
|
32
33
|
#include <optional>
|
|
33
34
|
#include "KeyboardBehavior.hpp"
|
|
@@ -67,8 +68,10 @@ namespace margelo::nitro::nitromodal {
|
|
|
67
68
|
virtual void setIsOpen(bool isOpen) = 0;
|
|
68
69
|
virtual ModalMode getMode() = 0;
|
|
69
70
|
virtual void setMode(ModalMode mode) = 0;
|
|
70
|
-
virtual
|
|
71
|
-
virtual void
|
|
71
|
+
virtual bool getIsInline() = 0;
|
|
72
|
+
virtual void setIsInline(bool isInline) = 0;
|
|
73
|
+
virtual std::vector<std::variant<NamedSheetDetent, double>> getDetents() = 0;
|
|
74
|
+
virtual void setDetents(const std::vector<std::variant<NamedSheetDetent, double>>& detents) = 0;
|
|
72
75
|
virtual double getInitialDetentIndex() = 0;
|
|
73
76
|
virtual void setInitialDetentIndex(double initialDetentIndex) = 0;
|
|
74
77
|
virtual double getBackdropColor() = 0;
|
|
@@ -93,6 +96,12 @@ namespace margelo::nitro::nitromodal {
|
|
|
93
96
|
virtual void setKeyboardBehavior(KeyboardBehavior keyboardBehavior) = 0;
|
|
94
97
|
virtual PopupAnimation getPopupAnimation() = 0;
|
|
95
98
|
virtual void setPopupAnimation(PopupAnimation popupAnimation) = 0;
|
|
99
|
+
virtual bool getPullToRefreshEnabled() = 0;
|
|
100
|
+
virtual void setPullToRefreshEnabled(bool pullToRefreshEnabled) = 0;
|
|
101
|
+
virtual std::optional<bool> getRefreshing() = 0;
|
|
102
|
+
virtual void setRefreshing(std::optional<bool> refreshing) = 0;
|
|
103
|
+
virtual std::optional<double> getRefreshIndicatorColor() = 0;
|
|
104
|
+
virtual void setRefreshIndicatorColor(std::optional<double> refreshIndicatorColor) = 0;
|
|
96
105
|
virtual std::optional<std::function<void()>> getOnPresent() = 0;
|
|
97
106
|
virtual void setOnPresent(const std::optional<std::function<void()>>& onPresent) = 0;
|
|
98
107
|
virtual std::optional<std::function<void(DismissReason /* reason */)>> getOnDismiss() = 0;
|
|
@@ -105,6 +114,10 @@ namespace margelo::nitro::nitromodal {
|
|
|
105
114
|
virtual void setOnBackButtonPress(const std::optional<std::function<void()>>& onBackButtonPress) = 0;
|
|
106
115
|
virtual std::optional<std::function<void(const ModalContentArea& /* area */)>> getOnContentAreaChange() = 0;
|
|
107
116
|
virtual void setOnContentAreaChange(const std::optional<std::function<void(const ModalContentArea& /* area */)>>& onContentAreaChange) = 0;
|
|
117
|
+
virtual std::optional<std::function<void()>> getOnPullToRefresh() = 0;
|
|
118
|
+
virtual void setOnPullToRefresh(const std::optional<std::function<void()>>& onPullToRefresh) = 0;
|
|
119
|
+
virtual std::optional<std::function<void(double /* top */)>> getOnRestingTopChange() = 0;
|
|
120
|
+
virtual void setOnRestingTopChange(const std::optional<std::function<void(double /* top */)>>& onRestingTopChange) = 0;
|
|
108
121
|
|
|
109
122
|
public:
|
|
110
123
|
// Methods
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// NamedSheetDetent.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
namespace margelo::nitro::nitromodal {
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* An enum which can be represented as a JavaScript union (
|
|
29
|
+
* An enum which can be represented as a JavaScript union (NamedSheetDetent).
|
|
30
30
|
*/
|
|
31
|
-
enum class
|
|
31
|
+
enum class NamedSheetDetent {
|
|
32
32
|
SMALL SWIFT_NAME(small) = 0,
|
|
33
33
|
MEDIUM SWIFT_NAME(medium) = 1,
|
|
34
34
|
LARGE SWIFT_NAME(large) = 2,
|
|
@@ -39,28 +39,28 @@ namespace margelo::nitro::nitromodal {
|
|
|
39
39
|
|
|
40
40
|
namespace margelo::nitro {
|
|
41
41
|
|
|
42
|
-
// C++
|
|
42
|
+
// C++ NamedSheetDetent <> JS NamedSheetDetent (union)
|
|
43
43
|
template <>
|
|
44
|
-
struct JSIConverter<margelo::nitro::nitromodal::
|
|
45
|
-
static inline margelo::nitro::nitromodal::
|
|
44
|
+
struct JSIConverter<margelo::nitro::nitromodal::NamedSheetDetent> final {
|
|
45
|
+
static inline margelo::nitro::nitromodal::NamedSheetDetent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
46
|
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
47
|
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
-
case hashString("small"): return margelo::nitro::nitromodal::
|
|
49
|
-
case hashString("medium"): return margelo::nitro::nitromodal::
|
|
50
|
-
case hashString("large"): return margelo::nitro::nitromodal::
|
|
51
|
-
case hashString("fitContent"): return margelo::nitro::nitromodal::
|
|
48
|
+
case hashString("small"): return margelo::nitro::nitromodal::NamedSheetDetent::SMALL;
|
|
49
|
+
case hashString("medium"): return margelo::nitro::nitromodal::NamedSheetDetent::MEDIUM;
|
|
50
|
+
case hashString("large"): return margelo::nitro::nitromodal::NamedSheetDetent::LARGE;
|
|
51
|
+
case hashString("fitContent"): return margelo::nitro::nitromodal::NamedSheetDetent::FITCONTENT;
|
|
52
52
|
default: [[unlikely]]
|
|
53
|
-
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum NamedSheetDetent - invalid value!");
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitromodal::
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::nitromodal::NamedSheetDetent arg) {
|
|
57
57
|
switch (arg) {
|
|
58
|
-
case margelo::nitro::nitromodal::
|
|
59
|
-
case margelo::nitro::nitromodal::
|
|
60
|
-
case margelo::nitro::nitromodal::
|
|
61
|
-
case margelo::nitro::nitromodal::
|
|
58
|
+
case margelo::nitro::nitromodal::NamedSheetDetent::SMALL: return JSIConverter<std::string>::toJSI(runtime, "small");
|
|
59
|
+
case margelo::nitro::nitromodal::NamedSheetDetent::MEDIUM: return JSIConverter<std::string>::toJSI(runtime, "medium");
|
|
60
|
+
case margelo::nitro::nitromodal::NamedSheetDetent::LARGE: return JSIConverter<std::string>::toJSI(runtime, "large");
|
|
61
|
+
case margelo::nitro::nitromodal::NamedSheetDetent::FITCONTENT: return JSIConverter<std::string>::toJSI(runtime, "fitContent");
|
|
62
62
|
default: [[unlikely]]
|
|
63
|
-
throw std::invalid_argument("Cannot convert
|
|
63
|
+
throw std::invalid_argument("Cannot convert NamedSheetDetent to JS - invalid value: "
|
|
64
64
|
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -22,7 +22,8 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
22
22
|
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
23
23
|
isOpen(nitro::ReactProp<bool>::fromRawValue("NitroModal", "isOpen", rawProps, sourceProps.isOpen)),
|
|
24
24
|
mode(nitro::ReactProp<ModalMode>::fromRawValue("NitroModal", "mode", rawProps, sourceProps.mode)),
|
|
25
|
-
|
|
25
|
+
isInline(nitro::ReactProp<bool>::fromRawValue("NitroModal", "isInline", rawProps, sourceProps.isInline)),
|
|
26
|
+
detents(nitro::ReactProp<std::vector<std::variant<NamedSheetDetent, double>>>::fromRawValue("NitroModal", "detents", rawProps, sourceProps.detents)),
|
|
26
27
|
initialDetentIndex(nitro::ReactProp<double>::fromRawValue("NitroModal", "initialDetentIndex", rawProps, sourceProps.initialDetentIndex)),
|
|
27
28
|
backdropColor(nitro::ReactProp<double>::fromRawValue("NitroModal", "backdropColor", rawProps, sourceProps.backdropColor)),
|
|
28
29
|
backdropOpacity(nitro::ReactProp<double>::fromRawValue("NitroModal", "backdropOpacity", rawProps, sourceProps.backdropOpacity)),
|
|
@@ -35,18 +36,24 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
35
36
|
contentBackgroundColor(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroModal", "contentBackgroundColor", rawProps, sourceProps.contentBackgroundColor)),
|
|
36
37
|
keyboardBehavior(nitro::ReactProp<KeyboardBehavior>::fromRawValue("NitroModal", "keyboardBehavior", rawProps, sourceProps.keyboardBehavior)),
|
|
37
38
|
popupAnimation(nitro::ReactProp<PopupAnimation>::fromRawValue("NitroModal", "popupAnimation", rawProps, sourceProps.popupAnimation)),
|
|
39
|
+
pullToRefreshEnabled(nitro::ReactProp<bool>::fromRawValue("NitroModal", "pullToRefreshEnabled", rawProps, sourceProps.pullToRefreshEnabled)),
|
|
40
|
+
refreshing(nitro::ReactProp<std::optional<bool>>::fromRawValue("NitroModal", "refreshing", rawProps, sourceProps.refreshing)),
|
|
41
|
+
refreshIndicatorColor(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroModal", "refreshIndicatorColor", rawProps, sourceProps.refreshIndicatorColor)),
|
|
38
42
|
onPresent(nitro::ReactProp<std::optional<std::function<void()>>>::fromRawValue("NitroModal", "onPresent", rawProps, sourceProps.onPresent)),
|
|
39
43
|
onDismiss(nitro::ReactProp<std::optional<std::function<void(DismissReason /* reason */)>>>::fromRawValue("NitroModal", "onDismiss", rawProps, sourceProps.onDismiss)),
|
|
40
44
|
onDetentChange(nitro::ReactProp<std::optional<std::function<void(double /* index */)>>>::fromRawValue("NitroModal", "onDetentChange", rawProps, sourceProps.onDetentChange)),
|
|
41
45
|
onBackdropPress(nitro::ReactProp<std::optional<std::function<void()>>>::fromRawValue("NitroModal", "onBackdropPress", rawProps, sourceProps.onBackdropPress)),
|
|
42
46
|
onBackButtonPress(nitro::ReactProp<std::optional<std::function<void()>>>::fromRawValue("NitroModal", "onBackButtonPress", rawProps, sourceProps.onBackButtonPress)),
|
|
43
47
|
onContentAreaChange(nitro::ReactProp<std::optional<std::function<void(const ModalContentArea& /* area */)>>>::fromRawValue("NitroModal", "onContentAreaChange", rawProps, sourceProps.onContentAreaChange)),
|
|
48
|
+
onPullToRefresh(nitro::ReactProp<std::optional<std::function<void()>>>::fromRawValue("NitroModal", "onPullToRefresh", rawProps, sourceProps.onPullToRefresh)),
|
|
49
|
+
onRestingTopChange(nitro::ReactProp<std::optional<std::function<void(double /* top */)>>>::fromRawValue("NitroModal", "onRestingTopChange", rawProps, sourceProps.onRestingTopChange)),
|
|
44
50
|
hybridRef(nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroModalSpec>& /* ref */)>>>::fromRawValue("NitroModal", "hybridRef", rawProps, sourceProps.hybridRef)) { }
|
|
45
51
|
|
|
46
52
|
bool HybridNitroModalProps::filterObjectKeys(const std::string& propName) {
|
|
47
53
|
switch (hashString(propName)) {
|
|
48
54
|
case hashString("isOpen"): return true;
|
|
49
55
|
case hashString("mode"): return true;
|
|
56
|
+
case hashString("isInline"): return true;
|
|
50
57
|
case hashString("detents"): return true;
|
|
51
58
|
case hashString("initialDetentIndex"): return true;
|
|
52
59
|
case hashString("backdropColor"): return true;
|
|
@@ -60,12 +67,17 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
60
67
|
case hashString("contentBackgroundColor"): return true;
|
|
61
68
|
case hashString("keyboardBehavior"): return true;
|
|
62
69
|
case hashString("popupAnimation"): return true;
|
|
70
|
+
case hashString("pullToRefreshEnabled"): return true;
|
|
71
|
+
case hashString("refreshing"): return true;
|
|
72
|
+
case hashString("refreshIndicatorColor"): return true;
|
|
63
73
|
case hashString("onPresent"): return true;
|
|
64
74
|
case hashString("onDismiss"): return true;
|
|
65
75
|
case hashString("onDetentChange"): return true;
|
|
66
76
|
case hashString("onBackdropPress"): return true;
|
|
67
77
|
case hashString("onBackButtonPress"): return true;
|
|
68
78
|
case hashString("onContentAreaChange"): return true;
|
|
79
|
+
case hashString("onPullToRefresh"): return true;
|
|
80
|
+
case hashString("onRestingTopChange"): return true;
|
|
69
81
|
case hashString("hybridRef"): return true;
|
|
70
82
|
default: return false;
|
|
71
83
|
}
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
#include <string>
|
|
19
19
|
|
|
20
20
|
#include "ModalMode.hpp"
|
|
21
|
-
#include "
|
|
21
|
+
#include "NamedSheetDetent.hpp"
|
|
22
|
+
#include <variant>
|
|
22
23
|
#include <vector>
|
|
23
24
|
#include <optional>
|
|
24
25
|
#include "KeyboardBehavior.hpp"
|
|
@@ -51,7 +52,8 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
51
52
|
public:
|
|
52
53
|
nitro::ReactProp<bool> isOpen;
|
|
53
54
|
nitro::ReactProp<ModalMode> mode;
|
|
54
|
-
nitro::ReactProp<
|
|
55
|
+
nitro::ReactProp<bool> isInline;
|
|
56
|
+
nitro::ReactProp<std::vector<std::variant<NamedSheetDetent, double>>> detents;
|
|
55
57
|
nitro::ReactProp<double> initialDetentIndex;
|
|
56
58
|
nitro::ReactProp<double> backdropColor;
|
|
57
59
|
nitro::ReactProp<double> backdropOpacity;
|
|
@@ -64,18 +66,24 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
64
66
|
nitro::ReactProp<std::optional<double>> contentBackgroundColor;
|
|
65
67
|
nitro::ReactProp<KeyboardBehavior> keyboardBehavior;
|
|
66
68
|
nitro::ReactProp<PopupAnimation> popupAnimation;
|
|
69
|
+
nitro::ReactProp<bool> pullToRefreshEnabled;
|
|
70
|
+
nitro::ReactProp<std::optional<bool>> refreshing;
|
|
71
|
+
nitro::ReactProp<std::optional<double>> refreshIndicatorColor;
|
|
67
72
|
nitro::ReactProp<std::optional<std::function<void()>>> onPresent;
|
|
68
73
|
nitro::ReactProp<std::optional<std::function<void(DismissReason /* reason */)>>> onDismiss;
|
|
69
74
|
nitro::ReactProp<std::optional<std::function<void(double /* index */)>>> onDetentChange;
|
|
70
75
|
nitro::ReactProp<std::optional<std::function<void()>>> onBackdropPress;
|
|
71
76
|
nitro::ReactProp<std::optional<std::function<void()>>> onBackButtonPress;
|
|
72
77
|
nitro::ReactProp<std::optional<std::function<void(const ModalContentArea& /* area */)>>> onContentAreaChange;
|
|
78
|
+
nitro::ReactProp<std::optional<std::function<void()>>> onPullToRefresh;
|
|
79
|
+
nitro::ReactProp<std::optional<std::function<void(double /* top */)>>> onRestingTopChange;
|
|
73
80
|
nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroModalSpec>& /* ref */)>>> hybridRef;
|
|
74
81
|
|
|
75
82
|
[[nodiscard]]
|
|
76
83
|
bool hasSameProps(const HybridNitroModalProps& other) const noexcept {
|
|
77
84
|
return isOpen.hasSameValue(other.isOpen) &&
|
|
78
85
|
mode.hasSameValue(other.mode) &&
|
|
86
|
+
isInline.hasSameValue(other.isInline) &&
|
|
79
87
|
detents.hasSameValue(other.detents) &&
|
|
80
88
|
initialDetentIndex.hasSameValue(other.initialDetentIndex) &&
|
|
81
89
|
backdropColor.hasSameValue(other.backdropColor) &&
|
|
@@ -89,12 +97,17 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
89
97
|
contentBackgroundColor.hasSameValue(other.contentBackgroundColor) &&
|
|
90
98
|
keyboardBehavior.hasSameValue(other.keyboardBehavior) &&
|
|
91
99
|
popupAnimation.hasSameValue(other.popupAnimation) &&
|
|
100
|
+
pullToRefreshEnabled.hasSameValue(other.pullToRefreshEnabled) &&
|
|
101
|
+
refreshing.hasSameValue(other.refreshing) &&
|
|
102
|
+
refreshIndicatorColor.hasSameValue(other.refreshIndicatorColor) &&
|
|
92
103
|
onPresent.hasSameValue(other.onPresent) &&
|
|
93
104
|
onDismiss.hasSameValue(other.onDismiss) &&
|
|
94
105
|
onDetentChange.hasSameValue(other.onDetentChange) &&
|
|
95
106
|
onBackdropPress.hasSameValue(other.onBackdropPress) &&
|
|
96
107
|
onBackButtonPress.hasSameValue(other.onBackButtonPress) &&
|
|
97
108
|
onContentAreaChange.hasSameValue(other.onContentAreaChange) &&
|
|
109
|
+
onPullToRefresh.hasSameValue(other.onPullToRefresh) &&
|
|
110
|
+
onRestingTopChange.hasSameValue(other.onRestingTopChange) &&
|
|
98
111
|
hybridRef.hasSameValue(other.hybridRef);
|
|
99
112
|
}
|
|
100
113
|
|
|
@@ -102,6 +115,7 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
102
115
|
bool hasAnyProvidedProps() const noexcept {
|
|
103
116
|
return isOpen.isProvided() ||
|
|
104
117
|
mode.isProvided() ||
|
|
118
|
+
isInline.isProvided() ||
|
|
105
119
|
detents.isProvided() ||
|
|
106
120
|
initialDetentIndex.isProvided() ||
|
|
107
121
|
backdropColor.isProvided() ||
|
|
@@ -115,12 +129,17 @@ namespace margelo::nitro::nitromodal::views {
|
|
|
115
129
|
contentBackgroundColor.isProvided() ||
|
|
116
130
|
keyboardBehavior.isProvided() ||
|
|
117
131
|
popupAnimation.isProvided() ||
|
|
132
|
+
pullToRefreshEnabled.isProvided() ||
|
|
133
|
+
refreshing.isProvided() ||
|
|
134
|
+
refreshIndicatorColor.isProvided() ||
|
|
118
135
|
onPresent.isProvided() ||
|
|
119
136
|
onDismiss.isProvided() ||
|
|
120
137
|
onDetentChange.isProvided() ||
|
|
121
138
|
onBackdropPress.isProvided() ||
|
|
122
139
|
onBackButtonPress.isProvided() ||
|
|
123
140
|
onContentAreaChange.isProvided() ||
|
|
141
|
+
onPullToRefresh.isProvided() ||
|
|
142
|
+
onRestingTopChange.isProvided() ||
|
|
124
143
|
hybridRef.isProvided();
|
|
125
144
|
}
|
|
126
145
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"validAttributes": {
|
|
7
7
|
"isOpen": true,
|
|
8
8
|
"mode": true,
|
|
9
|
+
"isInline": true,
|
|
9
10
|
"detents": true,
|
|
10
11
|
"initialDetentIndex": true,
|
|
11
12
|
"backdropColor": true,
|
|
@@ -19,12 +20,17 @@
|
|
|
19
20
|
"contentBackgroundColor": true,
|
|
20
21
|
"keyboardBehavior": true,
|
|
21
22
|
"popupAnimation": true,
|
|
23
|
+
"pullToRefreshEnabled": true,
|
|
24
|
+
"refreshing": true,
|
|
25
|
+
"refreshIndicatorColor": true,
|
|
22
26
|
"onPresent": true,
|
|
23
27
|
"onDismiss": true,
|
|
24
28
|
"onDetentChange": true,
|
|
25
29
|
"onBackdropPress": true,
|
|
26
30
|
"onBackButtonPress": true,
|
|
27
31
|
"onContentAreaChange": true,
|
|
32
|
+
"onPullToRefresh": true,
|
|
33
|
+
"onRestingTopChange": true,
|
|
28
34
|
"hybridRef": true
|
|
29
35
|
}
|
|
30
36
|
}
|