@onekeyfe/react-native-image 3.0.155 → 3.0.157-alpha.248
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 +3 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImage.kt +356 -22
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImageCache.kt +34 -4
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImageMemoryVariants.kt +119 -0
- package/android/src/main/java/com/margelo/nitro/onekeyimage/OneKeyImageReusableView.kt +2 -0
- package/android/src/test/java/com/margelo/nitro/onekeyimage/OneKeyImageMemoryVariantsTest.kt +149 -0
- package/android/src/test/java/com/margelo/nitro/onekeyimage/OneKeyImageRequestSignatureTest.kt +14 -1
- package/ios/OneKeyImage.swift +273 -43
- package/ios/OneKeyImageCache.swift +40 -3
- package/ios/OneKeyImageMemoryVariants.swift +137 -0
- package/ios/OneKeyImageRequestContext.swift +51 -9
- package/ios/tests/OneKeyImageInfrastructureTests.swift +255 -18
- package/lib/module/index.js +26 -3
- package/lib/nitrogen/generated/android/c++/JHybridOneKeyImageSpec.cpp +18 -0
- package/lib/nitrogen/generated/android/c++/JHybridOneKeyImageSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridOneKeyImageStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyImageSpec.kt +12 -0
- package/lib/nitrogen/generated/ios/c++/HybridOneKeyImageSpecSwift.hpp +14 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridOneKeyImageComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridOneKeyImageSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridOneKeyImageSpec_cxx.swift +48 -0
- package/lib/nitrogen/generated/shared/c++/HybridOneKeyImageSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridOneKeyImageSpec.hpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridOneKeyImageComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridOneKeyImageComponent.hpp +6 -0
- package/lib/nitrogen/generated/shared/json/OneKeyImageConfig.json +2 -0
- package/lib/typescript/src/OneKeyImage.nitro.d.ts +8 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/nitrogen/generated/android/c++/JHybridOneKeyImageSpec.cpp +18 -0
- package/nitrogen/generated/android/c++/JHybridOneKeyImageSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridOneKeyImageStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyImageSpec.kt +12 -0
- package/nitrogen/generated/ios/c++/HybridOneKeyImageSpecSwift.hpp +14 -0
- package/nitrogen/generated/ios/c++/views/HybridOneKeyImageComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridOneKeyImageSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridOneKeyImageSpec_cxx.swift +48 -0
- package/nitrogen/generated/shared/c++/HybridOneKeyImageSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridOneKeyImageSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridOneKeyImageComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridOneKeyImageComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/OneKeyImageConfig.json +2 -0
- package/package.json +2 -2
- package/src/OneKeyImage.nitro.ts +8 -0
- package/src/index.tsx +25 -1
|
@@ -134,6 +134,13 @@ namespace margelo::nitro::onekeyimage {
|
|
|
134
134
|
inline void setOptimizeTos(std::optional<bool> optimizeTos) noexcept override {
|
|
135
135
|
_swiftPart.setOptimizeTos(optimizeTos);
|
|
136
136
|
}
|
|
137
|
+
inline std::optional<bool> getRound() noexcept override {
|
|
138
|
+
auto __result = _swiftPart.getRound();
|
|
139
|
+
return __result;
|
|
140
|
+
}
|
|
141
|
+
inline void setRound(std::optional<bool> round) noexcept override {
|
|
142
|
+
_swiftPart.setRound(round);
|
|
143
|
+
}
|
|
137
144
|
inline std::optional<double> getResizeWidth() noexcept override {
|
|
138
145
|
auto __result = _swiftPart.getResizeWidth();
|
|
139
146
|
return __result;
|
|
@@ -141,6 +148,13 @@ namespace margelo::nitro::onekeyimage {
|
|
|
141
148
|
inline void setResizeWidth(std::optional<double> resizeWidth) noexcept override {
|
|
142
149
|
_swiftPart.setResizeWidth(resizeWidth);
|
|
143
150
|
}
|
|
151
|
+
inline std::optional<double> getResizeHeight() noexcept override {
|
|
152
|
+
auto __result = _swiftPart.getResizeHeight();
|
|
153
|
+
return __result;
|
|
154
|
+
}
|
|
155
|
+
inline void setResizeHeight(std::optional<double> resizeHeight) noexcept override {
|
|
156
|
+
_swiftPart.setResizeHeight(resizeHeight);
|
|
157
|
+
}
|
|
144
158
|
inline std::optional<double> getOverscan() noexcept override {
|
|
145
159
|
auto __result = _swiftPart.getOverscan();
|
|
146
160
|
return __result;
|
|
@@ -146,12 +146,24 @@ using namespace margelo::nitro::onekeyimage::views;
|
|
|
146
146
|
: !newViewProps.optimizeTos.hasSameValue(oldViewProps->optimizeTos)) {
|
|
147
147
|
swiftPart.setOptimizeTos(newViewProps.optimizeTos.get());
|
|
148
148
|
}
|
|
149
|
+
// round: optional
|
|
150
|
+
if (oldViewProps == nullptr
|
|
151
|
+
? newViewProps.round.isProvided()
|
|
152
|
+
: !newViewProps.round.hasSameValue(oldViewProps->round)) {
|
|
153
|
+
swiftPart.setRound(newViewProps.round.get());
|
|
154
|
+
}
|
|
149
155
|
// resizeWidth: optional
|
|
150
156
|
if (oldViewProps == nullptr
|
|
151
157
|
? newViewProps.resizeWidth.isProvided()
|
|
152
158
|
: !newViewProps.resizeWidth.hasSameValue(oldViewProps->resizeWidth)) {
|
|
153
159
|
swiftPart.setResizeWidth(newViewProps.resizeWidth.get());
|
|
154
160
|
}
|
|
161
|
+
// resizeHeight: optional
|
|
162
|
+
if (oldViewProps == nullptr
|
|
163
|
+
? newViewProps.resizeHeight.isProvided()
|
|
164
|
+
: !newViewProps.resizeHeight.hasSameValue(oldViewProps->resizeHeight)) {
|
|
165
|
+
swiftPart.setResizeHeight(newViewProps.resizeHeight.get());
|
|
166
|
+
}
|
|
155
167
|
// overscan: optional
|
|
156
168
|
if (oldViewProps == nullptr
|
|
157
169
|
? newViewProps.overscan.isProvided()
|
|
@@ -18,7 +18,9 @@ public protocol HybridOneKeyImageSpec_protocol: HybridObject, HybridView {
|
|
|
18
18
|
var autoplay: Bool? { get set }
|
|
19
19
|
var recyclingKey: String? { get set }
|
|
20
20
|
var optimizeTos: Bool? { get set }
|
|
21
|
+
var round: Bool? { get set }
|
|
21
22
|
var resizeWidth: Double? { get set }
|
|
23
|
+
var resizeHeight: Double? { get set }
|
|
22
24
|
var overscan: Double? { get set }
|
|
23
25
|
var loadingStrategy: OneKeyImageLoadingStrategy? { get set }
|
|
24
26
|
var placeholderColor: String? { get set }
|
|
@@ -292,6 +292,30 @@ open class HybridOneKeyImageSpec_cxx {
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
public final var round: bridge.std__optional_bool_ {
|
|
296
|
+
@inline(__always)
|
|
297
|
+
get {
|
|
298
|
+
return { () -> bridge.std__optional_bool_ in
|
|
299
|
+
if let __unwrappedValue = self.__implementation.round {
|
|
300
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
301
|
+
} else {
|
|
302
|
+
return .init()
|
|
303
|
+
}
|
|
304
|
+
}()
|
|
305
|
+
}
|
|
306
|
+
@inline(__always)
|
|
307
|
+
set {
|
|
308
|
+
self.__implementation.round = { () -> Bool? in
|
|
309
|
+
if bridge.has_value_std__optional_bool_(newValue) {
|
|
310
|
+
let __unwrapped = bridge.get_std__optional_bool_(newValue)
|
|
311
|
+
return __unwrapped
|
|
312
|
+
} else {
|
|
313
|
+
return nil
|
|
314
|
+
}
|
|
315
|
+
}()
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
295
319
|
public final var resizeWidth: bridge.std__optional_double_ {
|
|
296
320
|
@inline(__always)
|
|
297
321
|
get {
|
|
@@ -316,6 +340,30 @@ open class HybridOneKeyImageSpec_cxx {
|
|
|
316
340
|
}
|
|
317
341
|
}
|
|
318
342
|
|
|
343
|
+
public final var resizeHeight: bridge.std__optional_double_ {
|
|
344
|
+
@inline(__always)
|
|
345
|
+
get {
|
|
346
|
+
return { () -> bridge.std__optional_double_ in
|
|
347
|
+
if let __unwrappedValue = self.__implementation.resizeHeight {
|
|
348
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
349
|
+
} else {
|
|
350
|
+
return .init()
|
|
351
|
+
}
|
|
352
|
+
}()
|
|
353
|
+
}
|
|
354
|
+
@inline(__always)
|
|
355
|
+
set {
|
|
356
|
+
self.__implementation.resizeHeight = { () -> Double? in
|
|
357
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
358
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
359
|
+
return __unwrapped
|
|
360
|
+
} else {
|
|
361
|
+
return nil
|
|
362
|
+
}
|
|
363
|
+
}()
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
319
367
|
public final var overscan: bridge.std__optional_double_ {
|
|
320
368
|
@inline(__always)
|
|
321
369
|
get {
|
|
@@ -30,8 +30,12 @@ namespace margelo::nitro::onekeyimage {
|
|
|
30
30
|
prototype.registerHybridSetter("recyclingKey", &HybridOneKeyImageSpec::setRecyclingKey);
|
|
31
31
|
prototype.registerHybridGetter("optimizeTos", &HybridOneKeyImageSpec::getOptimizeTos);
|
|
32
32
|
prototype.registerHybridSetter("optimizeTos", &HybridOneKeyImageSpec::setOptimizeTos);
|
|
33
|
+
prototype.registerHybridGetter("round", &HybridOneKeyImageSpec::getRound);
|
|
34
|
+
prototype.registerHybridSetter("round", &HybridOneKeyImageSpec::setRound);
|
|
33
35
|
prototype.registerHybridGetter("resizeWidth", &HybridOneKeyImageSpec::getResizeWidth);
|
|
34
36
|
prototype.registerHybridSetter("resizeWidth", &HybridOneKeyImageSpec::setResizeWidth);
|
|
37
|
+
prototype.registerHybridGetter("resizeHeight", &HybridOneKeyImageSpec::getResizeHeight);
|
|
38
|
+
prototype.registerHybridSetter("resizeHeight", &HybridOneKeyImageSpec::setResizeHeight);
|
|
35
39
|
prototype.registerHybridGetter("overscan", &HybridOneKeyImageSpec::getOverscan);
|
|
36
40
|
prototype.registerHybridSetter("overscan", &HybridOneKeyImageSpec::setOverscan);
|
|
37
41
|
prototype.registerHybridGetter("loadingStrategy", &HybridOneKeyImageSpec::getLoadingStrategy);
|
|
@@ -76,8 +76,12 @@ namespace margelo::nitro::onekeyimage {
|
|
|
76
76
|
virtual void setRecyclingKey(const std::optional<std::string>& recyclingKey) = 0;
|
|
77
77
|
virtual std::optional<bool> getOptimizeTos() = 0;
|
|
78
78
|
virtual void setOptimizeTos(std::optional<bool> optimizeTos) = 0;
|
|
79
|
+
virtual std::optional<bool> getRound() = 0;
|
|
80
|
+
virtual void setRound(std::optional<bool> round) = 0;
|
|
79
81
|
virtual std::optional<double> getResizeWidth() = 0;
|
|
80
82
|
virtual void setResizeWidth(std::optional<double> resizeWidth) = 0;
|
|
83
|
+
virtual std::optional<double> getResizeHeight() = 0;
|
|
84
|
+
virtual void setResizeHeight(std::optional<double> resizeHeight) = 0;
|
|
81
85
|
virtual std::optional<double> getOverscan() = 0;
|
|
82
86
|
virtual void setOverscan(std::optional<double> overscan) = 0;
|
|
83
87
|
virtual std::optional<OneKeyImageLoadingStrategy> getLoadingStrategy() = 0;
|
|
@@ -28,7 +28,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
28
28
|
autoplay(nitro::ReactProp<std::optional<bool>>::fromRawValue("OneKeyImage", "autoplay", rawProps, sourceProps.autoplay)),
|
|
29
29
|
recyclingKey(nitro::ReactProp<std::optional<std::string>>::fromRawValue("OneKeyImage", "recyclingKey", rawProps, sourceProps.recyclingKey)),
|
|
30
30
|
optimizeTos(nitro::ReactProp<std::optional<bool>>::fromRawValue("OneKeyImage", "optimizeTos", rawProps, sourceProps.optimizeTos)),
|
|
31
|
+
round(nitro::ReactProp<std::optional<bool>>::fromRawValue("OneKeyImage", "round", rawProps, sourceProps.round)),
|
|
31
32
|
resizeWidth(nitro::ReactProp<std::optional<double>>::fromRawValue("OneKeyImage", "resizeWidth", rawProps, sourceProps.resizeWidth)),
|
|
33
|
+
resizeHeight(nitro::ReactProp<std::optional<double>>::fromRawValue("OneKeyImage", "resizeHeight", rawProps, sourceProps.resizeHeight)),
|
|
32
34
|
overscan(nitro::ReactProp<std::optional<double>>::fromRawValue("OneKeyImage", "overscan", rawProps, sourceProps.overscan)),
|
|
33
35
|
loadingStrategy(nitro::ReactProp<std::optional<OneKeyImageLoadingStrategy>>::fromRawValue("OneKeyImage", "loadingStrategy", rawProps, sourceProps.loadingStrategy)),
|
|
34
36
|
placeholderColor(nitro::ReactProp<std::optional<std::string>>::fromRawValue("OneKeyImage", "placeholderColor", rawProps, sourceProps.placeholderColor)),
|
|
@@ -49,7 +51,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
49
51
|
case hashString("autoplay"): return true;
|
|
50
52
|
case hashString("recyclingKey"): return true;
|
|
51
53
|
case hashString("optimizeTos"): return true;
|
|
54
|
+
case hashString("round"): return true;
|
|
52
55
|
case hashString("resizeWidth"): return true;
|
|
56
|
+
case hashString("resizeHeight"): return true;
|
|
53
57
|
case hashString("overscan"): return true;
|
|
54
58
|
case hashString("loadingStrategy"): return true;
|
|
55
59
|
case hashString("placeholderColor"): return true;
|
|
@@ -56,7 +56,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
56
56
|
nitro::ReactProp<std::optional<bool>> autoplay;
|
|
57
57
|
nitro::ReactProp<std::optional<std::string>> recyclingKey;
|
|
58
58
|
nitro::ReactProp<std::optional<bool>> optimizeTos;
|
|
59
|
+
nitro::ReactProp<std::optional<bool>> round;
|
|
59
60
|
nitro::ReactProp<std::optional<double>> resizeWidth;
|
|
61
|
+
nitro::ReactProp<std::optional<double>> resizeHeight;
|
|
60
62
|
nitro::ReactProp<std::optional<double>> overscan;
|
|
61
63
|
nitro::ReactProp<std::optional<OneKeyImageLoadingStrategy>> loadingStrategy;
|
|
62
64
|
nitro::ReactProp<std::optional<std::string>> placeholderColor;
|
|
@@ -77,7 +79,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
77
79
|
autoplay.hasSameValue(other.autoplay) &&
|
|
78
80
|
recyclingKey.hasSameValue(other.recyclingKey) &&
|
|
79
81
|
optimizeTos.hasSameValue(other.optimizeTos) &&
|
|
82
|
+
round.hasSameValue(other.round) &&
|
|
80
83
|
resizeWidth.hasSameValue(other.resizeWidth) &&
|
|
84
|
+
resizeHeight.hasSameValue(other.resizeHeight) &&
|
|
81
85
|
overscan.hasSameValue(other.overscan) &&
|
|
82
86
|
loadingStrategy.hasSameValue(other.loadingStrategy) &&
|
|
83
87
|
placeholderColor.hasSameValue(other.placeholderColor) &&
|
|
@@ -99,7 +103,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
99
103
|
autoplay.isProvided() ||
|
|
100
104
|
recyclingKey.isProvided() ||
|
|
101
105
|
optimizeTos.isProvided() ||
|
|
106
|
+
round.isProvided() ||
|
|
102
107
|
resizeWidth.isProvided() ||
|
|
108
|
+
resizeHeight.isProvided() ||
|
|
103
109
|
overscan.isProvided() ||
|
|
104
110
|
loadingStrategy.isProvided() ||
|
|
105
111
|
placeholderColor.isProvided() ||
|
|
@@ -32,8 +32,16 @@ export interface OneKeyImageNativeProps extends HybridViewProps {
|
|
|
32
32
|
autoplay?: boolean;
|
|
33
33
|
recyclingKey?: string;
|
|
34
34
|
optimizeTos?: boolean;
|
|
35
|
+
/** Clips the native image to an oval using its current bounds. */
|
|
36
|
+
round?: boolean;
|
|
35
37
|
/** Display width hint in layout units. Native applies the screen density. */
|
|
36
38
|
resizeWidth?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Display height hint in layout units. With `resizeWidth` it lets the
|
|
41
|
+
* pre-layout memory-cache probe derive the same decode thumbnail a preload
|
|
42
|
+
* with the same hints stored; omitted, the hint is a square of `resizeWidth`.
|
|
43
|
+
*/
|
|
44
|
+
resizeHeight?: number;
|
|
37
45
|
overscan?: number;
|
|
38
46
|
loadingStrategy?: OneKeyImageLoadingStrategy;
|
|
39
47
|
/** Theme-aware color used by static loading, error, and fallback states. */
|
|
@@ -45,7 +45,7 @@ export interface OneKeyImageProps extends Omit<OneKeyImageNativeProps, 'sourceUr
|
|
|
45
45
|
onError?: MaybeWrappedCallback<(event: OneKeyImageErrorEvent) => void>;
|
|
46
46
|
onLoadEnd?: MaybeWrappedCallback<() => void>;
|
|
47
47
|
}
|
|
48
|
-
export declare function OneKeyImage({ source, placeholder, fallback, variant, contentFit, cachePolicy, autoplay, recyclingKey, optimizeTos, resizeWidth, overscan, loadingStrategy, placeholderColor, hybridRef, onLoadStart, onLoad, onDisplay, onError, onLoadEnd, style, ...viewProps }: OneKeyImageProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function OneKeyImage({ source, placeholder, fallback, variant, contentFit, cachePolicy, autoplay, recyclingKey, optimizeTos, round, resizeWidth, resizeHeight, overscan, loadingStrategy, placeholderColor, hybridRef, onLoadStart, onLoad, onDisplay, onError, onLoadEnd, style, ...viewProps }: OneKeyImageProps): import("react/jsx-runtime").JSX.Element;
|
|
49
49
|
export declare const OneKeyImageCache: {
|
|
50
50
|
preload(sources: OneKeyImagePreloadInput[]): Promise<boolean>;
|
|
51
51
|
clearMemory: () => Promise<void>;
|
|
@@ -138,6 +138,15 @@ namespace margelo::nitro::onekeyimage {
|
|
|
138
138
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* optimizeTos */)>("setOptimizeTos");
|
|
139
139
|
method(_javaPart, optimizeTos.has_value() ? jni::JBoolean::valueOf(optimizeTos.value()) : nullptr);
|
|
140
140
|
}
|
|
141
|
+
std::optional<bool> JHybridOneKeyImageSpec::getRound() {
|
|
142
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getRound");
|
|
143
|
+
auto __result = method(_javaPart);
|
|
144
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
145
|
+
}
|
|
146
|
+
void JHybridOneKeyImageSpec::setRound(std::optional<bool> round) {
|
|
147
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* round */)>("setRound");
|
|
148
|
+
method(_javaPart, round.has_value() ? jni::JBoolean::valueOf(round.value()) : nullptr);
|
|
149
|
+
}
|
|
141
150
|
std::optional<double> JHybridOneKeyImageSpec::getResizeWidth() {
|
|
142
151
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getResizeWidth");
|
|
143
152
|
auto __result = method(_javaPart);
|
|
@@ -147,6 +156,15 @@ namespace margelo::nitro::onekeyimage {
|
|
|
147
156
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* resizeWidth */)>("setResizeWidth");
|
|
148
157
|
method(_javaPart, resizeWidth.has_value() ? jni::JDouble::valueOf(resizeWidth.value()) : nullptr);
|
|
149
158
|
}
|
|
159
|
+
std::optional<double> JHybridOneKeyImageSpec::getResizeHeight() {
|
|
160
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getResizeHeight");
|
|
161
|
+
auto __result = method(_javaPart);
|
|
162
|
+
return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
|
|
163
|
+
}
|
|
164
|
+
void JHybridOneKeyImageSpec::setResizeHeight(std::optional<double> resizeHeight) {
|
|
165
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* resizeHeight */)>("setResizeHeight");
|
|
166
|
+
method(_javaPart, resizeHeight.has_value() ? jni::JDouble::valueOf(resizeHeight.value()) : nullptr);
|
|
167
|
+
}
|
|
150
168
|
std::optional<double> JHybridOneKeyImageSpec::getOverscan() {
|
|
151
169
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getOverscan");
|
|
152
170
|
auto __result = method(_javaPart);
|
|
@@ -66,8 +66,12 @@ namespace margelo::nitro::onekeyimage {
|
|
|
66
66
|
void setRecyclingKey(const std::optional<std::string>& recyclingKey) override;
|
|
67
67
|
std::optional<bool> getOptimizeTos() override;
|
|
68
68
|
void setOptimizeTos(std::optional<bool> optimizeTos) override;
|
|
69
|
+
std::optional<bool> getRound() override;
|
|
70
|
+
void setRound(std::optional<bool> round) override;
|
|
69
71
|
std::optional<double> getResizeWidth() override;
|
|
70
72
|
void setResizeWidth(std::optional<double> resizeWidth) override;
|
|
73
|
+
std::optional<double> getResizeHeight() override;
|
|
74
|
+
void setResizeHeight(std::optional<double> resizeHeight) override;
|
|
71
75
|
std::optional<double> getOverscan() override;
|
|
72
76
|
void setOverscan(std::optional<double> overscan) override;
|
|
73
77
|
std::optional<OneKeyImageLoadingStrategy> getLoadingStrategy() override;
|
|
@@ -93,11 +93,21 @@ void JHybridOneKeyImageStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
93
93
|
: !newProps->optimizeTos.hasSameValue(oldProps->optimizeTos)) {
|
|
94
94
|
hybridView->setOptimizeTos(newProps->optimizeTos.get());
|
|
95
95
|
}
|
|
96
|
+
if (oldProps == nullptr
|
|
97
|
+
? newProps->round.isProvided()
|
|
98
|
+
: !newProps->round.hasSameValue(oldProps->round)) {
|
|
99
|
+
hybridView->setRound(newProps->round.get());
|
|
100
|
+
}
|
|
96
101
|
if (oldProps == nullptr
|
|
97
102
|
? newProps->resizeWidth.isProvided()
|
|
98
103
|
: !newProps->resizeWidth.hasSameValue(oldProps->resizeWidth)) {
|
|
99
104
|
hybridView->setResizeWidth(newProps->resizeWidth.get());
|
|
100
105
|
}
|
|
106
|
+
if (oldProps == nullptr
|
|
107
|
+
? newProps->resizeHeight.isProvided()
|
|
108
|
+
: !newProps->resizeHeight.hasSameValue(oldProps->resizeHeight)) {
|
|
109
|
+
hybridView->setResizeHeight(newProps->resizeHeight.get());
|
|
110
|
+
}
|
|
101
111
|
if (oldProps == nullptr
|
|
102
112
|
? newProps->overscan.isProvided()
|
|
103
113
|
: !newProps->overscan.hasSameValue(oldProps->overscan)) {
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/onekeyimage/HybridOneKeyImageSpec.kt
CHANGED
|
@@ -75,12 +75,24 @@ abstract class HybridOneKeyImageSpec: HybridView() {
|
|
|
75
75
|
@set:Keep
|
|
76
76
|
abstract var optimizeTos: Boolean?
|
|
77
77
|
|
|
78
|
+
@get:DoNotStrip
|
|
79
|
+
@get:Keep
|
|
80
|
+
@set:DoNotStrip
|
|
81
|
+
@set:Keep
|
|
82
|
+
abstract var round: Boolean?
|
|
83
|
+
|
|
78
84
|
@get:DoNotStrip
|
|
79
85
|
@get:Keep
|
|
80
86
|
@set:DoNotStrip
|
|
81
87
|
@set:Keep
|
|
82
88
|
abstract var resizeWidth: Double?
|
|
83
89
|
|
|
90
|
+
@get:DoNotStrip
|
|
91
|
+
@get:Keep
|
|
92
|
+
@set:DoNotStrip
|
|
93
|
+
@set:Keep
|
|
94
|
+
abstract var resizeHeight: Double?
|
|
95
|
+
|
|
84
96
|
@get:DoNotStrip
|
|
85
97
|
@get:Keep
|
|
86
98
|
@set:DoNotStrip
|
|
@@ -134,6 +134,13 @@ namespace margelo::nitro::onekeyimage {
|
|
|
134
134
|
inline void setOptimizeTos(std::optional<bool> optimizeTos) noexcept override {
|
|
135
135
|
_swiftPart.setOptimizeTos(optimizeTos);
|
|
136
136
|
}
|
|
137
|
+
inline std::optional<bool> getRound() noexcept override {
|
|
138
|
+
auto __result = _swiftPart.getRound();
|
|
139
|
+
return __result;
|
|
140
|
+
}
|
|
141
|
+
inline void setRound(std::optional<bool> round) noexcept override {
|
|
142
|
+
_swiftPart.setRound(round);
|
|
143
|
+
}
|
|
137
144
|
inline std::optional<double> getResizeWidth() noexcept override {
|
|
138
145
|
auto __result = _swiftPart.getResizeWidth();
|
|
139
146
|
return __result;
|
|
@@ -141,6 +148,13 @@ namespace margelo::nitro::onekeyimage {
|
|
|
141
148
|
inline void setResizeWidth(std::optional<double> resizeWidth) noexcept override {
|
|
142
149
|
_swiftPart.setResizeWidth(resizeWidth);
|
|
143
150
|
}
|
|
151
|
+
inline std::optional<double> getResizeHeight() noexcept override {
|
|
152
|
+
auto __result = _swiftPart.getResizeHeight();
|
|
153
|
+
return __result;
|
|
154
|
+
}
|
|
155
|
+
inline void setResizeHeight(std::optional<double> resizeHeight) noexcept override {
|
|
156
|
+
_swiftPart.setResizeHeight(resizeHeight);
|
|
157
|
+
}
|
|
144
158
|
inline std::optional<double> getOverscan() noexcept override {
|
|
145
159
|
auto __result = _swiftPart.getOverscan();
|
|
146
160
|
return __result;
|
|
@@ -146,12 +146,24 @@ using namespace margelo::nitro::onekeyimage::views;
|
|
|
146
146
|
: !newViewProps.optimizeTos.hasSameValue(oldViewProps->optimizeTos)) {
|
|
147
147
|
swiftPart.setOptimizeTos(newViewProps.optimizeTos.get());
|
|
148
148
|
}
|
|
149
|
+
// round: optional
|
|
150
|
+
if (oldViewProps == nullptr
|
|
151
|
+
? newViewProps.round.isProvided()
|
|
152
|
+
: !newViewProps.round.hasSameValue(oldViewProps->round)) {
|
|
153
|
+
swiftPart.setRound(newViewProps.round.get());
|
|
154
|
+
}
|
|
149
155
|
// resizeWidth: optional
|
|
150
156
|
if (oldViewProps == nullptr
|
|
151
157
|
? newViewProps.resizeWidth.isProvided()
|
|
152
158
|
: !newViewProps.resizeWidth.hasSameValue(oldViewProps->resizeWidth)) {
|
|
153
159
|
swiftPart.setResizeWidth(newViewProps.resizeWidth.get());
|
|
154
160
|
}
|
|
161
|
+
// resizeHeight: optional
|
|
162
|
+
if (oldViewProps == nullptr
|
|
163
|
+
? newViewProps.resizeHeight.isProvided()
|
|
164
|
+
: !newViewProps.resizeHeight.hasSameValue(oldViewProps->resizeHeight)) {
|
|
165
|
+
swiftPart.setResizeHeight(newViewProps.resizeHeight.get());
|
|
166
|
+
}
|
|
155
167
|
// overscan: optional
|
|
156
168
|
if (oldViewProps == nullptr
|
|
157
169
|
? newViewProps.overscan.isProvided()
|
|
@@ -18,7 +18,9 @@ public protocol HybridOneKeyImageSpec_protocol: HybridObject, HybridView {
|
|
|
18
18
|
var autoplay: Bool? { get set }
|
|
19
19
|
var recyclingKey: String? { get set }
|
|
20
20
|
var optimizeTos: Bool? { get set }
|
|
21
|
+
var round: Bool? { get set }
|
|
21
22
|
var resizeWidth: Double? { get set }
|
|
23
|
+
var resizeHeight: Double? { get set }
|
|
22
24
|
var overscan: Double? { get set }
|
|
23
25
|
var loadingStrategy: OneKeyImageLoadingStrategy? { get set }
|
|
24
26
|
var placeholderColor: String? { get set }
|
|
@@ -292,6 +292,30 @@ open class HybridOneKeyImageSpec_cxx {
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
public final var round: bridge.std__optional_bool_ {
|
|
296
|
+
@inline(__always)
|
|
297
|
+
get {
|
|
298
|
+
return { () -> bridge.std__optional_bool_ in
|
|
299
|
+
if let __unwrappedValue = self.__implementation.round {
|
|
300
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
301
|
+
} else {
|
|
302
|
+
return .init()
|
|
303
|
+
}
|
|
304
|
+
}()
|
|
305
|
+
}
|
|
306
|
+
@inline(__always)
|
|
307
|
+
set {
|
|
308
|
+
self.__implementation.round = { () -> Bool? in
|
|
309
|
+
if bridge.has_value_std__optional_bool_(newValue) {
|
|
310
|
+
let __unwrapped = bridge.get_std__optional_bool_(newValue)
|
|
311
|
+
return __unwrapped
|
|
312
|
+
} else {
|
|
313
|
+
return nil
|
|
314
|
+
}
|
|
315
|
+
}()
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
295
319
|
public final var resizeWidth: bridge.std__optional_double_ {
|
|
296
320
|
@inline(__always)
|
|
297
321
|
get {
|
|
@@ -316,6 +340,30 @@ open class HybridOneKeyImageSpec_cxx {
|
|
|
316
340
|
}
|
|
317
341
|
}
|
|
318
342
|
|
|
343
|
+
public final var resizeHeight: bridge.std__optional_double_ {
|
|
344
|
+
@inline(__always)
|
|
345
|
+
get {
|
|
346
|
+
return { () -> bridge.std__optional_double_ in
|
|
347
|
+
if let __unwrappedValue = self.__implementation.resizeHeight {
|
|
348
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
349
|
+
} else {
|
|
350
|
+
return .init()
|
|
351
|
+
}
|
|
352
|
+
}()
|
|
353
|
+
}
|
|
354
|
+
@inline(__always)
|
|
355
|
+
set {
|
|
356
|
+
self.__implementation.resizeHeight = { () -> Double? in
|
|
357
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
358
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
359
|
+
return __unwrapped
|
|
360
|
+
} else {
|
|
361
|
+
return nil
|
|
362
|
+
}
|
|
363
|
+
}()
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
319
367
|
public final var overscan: bridge.std__optional_double_ {
|
|
320
368
|
@inline(__always)
|
|
321
369
|
get {
|
|
@@ -30,8 +30,12 @@ namespace margelo::nitro::onekeyimage {
|
|
|
30
30
|
prototype.registerHybridSetter("recyclingKey", &HybridOneKeyImageSpec::setRecyclingKey);
|
|
31
31
|
prototype.registerHybridGetter("optimizeTos", &HybridOneKeyImageSpec::getOptimizeTos);
|
|
32
32
|
prototype.registerHybridSetter("optimizeTos", &HybridOneKeyImageSpec::setOptimizeTos);
|
|
33
|
+
prototype.registerHybridGetter("round", &HybridOneKeyImageSpec::getRound);
|
|
34
|
+
prototype.registerHybridSetter("round", &HybridOneKeyImageSpec::setRound);
|
|
33
35
|
prototype.registerHybridGetter("resizeWidth", &HybridOneKeyImageSpec::getResizeWidth);
|
|
34
36
|
prototype.registerHybridSetter("resizeWidth", &HybridOneKeyImageSpec::setResizeWidth);
|
|
37
|
+
prototype.registerHybridGetter("resizeHeight", &HybridOneKeyImageSpec::getResizeHeight);
|
|
38
|
+
prototype.registerHybridSetter("resizeHeight", &HybridOneKeyImageSpec::setResizeHeight);
|
|
35
39
|
prototype.registerHybridGetter("overscan", &HybridOneKeyImageSpec::getOverscan);
|
|
36
40
|
prototype.registerHybridSetter("overscan", &HybridOneKeyImageSpec::setOverscan);
|
|
37
41
|
prototype.registerHybridGetter("loadingStrategy", &HybridOneKeyImageSpec::getLoadingStrategy);
|
|
@@ -76,8 +76,12 @@ namespace margelo::nitro::onekeyimage {
|
|
|
76
76
|
virtual void setRecyclingKey(const std::optional<std::string>& recyclingKey) = 0;
|
|
77
77
|
virtual std::optional<bool> getOptimizeTos() = 0;
|
|
78
78
|
virtual void setOptimizeTos(std::optional<bool> optimizeTos) = 0;
|
|
79
|
+
virtual std::optional<bool> getRound() = 0;
|
|
80
|
+
virtual void setRound(std::optional<bool> round) = 0;
|
|
79
81
|
virtual std::optional<double> getResizeWidth() = 0;
|
|
80
82
|
virtual void setResizeWidth(std::optional<double> resizeWidth) = 0;
|
|
83
|
+
virtual std::optional<double> getResizeHeight() = 0;
|
|
84
|
+
virtual void setResizeHeight(std::optional<double> resizeHeight) = 0;
|
|
81
85
|
virtual std::optional<double> getOverscan() = 0;
|
|
82
86
|
virtual void setOverscan(std::optional<double> overscan) = 0;
|
|
83
87
|
virtual std::optional<OneKeyImageLoadingStrategy> getLoadingStrategy() = 0;
|
|
@@ -28,7 +28,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
28
28
|
autoplay(nitro::ReactProp<std::optional<bool>>::fromRawValue("OneKeyImage", "autoplay", rawProps, sourceProps.autoplay)),
|
|
29
29
|
recyclingKey(nitro::ReactProp<std::optional<std::string>>::fromRawValue("OneKeyImage", "recyclingKey", rawProps, sourceProps.recyclingKey)),
|
|
30
30
|
optimizeTos(nitro::ReactProp<std::optional<bool>>::fromRawValue("OneKeyImage", "optimizeTos", rawProps, sourceProps.optimizeTos)),
|
|
31
|
+
round(nitro::ReactProp<std::optional<bool>>::fromRawValue("OneKeyImage", "round", rawProps, sourceProps.round)),
|
|
31
32
|
resizeWidth(nitro::ReactProp<std::optional<double>>::fromRawValue("OneKeyImage", "resizeWidth", rawProps, sourceProps.resizeWidth)),
|
|
33
|
+
resizeHeight(nitro::ReactProp<std::optional<double>>::fromRawValue("OneKeyImage", "resizeHeight", rawProps, sourceProps.resizeHeight)),
|
|
32
34
|
overscan(nitro::ReactProp<std::optional<double>>::fromRawValue("OneKeyImage", "overscan", rawProps, sourceProps.overscan)),
|
|
33
35
|
loadingStrategy(nitro::ReactProp<std::optional<OneKeyImageLoadingStrategy>>::fromRawValue("OneKeyImage", "loadingStrategy", rawProps, sourceProps.loadingStrategy)),
|
|
34
36
|
placeholderColor(nitro::ReactProp<std::optional<std::string>>::fromRawValue("OneKeyImage", "placeholderColor", rawProps, sourceProps.placeholderColor)),
|
|
@@ -49,7 +51,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
49
51
|
case hashString("autoplay"): return true;
|
|
50
52
|
case hashString("recyclingKey"): return true;
|
|
51
53
|
case hashString("optimizeTos"): return true;
|
|
54
|
+
case hashString("round"): return true;
|
|
52
55
|
case hashString("resizeWidth"): return true;
|
|
56
|
+
case hashString("resizeHeight"): return true;
|
|
53
57
|
case hashString("overscan"): return true;
|
|
54
58
|
case hashString("loadingStrategy"): return true;
|
|
55
59
|
case hashString("placeholderColor"): return true;
|
|
@@ -56,7 +56,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
56
56
|
nitro::ReactProp<std::optional<bool>> autoplay;
|
|
57
57
|
nitro::ReactProp<std::optional<std::string>> recyclingKey;
|
|
58
58
|
nitro::ReactProp<std::optional<bool>> optimizeTos;
|
|
59
|
+
nitro::ReactProp<std::optional<bool>> round;
|
|
59
60
|
nitro::ReactProp<std::optional<double>> resizeWidth;
|
|
61
|
+
nitro::ReactProp<std::optional<double>> resizeHeight;
|
|
60
62
|
nitro::ReactProp<std::optional<double>> overscan;
|
|
61
63
|
nitro::ReactProp<std::optional<OneKeyImageLoadingStrategy>> loadingStrategy;
|
|
62
64
|
nitro::ReactProp<std::optional<std::string>> placeholderColor;
|
|
@@ -77,7 +79,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
77
79
|
autoplay.hasSameValue(other.autoplay) &&
|
|
78
80
|
recyclingKey.hasSameValue(other.recyclingKey) &&
|
|
79
81
|
optimizeTos.hasSameValue(other.optimizeTos) &&
|
|
82
|
+
round.hasSameValue(other.round) &&
|
|
80
83
|
resizeWidth.hasSameValue(other.resizeWidth) &&
|
|
84
|
+
resizeHeight.hasSameValue(other.resizeHeight) &&
|
|
81
85
|
overscan.hasSameValue(other.overscan) &&
|
|
82
86
|
loadingStrategy.hasSameValue(other.loadingStrategy) &&
|
|
83
87
|
placeholderColor.hasSameValue(other.placeholderColor) &&
|
|
@@ -99,7 +103,9 @@ namespace margelo::nitro::onekeyimage::views {
|
|
|
99
103
|
autoplay.isProvided() ||
|
|
100
104
|
recyclingKey.isProvided() ||
|
|
101
105
|
optimizeTos.isProvided() ||
|
|
106
|
+
round.isProvided() ||
|
|
102
107
|
resizeWidth.isProvided() ||
|
|
108
|
+
resizeHeight.isProvided() ||
|
|
103
109
|
overscan.isProvided() ||
|
|
104
110
|
loadingStrategy.isProvided() ||
|
|
105
111
|
placeholderColor.isProvided() ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-image",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.157-alpha.248",
|
|
4
4
|
"description": "High-performance native image view for OneKey",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"typescript": "^5.9.2"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"@onekeyfe/react-native-skeleton": "3.0.
|
|
84
|
+
"@onekeyfe/react-native-skeleton": "3.0.157-alpha.248",
|
|
85
85
|
"react": "*",
|
|
86
86
|
"react-native": "*",
|
|
87
87
|
"react-native-nitro-modules": "0.37.0"
|
package/src/OneKeyImage.nitro.ts
CHANGED
|
@@ -43,8 +43,16 @@ export interface OneKeyImageNativeProps extends HybridViewProps {
|
|
|
43
43
|
autoplay?: boolean;
|
|
44
44
|
recyclingKey?: string;
|
|
45
45
|
optimizeTos?: boolean;
|
|
46
|
+
/** Clips the native image to an oval using its current bounds. */
|
|
47
|
+
round?: boolean;
|
|
46
48
|
/** Display width hint in layout units. Native applies the screen density. */
|
|
47
49
|
resizeWidth?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Display height hint in layout units. With `resizeWidth` it lets the
|
|
52
|
+
* pre-layout memory-cache probe derive the same decode thumbnail a preload
|
|
53
|
+
* with the same hints stored; omitted, the hint is a square of `resizeWidth`.
|
|
54
|
+
*/
|
|
55
|
+
resizeHeight?: number;
|
|
48
56
|
overscan?: number;
|
|
49
57
|
loadingStrategy?: OneKeyImageLoadingStrategy;
|
|
50
58
|
/** Theme-aware color used by static loading, error, and fallback states. */
|