Using RCTExecuteOnMainQueue in RCTUIManager
Reviewed By: javache Differential Revision: D5937423 fbshipit-source-id: 1b7f5976acdfdfd00c6aa5c13e80113ba1e04434
This commit is contained in:
parent
feba4f6a92
commit
9cd095eae8
|
@ -88,7 +88,7 @@ RCT_EXPORT_MODULE()
|
||||||
// This only accessed from the shadow queue
|
// This only accessed from the shadow queue
|
||||||
_pendingUIBlocks = nil;
|
_pendingUIBlocks = nil;
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
RCTExecuteOnMainQueue(^{
|
||||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"UIManager invalidate", nil);
|
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"UIManager invalidate", nil);
|
||||||
for (NSNumber *rootViewTag in self->_rootViewTags) {
|
for (NSNumber *rootViewTag in self->_rootViewTags) {
|
||||||
[(id<RCTInvalidating>)self->_viewRegistry[rootViewTag] invalidate];
|
[(id<RCTInvalidating>)self->_viewRegistry[rootViewTag] invalidate];
|
||||||
|
@ -538,7 +538,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
||||||
if (RCTIsReactRootView(reactTag)) {
|
if (RCTIsReactRootView(reactTag)) {
|
||||||
CGSize contentSize = shadowView.frame.size;
|
CGSize contentSize = shadowView.frame.size;
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
RCTExecuteOnMainQueue(^{
|
||||||
UIView *view = self->_viewRegistry[reactTag];
|
UIView *view = self->_viewRegistry[reactTag];
|
||||||
RCTAssert(view != nil, @"view (for ID %@) not found", reactTag);
|
RCTAssert(view != nil, @"view (for ID %@) not found", reactTag);
|
||||||
|
|
||||||
|
@ -953,7 +953,7 @@ RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag
|
||||||
// Dispatch view creation directly to the main thread instead of adding to
|
// Dispatch view creation directly to the main thread instead of adding to
|
||||||
// UIBlocks array. This way, it doesn't get deferred until after layout.
|
// UIBlocks array. This way, it doesn't get deferred until after layout.
|
||||||
__weak RCTUIManager *weakManager = self;
|
__weak RCTUIManager *weakManager = self;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
RCTExecuteOnMainQueue(^{
|
||||||
RCTUIManager *uiManager = weakManager;
|
RCTUIManager *uiManager = weakManager;
|
||||||
if (!uiManager) {
|
if (!uiManager) {
|
||||||
return;
|
return;
|
||||||
|
@ -1119,7 +1119,7 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand:(nonnull NSNumber *)reactTag
|
||||||
if (previousPendingUIBlocks.count) {
|
if (previousPendingUIBlocks.count) {
|
||||||
// Execute the previously queued UI blocks
|
// Execute the previously queued UI blocks
|
||||||
RCTProfileBeginFlowEvent();
|
RCTProfileBeginFlowEvent();
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
RCTExecuteOnMainQueue(^{
|
||||||
RCTProfileEndFlowEvent();
|
RCTProfileEndFlowEvent();
|
||||||
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[UIManager flushUIBlocks]", (@{
|
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[UIManager flushUIBlocks]", (@{
|
||||||
@"count": [@(previousPendingUIBlocks.count) stringValue],
|
@"count": [@(previousPendingUIBlocks.count) stringValue],
|
||||||
|
@ -1512,7 +1512,7 @@ RCT_EXPORT_METHOD(configureNextLayoutAnimation:(NSDictionary *)config
|
||||||
|
|
||||||
RCTExecuteOnUIManagerQueue(^{
|
RCTExecuteOnUIManagerQueue(^{
|
||||||
NSNumber *rootTag = [self shadowViewForReactTag:reactTag].rootView.reactTag;
|
NSNumber *rootTag = [self shadowViewForReactTag:reactTag].rootView.reactTag;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
RCTExecuteOnMainQueue(^{
|
||||||
UIView *rootView = nil;
|
UIView *rootView = nil;
|
||||||
if (rootTag != nil) {
|
if (rootTag != nil) {
|
||||||
rootView = [self viewForReactTag:rootTag];
|
rootView = [self viewForReactTag:rootTag];
|
||||||
|
|
Loading…
Reference in New Issue