@onekeyfe/react-native-segment-slider 3.0.52 → 3.0.54
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 +47 -3
- package/SegmentSlider.podspec +1 -1
- package/android/src/main/java/com/margelo/nitro/segmentslider/HybridSegmentSlider.kt +39 -11
- package/android/src/main/java/com/margelo/nitro/segmentslider/SegmentSliderColorParser.kt +19 -3
- package/ios/HybridSegmentSlider.swift +38 -13
- package/ios/SegmentSliderColorParser.swift +40 -9
- package/lib/module/index.js +7 -4
- package/lib/module/index.js.map +1 -1
- package/lib/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.cpp +9 -15
- package/lib/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.hpp +3 -5
- package/lib/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.cpp +2 -6
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/HybridSegmentSliderSpec.kt +4 -8
- package/lib/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.hpp +11 -0
- package/lib/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Umbrella.hpp +2 -0
- package/lib/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.hpp +10 -11
- package/lib/nitrogen/generated/ios/c++/views/HybridSegmentSliderComponent.mm +4 -9
- package/lib/nitrogen/generated/ios/swift/HybridSegmentSliderSpec.swift +2 -3
- package/lib/nitrogen/generated/ios/swift/HybridSegmentSliderSpec_cxx.swift +14 -14
- package/lib/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.cpp +3 -4
- package/lib/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.hpp +3 -5
- package/lib/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.cpp +7 -19
- package/lib/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.hpp +1 -2
- package/lib/nitrogen/generated/shared/json/SegmentSliderConfig.json +1 -2
- package/lib/typescript/src/SegmentSlider.nitro.d.ts +18 -8
- package/lib/typescript/src/SegmentSlider.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.cpp +9 -15
- package/nitrogen/generated/android/c++/JHybridSegmentSliderSpec.hpp +3 -5
- package/nitrogen/generated/android/c++/views/JHybridSegmentSliderStateUpdater.cpp +2 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/HybridSegmentSliderSpec.kt +4 -8
- package/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Bridge.hpp +11 -0
- package/nitrogen/generated/ios/SegmentSlider-Swift-Cxx-Umbrella.hpp +2 -0
- package/nitrogen/generated/ios/c++/HybridSegmentSliderSpecSwift.hpp +10 -11
- package/nitrogen/generated/ios/c++/views/HybridSegmentSliderComponent.mm +4 -9
- package/nitrogen/generated/ios/swift/HybridSegmentSliderSpec.swift +2 -3
- package/nitrogen/generated/ios/swift/HybridSegmentSliderSpec_cxx.swift +14 -14
- package/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.cpp +3 -4
- package/nitrogen/generated/shared/c++/HybridSegmentSliderSpec.hpp +3 -5
- package/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.cpp +7 -19
- package/nitrogen/generated/shared/c++/views/HybridSegmentSliderComponent.hpp +1 -2
- package/nitrogen/generated/shared/json/SegmentSliderConfig.json +1 -2
- package/package.json +1 -1
- package/src/SegmentSlider.nitro.ts +20 -9
- package/src/index.tsx +16 -6
|
@@ -114,14 +114,14 @@ open class HybridSegmentSliderSpec_cxx {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// Properties
|
|
117
|
-
public final var
|
|
117
|
+
public final var defaultValue: Double {
|
|
118
118
|
@inline(__always)
|
|
119
119
|
get {
|
|
120
|
-
return self.__implementation.
|
|
120
|
+
return self.__implementation.defaultValue
|
|
121
121
|
}
|
|
122
122
|
@inline(__always)
|
|
123
123
|
set {
|
|
124
|
-
self.__implementation.
|
|
124
|
+
self.__implementation.defaultValue = newValue
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -213,17 +213,6 @@ open class HybridSegmentSliderSpec_cxx {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
public final var epoch: Double {
|
|
217
|
-
@inline(__always)
|
|
218
|
-
get {
|
|
219
|
-
return self.__implementation.epoch
|
|
220
|
-
}
|
|
221
|
-
@inline(__always)
|
|
222
|
-
set {
|
|
223
|
-
self.__implementation.epoch = newValue
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
216
|
public final var fillColor: std.string {
|
|
228
217
|
@inline(__always)
|
|
229
218
|
get {
|
|
@@ -420,6 +409,17 @@ open class HybridSegmentSliderSpec_cxx {
|
|
|
420
409
|
}
|
|
421
410
|
|
|
422
411
|
// Methods
|
|
412
|
+
@inline(__always)
|
|
413
|
+
public final func setValue(value: Double) -> bridge.Result_void_ {
|
|
414
|
+
do {
|
|
415
|
+
try self.__implementation.setValue(value: value)
|
|
416
|
+
return bridge.create_Result_void_()
|
|
417
|
+
} catch (let __error) {
|
|
418
|
+
let __exceptionPtr = __error.toCpp()
|
|
419
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
423
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
424
424
|
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
425
425
|
}
|
|
@@ -14,8 +14,8 @@ namespace margelo::nitro::segmentslider {
|
|
|
14
14
|
HybridObject::loadHybridMethods();
|
|
15
15
|
// load custom methods/properties
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridGetter("
|
|
18
|
-
prototype.registerHybridSetter("
|
|
17
|
+
prototype.registerHybridGetter("defaultValue", &HybridSegmentSliderSpec::getDefaultValue);
|
|
18
|
+
prototype.registerHybridSetter("defaultValue", &HybridSegmentSliderSpec::setDefaultValue);
|
|
19
19
|
prototype.registerHybridGetter("min", &HybridSegmentSliderSpec::getMin);
|
|
20
20
|
prototype.registerHybridSetter("min", &HybridSegmentSliderSpec::setMin);
|
|
21
21
|
prototype.registerHybridGetter("max", &HybridSegmentSliderSpec::getMax);
|
|
@@ -32,8 +32,6 @@ namespace margelo::nitro::segmentslider {
|
|
|
32
32
|
prototype.registerHybridSetter("centerOrigin", &HybridSegmentSliderSpec::setCenterOrigin);
|
|
33
33
|
prototype.registerHybridGetter("snapTapToSegment", &HybridSegmentSliderSpec::getSnapTapToSegment);
|
|
34
34
|
prototype.registerHybridSetter("snapTapToSegment", &HybridSegmentSliderSpec::setSnapTapToSegment);
|
|
35
|
-
prototype.registerHybridGetter("epoch", &HybridSegmentSliderSpec::getEpoch);
|
|
36
|
-
prototype.registerHybridSetter("epoch", &HybridSegmentSliderSpec::setEpoch);
|
|
37
35
|
prototype.registerHybridGetter("fillColor", &HybridSegmentSliderSpec::getFillColor);
|
|
38
36
|
prototype.registerHybridSetter("fillColor", &HybridSegmentSliderSpec::setFillColor);
|
|
39
37
|
prototype.registerHybridGetter("trackColor", &HybridSegmentSliderSpec::getTrackColor);
|
|
@@ -58,6 +56,7 @@ namespace margelo::nitro::segmentslider {
|
|
|
58
56
|
prototype.registerHybridSetter("onSlideStart", &HybridSegmentSliderSpec::setOnSlideStart);
|
|
59
57
|
prototype.registerHybridGetter("onSlideComplete", &HybridSegmentSliderSpec::getOnSlideComplete);
|
|
60
58
|
prototype.registerHybridSetter("onSlideComplete", &HybridSegmentSliderSpec::setOnSlideComplete);
|
|
59
|
+
prototype.registerHybridMethod("setValue", &HybridSegmentSliderSpec::setValue);
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
62
|
|
|
@@ -46,8 +46,8 @@ namespace margelo::nitro::segmentslider {
|
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
// Properties
|
|
49
|
-
virtual double
|
|
50
|
-
virtual void
|
|
49
|
+
virtual double getDefaultValue() = 0;
|
|
50
|
+
virtual void setDefaultValue(double defaultValue) = 0;
|
|
51
51
|
virtual double getMin() = 0;
|
|
52
52
|
virtual void setMin(double min) = 0;
|
|
53
53
|
virtual double getMax() = 0;
|
|
@@ -64,8 +64,6 @@ namespace margelo::nitro::segmentslider {
|
|
|
64
64
|
virtual void setCenterOrigin(bool centerOrigin) = 0;
|
|
65
65
|
virtual bool getSnapTapToSegment() = 0;
|
|
66
66
|
virtual void setSnapTapToSegment(bool snapTapToSegment) = 0;
|
|
67
|
-
virtual double getEpoch() = 0;
|
|
68
|
-
virtual void setEpoch(double epoch) = 0;
|
|
69
67
|
virtual std::string getFillColor() = 0;
|
|
70
68
|
virtual void setFillColor(const std::string& fillColor) = 0;
|
|
71
69
|
virtual std::string getTrackColor() = 0;
|
|
@@ -93,7 +91,7 @@ namespace margelo::nitro::segmentslider {
|
|
|
93
91
|
|
|
94
92
|
public:
|
|
95
93
|
// Methods
|
|
96
|
-
|
|
94
|
+
virtual void setValue(double value) = 0;
|
|
97
95
|
|
|
98
96
|
protected:
|
|
99
97
|
// Hybrid Setup
|
|
@@ -25,14 +25,14 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
25
25
|
const HybridSegmentSliderProps& sourceProps,
|
|
26
26
|
const react::RawProps& rawProps):
|
|
27
27
|
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
28
|
-
|
|
28
|
+
defaultValue([&]() -> CachedProp<double> {
|
|
29
29
|
try {
|
|
30
|
-
const react::RawValue* rawValue = rawProps.at("
|
|
31
|
-
if (rawValue == nullptr) return sourceProps.
|
|
30
|
+
const react::RawValue* rawValue = rawProps.at("defaultValue", nullptr, nullptr);
|
|
31
|
+
if (rawValue == nullptr) return sourceProps.defaultValue;
|
|
32
32
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
33
|
-
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.
|
|
33
|
+
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.defaultValue);
|
|
34
34
|
} catch (const std::exception& exc) {
|
|
35
|
-
throw std::runtime_error(std::string("SegmentSlider.
|
|
35
|
+
throw std::runtime_error(std::string("SegmentSlider.defaultValue: ") + exc.what());
|
|
36
36
|
}
|
|
37
37
|
}()),
|
|
38
38
|
min([&]() -> CachedProp<double> {
|
|
@@ -115,16 +115,6 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
115
115
|
throw std::runtime_error(std::string("SegmentSlider.snapTapToSegment: ") + exc.what());
|
|
116
116
|
}
|
|
117
117
|
}()),
|
|
118
|
-
epoch([&]() -> CachedProp<double> {
|
|
119
|
-
try {
|
|
120
|
-
const react::RawValue* rawValue = rawProps.at("epoch", nullptr, nullptr);
|
|
121
|
-
if (rawValue == nullptr) return sourceProps.epoch;
|
|
122
|
-
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
123
|
-
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.epoch);
|
|
124
|
-
} catch (const std::exception& exc) {
|
|
125
|
-
throw std::runtime_error(std::string("SegmentSlider.epoch: ") + exc.what());
|
|
126
|
-
}
|
|
127
|
-
}()),
|
|
128
118
|
fillColor([&]() -> CachedProp<std::string> {
|
|
129
119
|
try {
|
|
130
120
|
const react::RawValue* rawValue = rawProps.at("fillColor", nullptr, nullptr);
|
|
@@ -258,7 +248,7 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
258
248
|
|
|
259
249
|
HybridSegmentSliderProps::HybridSegmentSliderProps(const HybridSegmentSliderProps& other):
|
|
260
250
|
react::ViewProps(),
|
|
261
|
-
|
|
251
|
+
defaultValue(other.defaultValue),
|
|
262
252
|
min(other.min),
|
|
263
253
|
max(other.max),
|
|
264
254
|
segments(other.segments),
|
|
@@ -267,7 +257,6 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
267
257
|
showBubble(other.showBubble),
|
|
268
258
|
centerOrigin(other.centerOrigin),
|
|
269
259
|
snapTapToSegment(other.snapTapToSegment),
|
|
270
|
-
epoch(other.epoch),
|
|
271
260
|
fillColor(other.fillColor),
|
|
272
261
|
trackColor(other.trackColor),
|
|
273
262
|
thumbColor(other.thumbColor),
|
|
@@ -284,7 +273,7 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
284
273
|
|
|
285
274
|
bool HybridSegmentSliderProps::filterObjectKeys(const std::string& propName) {
|
|
286
275
|
switch (hashString(propName)) {
|
|
287
|
-
case hashString("
|
|
276
|
+
case hashString("defaultValue"): return true;
|
|
288
277
|
case hashString("min"): return true;
|
|
289
278
|
case hashString("max"): return true;
|
|
290
279
|
case hashString("segments"): return true;
|
|
@@ -293,7 +282,6 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
293
282
|
case hashString("showBubble"): return true;
|
|
294
283
|
case hashString("centerOrigin"): return true;
|
|
295
284
|
case hashString("snapTapToSegment"): return true;
|
|
296
|
-
case hashString("epoch"): return true;
|
|
297
285
|
case hashString("fillColor"): return true;
|
|
298
286
|
case hashString("trackColor"): return true;
|
|
299
287
|
case hashString("thumbColor"): return true;
|
|
@@ -43,7 +43,7 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
43
43
|
const react::RawProps& rawProps);
|
|
44
44
|
|
|
45
45
|
public:
|
|
46
|
-
CachedProp<double>
|
|
46
|
+
CachedProp<double> defaultValue;
|
|
47
47
|
CachedProp<double> min;
|
|
48
48
|
CachedProp<double> max;
|
|
49
49
|
CachedProp<double> segments;
|
|
@@ -52,7 +52,6 @@ namespace margelo::nitro::segmentslider::views {
|
|
|
52
52
|
CachedProp<bool> showBubble;
|
|
53
53
|
CachedProp<bool> centerOrigin;
|
|
54
54
|
CachedProp<bool> snapTapToSegment;
|
|
55
|
-
CachedProp<double> epoch;
|
|
56
55
|
CachedProp<std::string> fillColor;
|
|
57
56
|
CachedProp<std::string> trackColor;
|
|
58
57
|
CachedProp<std::string> thumbColor;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"bubblingEventTypes": {},
|
|
5
5
|
"directEventTypes": {},
|
|
6
6
|
"validAttributes": {
|
|
7
|
-
"
|
|
7
|
+
"defaultValue": true,
|
|
8
8
|
"min": true,
|
|
9
9
|
"max": true,
|
|
10
10
|
"segments": true,
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"showBubble": true,
|
|
14
14
|
"centerOrigin": true,
|
|
15
15
|
"snapTapToSegment": true,
|
|
16
|
-
"epoch": true,
|
|
17
16
|
"fillColor": true,
|
|
18
17
|
"trackColor": true,
|
|
19
18
|
"thumbColor": true,
|
|
@@ -19,8 +19,16 @@ import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-nativ
|
|
|
19
19
|
* hex / rgba() strings so the native side never depends on the theme system.
|
|
20
20
|
*/
|
|
21
21
|
export interface SegmentSliderProps extends HybridViewProps {
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Initial value, applied ONCE when the view mounts. The slider is
|
|
24
|
+
* UNCONTROLLED: after mount the native view owns the value (driven by the
|
|
25
|
+
* pan gesture and reported via `onChange`). To set the value imperatively
|
|
26
|
+
* from JS — e.g. a leverage / coin reset — call the `setValue` method on the
|
|
27
|
+
* hybrid ref instead of re-rendering with a new prop. This keeps reset (and
|
|
28
|
+
* any high-rate) updates off the Fabric prop-commit path (REACT-NATIVE-1JZ)
|
|
29
|
+
* and removes the controlled-value-vs-drag conflict entirely.
|
|
30
|
+
*/
|
|
31
|
+
defaultValue: number;
|
|
24
32
|
/** Range minimum (default range 0..100). */
|
|
25
33
|
min: number;
|
|
26
34
|
/** Range maximum. */
|
|
@@ -42,12 +50,6 @@ export interface SegmentSliderProps extends HybridViewProps {
|
|
|
42
50
|
* callers keep the free-tap behavior.
|
|
43
51
|
*/
|
|
44
52
|
snapTapToSegment: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Monotonic token. Bump from JS on coin / leverage reset so the native view
|
|
47
|
-
* snaps to the new value WITHOUT animating the thumb scale. Mirrors the
|
|
48
|
-
* `epoch` convention used by react-native-perp-depth-bar.
|
|
49
|
-
*/
|
|
50
|
-
epoch: number;
|
|
51
53
|
/** Active fill bar color (Tamagui `bgPrimary`). */
|
|
52
54
|
fillColor: string;
|
|
53
55
|
/** Inactive track color (Tamagui `neutral5`). */
|
|
@@ -74,6 +76,14 @@ export interface SegmentSliderProps extends HybridViewProps {
|
|
|
74
76
|
onSlideComplete?: () => void;
|
|
75
77
|
}
|
|
76
78
|
export interface SegmentSliderMethods extends HybridViewMethods {
|
|
79
|
+
/**
|
|
80
|
+
* Imperatively set the slider value (clamped to `min..max`). Hard-snaps the
|
|
81
|
+
* thumb to the new value, cancelling any in-flight drag, and does NOT fire
|
|
82
|
+
* `onChange` (the JS caller already knows the value, so re-emitting would
|
|
83
|
+
* loop). This is the supported way to update the value after mount — see
|
|
84
|
+
* `defaultValue`.
|
|
85
|
+
*/
|
|
86
|
+
setValue(value: number): void;
|
|
77
87
|
}
|
|
78
88
|
export type SegmentSlider = HybridView<SegmentSliderProps, SegmentSliderMethods>;
|
|
79
89
|
//# sourceMappingURL=SegmentSlider.nitro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentSlider.nitro.d.ts","sourceRoot":"","sources":["../../../src/SegmentSlider.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD
|
|
1
|
+
{"version":3,"file":"SegmentSlider.nitro.d.ts","sourceRoot":"","sources":["../../../src/SegmentSlider.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD;;;;;;;;OAQG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,QAAQ,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,UAAU,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,YAAY,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAG1B,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,gBAAgB,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IAExB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,uCAAuC;IACvC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAI/B,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC;AAOzD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,GAAG,KAAK,EACT,EAAE,kBAAkB,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAI/B,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC;AAOzD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,GAAG,KAAK,EACT,EAAE,kBAAkB,GAAG,SAAS,2CAsChC"}
|
|
@@ -45,14 +45,14 @@ namespace margelo::nitro::segmentslider {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Properties
|
|
48
|
-
double JHybridSegmentSliderSpec::
|
|
49
|
-
static const auto method = javaClassStatic()->getMethod<double()>("
|
|
48
|
+
double JHybridSegmentSliderSpec::getDefaultValue() {
|
|
49
|
+
static const auto method = javaClassStatic()->getMethod<double()>("getDefaultValue");
|
|
50
50
|
auto __result = method(_javaPart);
|
|
51
51
|
return __result;
|
|
52
52
|
}
|
|
53
|
-
void JHybridSegmentSliderSpec::
|
|
54
|
-
static const auto method = javaClassStatic()->getMethod<void(double /*
|
|
55
|
-
method(_javaPart,
|
|
53
|
+
void JHybridSegmentSliderSpec::setDefaultValue(double defaultValue) {
|
|
54
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* defaultValue */)>("setDefaultValue");
|
|
55
|
+
method(_javaPart, defaultValue);
|
|
56
56
|
}
|
|
57
57
|
double JHybridSegmentSliderSpec::getMin() {
|
|
58
58
|
static const auto method = javaClassStatic()->getMethod<double()>("getMin");
|
|
@@ -126,15 +126,6 @@ namespace margelo::nitro::segmentslider {
|
|
|
126
126
|
static const auto method = javaClassStatic()->getMethod<void(jboolean /* snapTapToSegment */)>("setSnapTapToSegment");
|
|
127
127
|
method(_javaPart, snapTapToSegment);
|
|
128
128
|
}
|
|
129
|
-
double JHybridSegmentSliderSpec::getEpoch() {
|
|
130
|
-
static const auto method = javaClassStatic()->getMethod<double()>("getEpoch");
|
|
131
|
-
auto __result = method(_javaPart);
|
|
132
|
-
return __result;
|
|
133
|
-
}
|
|
134
|
-
void JHybridSegmentSliderSpec::setEpoch(double epoch) {
|
|
135
|
-
static const auto method = javaClassStatic()->getMethod<void(double /* epoch */)>("setEpoch");
|
|
136
|
-
method(_javaPart, epoch);
|
|
137
|
-
}
|
|
138
129
|
std::string JHybridSegmentSliderSpec::getFillColor() {
|
|
139
130
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFillColor");
|
|
140
131
|
auto __result = method(_javaPart);
|
|
@@ -269,6 +260,9 @@ namespace margelo::nitro::segmentslider {
|
|
|
269
260
|
}
|
|
270
261
|
|
|
271
262
|
// Methods
|
|
272
|
-
|
|
263
|
+
void JHybridSegmentSliderSpec::setValue(double value) {
|
|
264
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* value */)>("setValue");
|
|
265
|
+
method(_javaPart, value);
|
|
266
|
+
}
|
|
273
267
|
|
|
274
268
|
} // namespace margelo::nitro::segmentslider
|
|
@@ -50,8 +50,8 @@ namespace margelo::nitro::segmentslider {
|
|
|
50
50
|
|
|
51
51
|
public:
|
|
52
52
|
// Properties
|
|
53
|
-
double
|
|
54
|
-
void
|
|
53
|
+
double getDefaultValue() override;
|
|
54
|
+
void setDefaultValue(double defaultValue) override;
|
|
55
55
|
double getMin() override;
|
|
56
56
|
void setMin(double min) override;
|
|
57
57
|
double getMax() override;
|
|
@@ -68,8 +68,6 @@ namespace margelo::nitro::segmentslider {
|
|
|
68
68
|
void setCenterOrigin(bool centerOrigin) override;
|
|
69
69
|
bool getSnapTapToSegment() override;
|
|
70
70
|
void setSnapTapToSegment(bool snapTapToSegment) override;
|
|
71
|
-
double getEpoch() override;
|
|
72
|
-
void setEpoch(double epoch) override;
|
|
73
71
|
std::string getFillColor() override;
|
|
74
72
|
void setFillColor(const std::string& fillColor) override;
|
|
75
73
|
std::string getTrackColor() override;
|
|
@@ -97,7 +95,7 @@ namespace margelo::nitro::segmentslider {
|
|
|
97
95
|
|
|
98
96
|
public:
|
|
99
97
|
// Methods
|
|
100
|
-
|
|
98
|
+
void setValue(double value) override;
|
|
101
99
|
|
|
102
100
|
private:
|
|
103
101
|
friend HybridBase;
|
|
@@ -36,8 +36,8 @@ void JHybridSegmentSliderStateUpdater::updateViewProps(jni::alias_ref<jni::JClas
|
|
|
36
36
|
throw std::runtime_error("HybridSegmentSliderState's data doesn't contain any props!");
|
|
37
37
|
}
|
|
38
38
|
const HybridSegmentSliderProps& props = maybeProps.value();
|
|
39
|
-
if (props.
|
|
40
|
-
view->
|
|
39
|
+
if (props.defaultValue.isDirty) {
|
|
40
|
+
view->setDefaultValue(props.defaultValue.value);
|
|
41
41
|
// TODO: Set isDirty = false
|
|
42
42
|
}
|
|
43
43
|
if (props.min.isDirty) {
|
|
@@ -72,10 +72,6 @@ void JHybridSegmentSliderStateUpdater::updateViewProps(jni::alias_ref<jni::JClas
|
|
|
72
72
|
view->setSnapTapToSegment(props.snapTapToSegment.value);
|
|
73
73
|
// TODO: Set isDirty = false
|
|
74
74
|
}
|
|
75
|
-
if (props.epoch.isDirty) {
|
|
76
|
-
view->setEpoch(props.epoch.value);
|
|
77
|
-
// TODO: Set isDirty = false
|
|
78
|
-
}
|
|
79
75
|
if (props.fillColor.isDirty) {
|
|
80
76
|
view->setFillColor(props.fillColor.value);
|
|
81
77
|
// TODO: Set isDirty = false
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/segmentslider/HybridSegmentSliderSpec.kt
CHANGED
|
@@ -46,7 +46,7 @@ abstract class HybridSegmentSliderSpec: HybridView() {
|
|
|
46
46
|
@get:Keep
|
|
47
47
|
@set:DoNotStrip
|
|
48
48
|
@set:Keep
|
|
49
|
-
abstract var
|
|
49
|
+
abstract var defaultValue: Double
|
|
50
50
|
|
|
51
51
|
@get:DoNotStrip
|
|
52
52
|
@get:Keep
|
|
@@ -96,12 +96,6 @@ abstract class HybridSegmentSliderSpec: HybridView() {
|
|
|
96
96
|
@set:Keep
|
|
97
97
|
abstract var snapTapToSegment: Boolean
|
|
98
98
|
|
|
99
|
-
@get:DoNotStrip
|
|
100
|
-
@get:Keep
|
|
101
|
-
@set:DoNotStrip
|
|
102
|
-
@set:Keep
|
|
103
|
-
abstract var epoch: Double
|
|
104
|
-
|
|
105
99
|
@get:DoNotStrip
|
|
106
100
|
@get:Keep
|
|
107
101
|
@set:DoNotStrip
|
|
@@ -199,7 +193,9 @@ abstract class HybridSegmentSliderSpec: HybridView() {
|
|
|
199
193
|
}
|
|
200
194
|
|
|
201
195
|
// Methods
|
|
202
|
-
|
|
196
|
+
@DoNotStrip
|
|
197
|
+
@Keep
|
|
198
|
+
abstract fun setValue(value: Double): Unit
|
|
203
199
|
|
|
204
200
|
private external fun initHybrid(): HybridData
|
|
205
201
|
|
|
@@ -17,6 +17,8 @@ namespace SegmentSlider { class HybridSegmentSliderSpec_cxx; }
|
|
|
17
17
|
|
|
18
18
|
// Include C++ defined types
|
|
19
19
|
#include "HybridSegmentSliderSpec.hpp"
|
|
20
|
+
#include <NitroModules/Result.hpp>
|
|
21
|
+
#include <exception>
|
|
20
22
|
#include <functional>
|
|
21
23
|
#include <memory>
|
|
22
24
|
#include <optional>
|
|
@@ -112,5 +114,14 @@ namespace margelo::nitro::segmentslider::bridge::swift {
|
|
|
112
114
|
// pragma MARK: std::weak_ptr<HybridSegmentSliderSpec>
|
|
113
115
|
using std__weak_ptr_HybridSegmentSliderSpec_ = std::weak_ptr<HybridSegmentSliderSpec>;
|
|
114
116
|
inline std__weak_ptr_HybridSegmentSliderSpec_ weakify_std__shared_ptr_HybridSegmentSliderSpec_(const std::shared_ptr<HybridSegmentSliderSpec>& strong) noexcept { return strong; }
|
|
117
|
+
|
|
118
|
+
// pragma MARK: Result<void>
|
|
119
|
+
using Result_void_ = Result<void>;
|
|
120
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
121
|
+
return Result<void>::withValue();
|
|
122
|
+
}
|
|
123
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
124
|
+
return Result<void>::withError(error);
|
|
125
|
+
}
|
|
115
126
|
|
|
116
127
|
} // namespace margelo::nitro::segmentslider::bridge::swift
|
|
@@ -13,6 +13,8 @@ namespace margelo::nitro::segmentslider { class HybridSegmentSliderSpec; }
|
|
|
13
13
|
|
|
14
14
|
// Include C++ defined types
|
|
15
15
|
#include "HybridSegmentSliderSpec.hpp"
|
|
16
|
+
#include <NitroModules/Result.hpp>
|
|
17
|
+
#include <exception>
|
|
16
18
|
#include <functional>
|
|
17
19
|
#include <memory>
|
|
18
20
|
#include <optional>
|
|
@@ -58,11 +58,11 @@ namespace margelo::nitro::segmentslider {
|
|
|
58
58
|
|
|
59
59
|
public:
|
|
60
60
|
// Properties
|
|
61
|
-
inline double
|
|
62
|
-
return _swiftPart.
|
|
61
|
+
inline double getDefaultValue() noexcept override {
|
|
62
|
+
return _swiftPart.getDefaultValue();
|
|
63
63
|
}
|
|
64
|
-
inline void
|
|
65
|
-
_swiftPart.
|
|
64
|
+
inline void setDefaultValue(double defaultValue) noexcept override {
|
|
65
|
+
_swiftPart.setDefaultValue(std::forward<decltype(defaultValue)>(defaultValue));
|
|
66
66
|
}
|
|
67
67
|
inline double getMin() noexcept override {
|
|
68
68
|
return _swiftPart.getMin();
|
|
@@ -112,12 +112,6 @@ namespace margelo::nitro::segmentslider {
|
|
|
112
112
|
inline void setSnapTapToSegment(bool snapTapToSegment) noexcept override {
|
|
113
113
|
_swiftPart.setSnapTapToSegment(std::forward<decltype(snapTapToSegment)>(snapTapToSegment));
|
|
114
114
|
}
|
|
115
|
-
inline double getEpoch() noexcept override {
|
|
116
|
-
return _swiftPart.getEpoch();
|
|
117
|
-
}
|
|
118
|
-
inline void setEpoch(double epoch) noexcept override {
|
|
119
|
-
_swiftPart.setEpoch(std::forward<decltype(epoch)>(epoch));
|
|
120
|
-
}
|
|
121
115
|
inline std::string getFillColor() noexcept override {
|
|
122
116
|
auto __result = _swiftPart.getFillColor();
|
|
123
117
|
return __result;
|
|
@@ -205,7 +199,12 @@ namespace margelo::nitro::segmentslider {
|
|
|
205
199
|
|
|
206
200
|
public:
|
|
207
201
|
// Methods
|
|
208
|
-
|
|
202
|
+
inline void setValue(double value) override {
|
|
203
|
+
auto __result = _swiftPart.setValue(std::forward<decltype(value)>(value));
|
|
204
|
+
if (__result.hasError()) [[unlikely]] {
|
|
205
|
+
std::rethrow_exception(__result.error());
|
|
206
|
+
}
|
|
207
|
+
}
|
|
209
208
|
|
|
210
209
|
private:
|
|
211
210
|
SegmentSlider::HybridSegmentSliderSpec_cxx _swiftPart;
|
|
@@ -71,10 +71,10 @@ using namespace margelo::nitro::segmentslider::views;
|
|
|
71
71
|
// 2. Update each prop individually
|
|
72
72
|
swiftPart.beforeUpdate();
|
|
73
73
|
|
|
74
|
-
//
|
|
75
|
-
if (newViewProps.
|
|
76
|
-
swiftPart.
|
|
77
|
-
newViewProps.
|
|
74
|
+
// defaultValue: number
|
|
75
|
+
if (newViewProps.defaultValue.isDirty) {
|
|
76
|
+
swiftPart.setDefaultValue(newViewProps.defaultValue.value);
|
|
77
|
+
newViewProps.defaultValue.isDirty = false;
|
|
78
78
|
}
|
|
79
79
|
// min: number
|
|
80
80
|
if (newViewProps.min.isDirty) {
|
|
@@ -116,11 +116,6 @@ using namespace margelo::nitro::segmentslider::views;
|
|
|
116
116
|
swiftPart.setSnapTapToSegment(newViewProps.snapTapToSegment.value);
|
|
117
117
|
newViewProps.snapTapToSegment.isDirty = false;
|
|
118
118
|
}
|
|
119
|
-
// epoch: number
|
|
120
|
-
if (newViewProps.epoch.isDirty) {
|
|
121
|
-
swiftPart.setEpoch(newViewProps.epoch.value);
|
|
122
|
-
newViewProps.epoch.isDirty = false;
|
|
123
|
-
}
|
|
124
119
|
// fillColor: string
|
|
125
120
|
if (newViewProps.fillColor.isDirty) {
|
|
126
121
|
swiftPart.setFillColor(newViewProps.fillColor.value);
|
|
@@ -11,7 +11,7 @@ import NitroModules
|
|
|
11
11
|
/// See ``HybridSegmentSliderSpec``
|
|
12
12
|
public protocol HybridSegmentSliderSpec_protocol: HybridObject, HybridView {
|
|
13
13
|
// Properties
|
|
14
|
-
var
|
|
14
|
+
var defaultValue: Double { get set }
|
|
15
15
|
var min: Double { get set }
|
|
16
16
|
var max: Double { get set }
|
|
17
17
|
var segments: Double { get set }
|
|
@@ -20,7 +20,6 @@ public protocol HybridSegmentSliderSpec_protocol: HybridObject, HybridView {
|
|
|
20
20
|
var showBubble: Bool { get set }
|
|
21
21
|
var centerOrigin: Bool { get set }
|
|
22
22
|
var snapTapToSegment: Bool { get set }
|
|
23
|
-
var epoch: Double { get set }
|
|
24
23
|
var fillColor: String { get set }
|
|
25
24
|
var trackColor: String { get set }
|
|
26
25
|
var thumbColor: String { get set }
|
|
@@ -35,7 +34,7 @@ public protocol HybridSegmentSliderSpec_protocol: HybridObject, HybridView {
|
|
|
35
34
|
var onSlideComplete: (() -> Void)? { get set }
|
|
36
35
|
|
|
37
36
|
// Methods
|
|
38
|
-
|
|
37
|
+
func setValue(value: Double) throws -> Void
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
public extension HybridSegmentSliderSpec_protocol {
|
|
@@ -114,14 +114,14 @@ open class HybridSegmentSliderSpec_cxx {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// Properties
|
|
117
|
-
public final var
|
|
117
|
+
public final var defaultValue: Double {
|
|
118
118
|
@inline(__always)
|
|
119
119
|
get {
|
|
120
|
-
return self.__implementation.
|
|
120
|
+
return self.__implementation.defaultValue
|
|
121
121
|
}
|
|
122
122
|
@inline(__always)
|
|
123
123
|
set {
|
|
124
|
-
self.__implementation.
|
|
124
|
+
self.__implementation.defaultValue = newValue
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -213,17 +213,6 @@ open class HybridSegmentSliderSpec_cxx {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
public final var epoch: Double {
|
|
217
|
-
@inline(__always)
|
|
218
|
-
get {
|
|
219
|
-
return self.__implementation.epoch
|
|
220
|
-
}
|
|
221
|
-
@inline(__always)
|
|
222
|
-
set {
|
|
223
|
-
self.__implementation.epoch = newValue
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
216
|
public final var fillColor: std.string {
|
|
228
217
|
@inline(__always)
|
|
229
218
|
get {
|
|
@@ -420,6 +409,17 @@ open class HybridSegmentSliderSpec_cxx {
|
|
|
420
409
|
}
|
|
421
410
|
|
|
422
411
|
// Methods
|
|
412
|
+
@inline(__always)
|
|
413
|
+
public final func setValue(value: Double) -> bridge.Result_void_ {
|
|
414
|
+
do {
|
|
415
|
+
try self.__implementation.setValue(value: value)
|
|
416
|
+
return bridge.create_Result_void_()
|
|
417
|
+
} catch (let __error) {
|
|
418
|
+
let __exceptionPtr = __error.toCpp()
|
|
419
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
423
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
424
424
|
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
425
425
|
}
|
|
@@ -14,8 +14,8 @@ namespace margelo::nitro::segmentslider {
|
|
|
14
14
|
HybridObject::loadHybridMethods();
|
|
15
15
|
// load custom methods/properties
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridGetter("
|
|
18
|
-
prototype.registerHybridSetter("
|
|
17
|
+
prototype.registerHybridGetter("defaultValue", &HybridSegmentSliderSpec::getDefaultValue);
|
|
18
|
+
prototype.registerHybridSetter("defaultValue", &HybridSegmentSliderSpec::setDefaultValue);
|
|
19
19
|
prototype.registerHybridGetter("min", &HybridSegmentSliderSpec::getMin);
|
|
20
20
|
prototype.registerHybridSetter("min", &HybridSegmentSliderSpec::setMin);
|
|
21
21
|
prototype.registerHybridGetter("max", &HybridSegmentSliderSpec::getMax);
|
|
@@ -32,8 +32,6 @@ namespace margelo::nitro::segmentslider {
|
|
|
32
32
|
prototype.registerHybridSetter("centerOrigin", &HybridSegmentSliderSpec::setCenterOrigin);
|
|
33
33
|
prototype.registerHybridGetter("snapTapToSegment", &HybridSegmentSliderSpec::getSnapTapToSegment);
|
|
34
34
|
prototype.registerHybridSetter("snapTapToSegment", &HybridSegmentSliderSpec::setSnapTapToSegment);
|
|
35
|
-
prototype.registerHybridGetter("epoch", &HybridSegmentSliderSpec::getEpoch);
|
|
36
|
-
prototype.registerHybridSetter("epoch", &HybridSegmentSliderSpec::setEpoch);
|
|
37
35
|
prototype.registerHybridGetter("fillColor", &HybridSegmentSliderSpec::getFillColor);
|
|
38
36
|
prototype.registerHybridSetter("fillColor", &HybridSegmentSliderSpec::setFillColor);
|
|
39
37
|
prototype.registerHybridGetter("trackColor", &HybridSegmentSliderSpec::getTrackColor);
|
|
@@ -58,6 +56,7 @@ namespace margelo::nitro::segmentslider {
|
|
|
58
56
|
prototype.registerHybridSetter("onSlideStart", &HybridSegmentSliderSpec::setOnSlideStart);
|
|
59
57
|
prototype.registerHybridGetter("onSlideComplete", &HybridSegmentSliderSpec::getOnSlideComplete);
|
|
60
58
|
prototype.registerHybridSetter("onSlideComplete", &HybridSegmentSliderSpec::setOnSlideComplete);
|
|
59
|
+
prototype.registerHybridMethod("setValue", &HybridSegmentSliderSpec::setValue);
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
62
|
|
|
@@ -46,8 +46,8 @@ namespace margelo::nitro::segmentslider {
|
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
// Properties
|
|
49
|
-
virtual double
|
|
50
|
-
virtual void
|
|
49
|
+
virtual double getDefaultValue() = 0;
|
|
50
|
+
virtual void setDefaultValue(double defaultValue) = 0;
|
|
51
51
|
virtual double getMin() = 0;
|
|
52
52
|
virtual void setMin(double min) = 0;
|
|
53
53
|
virtual double getMax() = 0;
|
|
@@ -64,8 +64,6 @@ namespace margelo::nitro::segmentslider {
|
|
|
64
64
|
virtual void setCenterOrigin(bool centerOrigin) = 0;
|
|
65
65
|
virtual bool getSnapTapToSegment() = 0;
|
|
66
66
|
virtual void setSnapTapToSegment(bool snapTapToSegment) = 0;
|
|
67
|
-
virtual double getEpoch() = 0;
|
|
68
|
-
virtual void setEpoch(double epoch) = 0;
|
|
69
67
|
virtual std::string getFillColor() = 0;
|
|
70
68
|
virtual void setFillColor(const std::string& fillColor) = 0;
|
|
71
69
|
virtual std::string getTrackColor() = 0;
|
|
@@ -93,7 +91,7 @@ namespace margelo::nitro::segmentslider {
|
|
|
93
91
|
|
|
94
92
|
public:
|
|
95
93
|
// Methods
|
|
96
|
-
|
|
94
|
+
virtual void setValue(double value) = 0;
|
|
97
95
|
|
|
98
96
|
protected:
|
|
99
97
|
// Hybrid Setup
|