iOS: fix non ui thread access view content offset
This commit is contained in:
parent
01b30f48bb
commit
761a6f67a4
@ -565,15 +565,16 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|||||||
if (!self.jsDispatcher) {
|
if (!self.jsDispatcher) {
|
||||||
self.jsDispatcher = [DoricJSDispatcher new];
|
self.jsDispatcher = [DoricJSDispatcher new];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSDictionary *offset = @{
|
||||||
|
@"x": @(self.view.contentOffset.x),
|
||||||
|
@"y": @(self.view.contentOffset.y),
|
||||||
|
};
|
||||||
|
|
||||||
__weak typeof(self) __self = self;
|
__weak typeof(self) __self = self;
|
||||||
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
||||||
__strong typeof(__self) self = __self;
|
__strong typeof(__self) self = __self;
|
||||||
return [self callJSResponse:self.onScrollFuncId,
|
return [self callJSResponse:self.onScrollFuncId, offset, nil];
|
||||||
@{
|
|
||||||
@"x": @(self.view.contentOffset.x),
|
|
||||||
@"y": @(self.view.contentOffset.y),
|
|
||||||
},
|
|
||||||
nil];
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -471,15 +471,16 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|||||||
if (!self.jsDispatcher) {
|
if (!self.jsDispatcher) {
|
||||||
self.jsDispatcher = [DoricJSDispatcher new];
|
self.jsDispatcher = [DoricJSDispatcher new];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSDictionary *offset = @{
|
||||||
|
@"x": @(self.view.contentOffset.x),
|
||||||
|
@"y": @(self.view.contentOffset.y),
|
||||||
|
};
|
||||||
|
|
||||||
__weak typeof(self) __self = self;
|
__weak typeof(self) __self = self;
|
||||||
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
||||||
__strong typeof(__self) self = __self;
|
__strong typeof(__self) self = __self;
|
||||||
return [self callJSResponse:self.onScrollFuncId,
|
return [self callJSResponse:self.onScrollFuncId, offset, nil];
|
||||||
@{
|
|
||||||
@"x": @(self.view.contentOffset.x),
|
|
||||||
@"y": @(self.view.contentOffset.y),
|
|
||||||
},
|
|
||||||
nil];
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,15 +587,16 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|||||||
if (!self.jsDispatcher) {
|
if (!self.jsDispatcher) {
|
||||||
self.jsDispatcher = [DoricJSDispatcher new];
|
self.jsDispatcher = [DoricJSDispatcher new];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSDictionary *offset = @{
|
||||||
|
@"x": @(self.view.contentOffset.x),
|
||||||
|
@"y": @(self.view.contentOffset.y),
|
||||||
|
};
|
||||||
|
|
||||||
__weak typeof(self) __self = self;
|
__weak typeof(self) __self = self;
|
||||||
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
||||||
__strong typeof(__self) self = __self;
|
__strong typeof(__self) self = __self;
|
||||||
return [self callJSResponse:self.onScrollFuncId,
|
return [self callJSResponse:self.onScrollFuncId, offset, nil];
|
||||||
@{
|
|
||||||
@"x": @(self.view.contentOffset.x),
|
|
||||||
@"y": @(self.view.contentOffset.y),
|
|
||||||
},
|
|
||||||
nil];
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,15 +136,16 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|||||||
if (!self.jsDispatcher) {
|
if (!self.jsDispatcher) {
|
||||||
self.jsDispatcher = [DoricJSDispatcher new];
|
self.jsDispatcher = [DoricJSDispatcher new];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSDictionary *offset = @{
|
||||||
|
@"x": @(self.view.contentOffset.x),
|
||||||
|
@"y": @(self.view.contentOffset.y),
|
||||||
|
};
|
||||||
|
|
||||||
__weak typeof(self) __self = self;
|
__weak typeof(self) __self = self;
|
||||||
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
||||||
__strong typeof(__self) self = __self;
|
__strong typeof(__self) self = __self;
|
||||||
return [self callJSResponse:self.onScrollFuncId,
|
return [self callJSResponse:self.onScrollFuncId, offset, nil];
|
||||||
@{
|
|
||||||
@"x": @(self.view.contentOffset.x),
|
|
||||||
@"y": @(self.view.contentOffset.y),
|
|
||||||
},
|
|
||||||
nil];
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user