fix:iOS Runloop cannot exit and other issues

This commit is contained in:
pengfei.zhou
2021-03-04 12:53:42 +08:00
committed by osborn
parent 627f323ae3
commit e78625281f
6 changed files with 20 additions and 8 deletions

View File

@@ -102,6 +102,9 @@ - (void)reload:(NSString *)script {
[self.driver destroyContext:self.contextId];
self.rootNode.viewId = nil;
[self.rootNode clearSubModel];
[self.rootNode.view.subviews forEach:^(__kindof UIView *obj) {
[obj removeFromSuperview];
}];
self.script = script;
[self.driver createContext:self.contextId script:script source:self.source];
[self init:self.extra];

View File

@@ -103,6 +103,9 @@ - (instancetype)init {
- (void)teardown {
_destroyed = YES;
//To ensure runloop continue.
[self ensureRunOnJSThread:^{
}];
}
- (void)ensureRunOnJSThread:(dispatch_block_t)block {