bugfix: read callbackId before read other properties.

This commit is contained in:
pengfei.zhou 2021-05-21 18:11:40 +08:00 committed by osborn
parent c347efde3a
commit c1ac0a04a5
2 changed files with 10 additions and 2 deletions

View File

@ -145,6 +145,11 @@ public class ImageNode extends ViewNode<ImageView> {
if (imageScaleValue.isNumber()) { if (imageScaleValue.isNumber()) {
this.imageScale = imageScaleValue.asNumber().toFloat(); this.imageScale = imageScaleValue.asNumber().toFloat();
} }
JSValue loadCallback = jsObject.getProperty("loadCallback");
if (loadCallback.isString()) {
this.loadCallbackId = loadCallback.asString().value();
}
} }
super.blend(jsObject); super.blend(jsObject);
} }
@ -371,7 +376,7 @@ public class ImageNode extends ViewNode<ImageView> {
} }
break; break;
case "loadCallback": case "loadCallback":
this.loadCallbackId = prop.asString().value(); // Do not need set
break; break;
case "imageBase64": case "imageBase64":
if (!prop.isString()) { if (!prop.isString()) {

View File

@ -112,6 +112,9 @@ - (void)blend:(NSDictionary *)props {
[props[@"imageScale"] also:^(NSNumber *it) { [props[@"imageScale"] also:^(NSNumber *it) {
self.imageScale = it.floatValue; self.imageScale = it.floatValue;
}]; }];
[props[@"loadCallback"] also:^(NSString *it) {
self.loadCallbackId = it;
}];
[super blend:props]; [super blend:props];
} }
@ -292,7 +295,7 @@ - (void)blendView:(UIImageView *)view forPropName:(NSString *)name propValue:(id
} }
self.contentMode = self.view.contentMode; self.contentMode = self.view.contentMode;
} else if ([@"loadCallback" isEqualToString:name]) { } else if ([@"loadCallback" isEqualToString:name]) {
self.loadCallbackId = prop; // Do not need set
} else if ([@"imageBase64" isEqualToString:name]) { } else if ([@"imageBase64" isEqualToString:name]) {
NSString *base64 = prop; NSString *base64 = prop;
if (YES == [base64 hasPrefix:@"data:image"]) { if (YES == [base64 hasPrefix:@"data:image"]) {