Fix crash when accessing _viewRegistry

Summary:
Changelog: [internal] Fixes fabric specific crash

`_viewRegistry` is not thread safe and accessing it on another thread can cause a crash.
Calling it inside `RCTUnsafeExecuteOnMainQueueSync` shouldn't degrade performance because it is only used as a fallback.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18421789

fbshipit-source-id: 2adff434afe0a3c19318c95b051ee91ccf6293e5
This commit is contained in:
Samuel Susla
2019-11-11 03:01:26 -08:00
committed by Facebook Github Bot
parent 58726cee85
commit 620f83aae5
+4 -1
View File
@@ -335,7 +335,10 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
return name;
}
UIView *view = _viewRegistry[reactTag];
__block UIView *view;
RCTUnsafeExecuteOnMainQueueSync(^{
view = self->_viewRegistry[reactTag];
});
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"