iOS: optimize hot reload operation which causes render error
This commit is contained in:
parent
61e537aa98
commit
f4fcb981b4
@ -107,18 +107,22 @@ - (void)build:(CGSize)size {
|
||||
}
|
||||
|
||||
- (void)reload:(NSString *)script {
|
||||
[self.driver destroyContext:self.contextId];
|
||||
[[self.driver destroyContext:self.contextId] waitUntilResult];
|
||||
self.rootNode.viewId = nil;
|
||||
[self.rootNode clearSubModel];
|
||||
[self.rootNode.view.subviews forEach:^(__kindof UIView *obj) {
|
||||
[obj removeFromSuperview];
|
||||
}];
|
||||
self.script = script;
|
||||
_destroyed = YES;
|
||||
[self dispatchToMainQueue:^{
|
||||
_destroyed = NO;
|
||||
[self.driver createContext:self.contextId script:script source:self.source];
|
||||
[self init:self.extra];
|
||||
[self callEntity:DORIC_ENTITY_CREATE withArgumentsArray:@[]];
|
||||
[self callEntity:DORIC_ENTITY_BUILD withArgumentsArray:@[self.initialParams]];
|
||||
[self onShow];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)onShow {
|
||||
|
@ -41,7 +41,7 @@ - (instancetype)initWithContext:(DoricContext *)context callbackId:(NSString *)c
|
||||
|
||||
- (void)resolve:(id)result {
|
||||
__weak typeof(self) __self = self;
|
||||
if (self.context == nil) {
|
||||
if (self.context == nil || self.context.destroyed) {
|
||||
return;
|
||||
}
|
||||
[[self.context.driver invokeDoricMethod:DORIC_BRIDGE_RESOLVE
|
||||
@ -58,7 +58,7 @@ - (void)resolve:(id)result {
|
||||
|
||||
- (void)reject:(id)result {
|
||||
__weak typeof(self) __self = self;
|
||||
if (self.context == nil) {
|
||||
if (self.context == nil || self.context.destroyed) {
|
||||
return;
|
||||
}
|
||||
[[self.context.driver invokeDoricMethod:DORIC_BRIDGE_REJECT
|
||||
|
Reference in New Issue
Block a user