From c1ac0a04a5ed878f88c0dccbca52ccb73c2148fe Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 21 May 2021 18:11:40 +0800 Subject: [PATCH] bugfix: read callbackId before read other properties. --- .../doric/src/main/java/pub/doric/shader/ImageNode.java | 7 ++++++- doric-iOS/Pod/Classes/Shader/DoricImageNode.m | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java b/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java index 792e6ced..ce5ce659 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/ImageNode.java @@ -145,6 +145,11 @@ public class ImageNode extends ViewNode { if (imageScaleValue.isNumber()) { this.imageScale = imageScaleValue.asNumber().toFloat(); } + JSValue loadCallback = jsObject.getProperty("loadCallback"); + if (loadCallback.isString()) { + this.loadCallbackId = loadCallback.asString().value(); + } + } super.blend(jsObject); } @@ -371,7 +376,7 @@ public class ImageNode extends ViewNode { } break; case "loadCallback": - this.loadCallbackId = prop.asString().value(); + // Do not need set break; case "imageBase64": if (!prop.isString()) { diff --git a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m index 93b7b0e0..36f87259 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m @@ -112,6 +112,9 @@ - (void)blend:(NSDictionary *)props { [props[@"imageScale"] also:^(NSNumber *it) { self.imageScale = it.floatValue; }]; + [props[@"loadCallback"] also:^(NSString *it) { + self.loadCallbackId = it; + }]; [super blend:props]; } @@ -292,7 +295,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id } self.contentMode = self.view.contentMode; } else if ([@"loadCallback" isEqualToString:name]) { - self.loadCallbackId = prop; + // Do not need set } else if ([@"imageBase64" isEqualToString:name]) { NSString *base64 = prop; if (YES == [base64 hasPrefix:@"data:image"]) {