feat:add protect case for plugin and view

This commit is contained in:
pengfei.zhou
2021-06-22 15:45:17 +08:00
committed by osborn
parent 8339a64663
commit 901d3fdf72
8 changed files with 175 additions and 8 deletions

View File

@@ -29,6 +29,7 @@
#import "DoricExtensions.h"
#import "DoricPromise.h"
#import "DoricFlexNode.h"
#import "DoricErrorHintNode.h"
@interface AnimationCallback : NSObject <CAAnimationDelegate>
@property(nonatomic, strong) NSMutableDictionary *dictionary;
@@ -322,7 +323,13 @@ - (DoricAsyncResult *)pureCallJSResponse:(NSString *)funcId, ... {
+ (__kindof DoricViewNode *)create:(DoricContext *)context withType:(NSString *)type {
DoricRegistry *registry = context.driver.registry;
Class clz = [registry acquireViewNode:type];
DoricViewNode *viewNode = [(DoricViewNode *) [clz alloc] initWithContext:context];
DoricViewNode *viewNode;
if (!clz) {
viewNode = [[DoricErrorHintNode alloc] initWithContext:context];
((DoricErrorHintNode *) viewNode).hintText = type;
} else {
viewNode = [(DoricViewNode *) [clz alloc] initWithContext:context];
}
viewNode.type = type;
return viewNode;
}