@onekeyfe/react-native-image 3.0.101 → 3.0.102
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.
|
@@ -123,6 +123,11 @@ class HybridOneKeyImage(private val context: ThemedReactContext) :
|
|
|
123
123
|
private enum class DisplayState { LOADING, IMAGE, ERROR, FALLBACK }
|
|
124
124
|
|
|
125
125
|
private val hostView = OneKeyImageHostView(context)
|
|
126
|
+
// Keep requests independent of ScreenStack Fragment teardown while React
|
|
127
|
+
// retains the view.
|
|
128
|
+
private val requestManager by lazy(LazyThreadSafetyMode.NONE) {
|
|
129
|
+
Glide.with(context.applicationContext)
|
|
130
|
+
}
|
|
126
131
|
private var loadRunnable: Runnable? = null
|
|
127
132
|
private var currentTarget: CustomViewTarget<OneKeyImageHostView, Drawable>? = null
|
|
128
133
|
private var generation = 0L
|
|
@@ -446,7 +451,7 @@ class HybridOneKeyImage(private val context: ThemedReactContext) :
|
|
|
446
451
|
}
|
|
447
452
|
}
|
|
448
453
|
currentTarget = target
|
|
449
|
-
|
|
454
|
+
requestManager
|
|
450
455
|
.asDrawable()
|
|
451
456
|
.load(OneKeyImageModel.build(requestUrl, headersJson))
|
|
452
457
|
.apply(requestOptions(policy))
|
|
@@ -523,7 +528,7 @@ class HybridOneKeyImage(private val context: ThemedReactContext) :
|
|
|
523
528
|
// Clear the field first so onResourceCleared from our own cancellation
|
|
524
529
|
// cannot erase state belonging to the next generation/request.
|
|
525
530
|
currentTarget = null
|
|
526
|
-
|
|
531
|
+
requestManager.clear(target)
|
|
527
532
|
}
|
|
528
533
|
|
|
529
534
|
private fun scheduleOnDisplay(requestGeneration: Long) {
|
package/lib/module/index.js
CHANGED
|
@@ -21,7 +21,7 @@ function unwrap(value) {
|
|
|
21
21
|
function normalizeSource(source) {
|
|
22
22
|
if (source == null) return undefined;
|
|
23
23
|
const resolved = Image.resolveAssetSource(source);
|
|
24
|
-
if (resolved?.uri) {
|
|
24
|
+
if (resolved?.uri?.trim()) {
|
|
25
25
|
const original = typeof source === 'object' && !Array.isArray(source) ? source : undefined;
|
|
26
26
|
return {
|
|
27
27
|
uri: resolved.uri,
|
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.102",
|
|
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.102",
|
|
85
85
|
"react": "*",
|
|
86
86
|
"react-native": "*",
|
|
87
87
|
"react-native-nitro-modules": "0.37.0"
|
package/src/index.tsx
CHANGED
|
@@ -126,7 +126,7 @@ function normalizeSource(
|
|
|
126
126
|
): OneKeyImageSource | undefined {
|
|
127
127
|
if (source == null) return undefined;
|
|
128
128
|
const resolved = Image.resolveAssetSource(source as ImageSourcePropType);
|
|
129
|
-
if (resolved?.uri) {
|
|
129
|
+
if (resolved?.uri?.trim()) {
|
|
130
130
|
const original =
|
|
131
131
|
typeof source === 'object' && !Array.isArray(source)
|
|
132
132
|
? (source as OneKeyImageSource)
|