mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 19:44:13 +00:00
Unified usage of RCTAssertUIManagerQueue
Reviewed By: javache Differential Revision: D5440518 fbshipit-source-id: fe0df85aa3361402f9bdaa800fc3b1f10162814b
This commit is contained in:
parent
f082e6cffd
commit
8760b938a2
@ -245,7 +245,7 @@ BOOL RCTIsUIManagerQueue()
|
|||||||
|
|
||||||
- (NSString *)viewNameForReactTag:(NSNumber *)reactTag
|
- (NSString *)viewNameForReactTag:(NSNumber *)reactTag
|
||||||
{
|
{
|
||||||
RCTAssertThread(RCTGetUIManagerQueue(), @"viewNameForReactTag can only be called from the shadow queue");
|
RCTAssertUIManagerQueue();
|
||||||
return _shadowViewRegistry[reactTag].viewName;
|
return _shadowViewRegistry[reactTag].viewName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,9 +381,7 @@ BOOL RCTIsUIManagerQueue()
|
|||||||
|
|
||||||
- (void)addUIBlock:(RCTViewManagerUIBlock)block
|
- (void)addUIBlock:(RCTViewManagerUIBlock)block
|
||||||
{
|
{
|
||||||
RCTAssertThread(RCTGetUIManagerQueue(),
|
RCTAssertUIManagerQueue();
|
||||||
@"-[RCTUIManager addUIBlock:] should only be called from the "
|
|
||||||
"UIManager's queue (get this using `RCTGetUIManagerQueue()`)");
|
|
||||||
|
|
||||||
if (!block || !_viewRegistry) {
|
if (!block || !_viewRegistry) {
|
||||||
return;
|
return;
|
||||||
@ -394,9 +392,7 @@ BOOL RCTIsUIManagerQueue()
|
|||||||
|
|
||||||
- (void)prependUIBlock:(RCTViewManagerUIBlock)block
|
- (void)prependUIBlock:(RCTViewManagerUIBlock)block
|
||||||
{
|
{
|
||||||
RCTAssertThread(RCTGetUIManagerQueue(),
|
RCTAssertUIManagerQueue();
|
||||||
@"-[RCTUIManager prependUIBlock:] should only be called from the "
|
|
||||||
"UIManager's queue (get this using `RCTGetUIManagerQueue()`)");
|
|
||||||
|
|
||||||
if (!block || !_viewRegistry) {
|
if (!block || !_viewRegistry) {
|
||||||
return;
|
return;
|
||||||
@ -420,7 +416,7 @@ BOOL RCTIsUIManagerQueue()
|
|||||||
|
|
||||||
- (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *)rootShadowView
|
- (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *)rootShadowView
|
||||||
{
|
{
|
||||||
RCTAssert(!RCTIsMainQueue(), @"Should be called on shadow queue");
|
RCTAssertUIManagerQueue();
|
||||||
|
|
||||||
// This is nuanced. In the JS thread, we create a new update buffer
|
// This is nuanced. In the JS thread, we create a new update buffer
|
||||||
// `frameTags`/`frames` that is created/mutated in the JS thread. We access
|
// `frameTags`/`frames` that is created/mutated in the JS thread. We access
|
||||||
@ -1065,8 +1061,7 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand:(nonnull NSNumber *)reactTag
|
|||||||
|
|
||||||
- (void)flushUIBlocks
|
- (void)flushUIBlocks
|
||||||
{
|
{
|
||||||
RCTAssertThread(RCTGetUIManagerQueue(),
|
RCTAssertUIManagerQueue();
|
||||||
@"flushUIBlocks can only be called from the shadow queue");
|
|
||||||
|
|
||||||
// First copy the previous blocks into a temporary variable, then reset the
|
// First copy the previous blocks into a temporary variable, then reset the
|
||||||
// pending blocks to a new array. This guards against mutation while
|
// pending blocks to a new array. This guards against mutation while
|
||||||
|
Loading…
x
Reference in New Issue
Block a user