File tree 2 files changed +16
-13
lines changed
2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,6 @@ NS_ASSUME_NONNULL_BEGIN
84
84
*/
85
85
@property (atomic , assign , readonly ) CGSize maximumSize;
86
86
87
-
88
87
/* *
89
88
* Simple shortcut to `-[RCTSurface setMinimumSize:size maximumSize:size]`.
90
89
*/
@@ -109,8 +108,12 @@ NS_ASSUME_NONNULL_BEGIN
109
108
110
109
/* *
111
110
* Synchronously blocks the current thread up to given `timeout` until
112
- * the Surface will not have given `stage`.
113
- * Do nothing, if called from the main or `UIManager` queue.
111
+ * the Surface reaches `stage`.
112
+ * Limitations:
113
+ * - Do nothing, if called on `UIManager` queue.
114
+ * - Calling on the main queue with `RCTSurfaceStageSurfaceDidInitialMounting`
115
+ * stage temporary is not supported; in this case the stage will be
116
+ * downgraded to `RCTSurfaceStageSurfaceDidInitialLayout`.
114
117
*/
115
118
- (BOOL )synchronouslyWaitForStage : (RCTSurfaceStage)stage timeout : (NSTimeInterval )timeout ;
116
119
Original file line number Diff line number Diff line change @@ -435,6 +435,16 @@ - (CGSize)intrinsicSize
435
435
436
436
- (BOOL )synchronouslyWaitForStage : (RCTSurfaceStage)stage timeout : (NSTimeInterval )timeout
437
437
{
438
+ if (RCTIsMainQueue () && (stage == RCTSurfaceStageSurfaceDidInitialRendering)) {
439
+ // This case *temporary* does not supported.
440
+ stage = RCTSurfaceStageSurfaceDidInitialLayout;
441
+ }
442
+
443
+ if (RCTIsUIManagerQueue ()) {
444
+ RCTLogInfo (@" Synchronous waiting is not supported on UIManager queue." );
445
+ return NO ;
446
+ }
447
+
438
448
dispatch_semaphore_t semaphore;
439
449
switch (stage) {
440
450
case RCTSurfaceStageSurfaceDidInitialLayout:
@@ -447,16 +457,6 @@ - (BOOL)synchronouslyWaitForStage:(RCTSurfaceStage)stage timeout:(NSTimeInterval
447
457
RCTAssert (NO , @" Only waiting for `RCTSurfaceStageSurfaceDidInitialRendering` and `RCTSurfaceStageSurfaceDidInitialLayout` stages is supported." );
448
458
}
449
459
450
- if (RCTIsMainQueue ()) {
451
- RCTLogInfo (@" Synchronous waiting is not supported on the main queue." );
452
- return NO ;
453
- }
454
-
455
- if (RCTIsUIManagerQueue ()) {
456
- RCTLogInfo (@" Synchronous waiting is not supported on UIManager queue." );
457
- return NO ;
458
- }
459
-
460
460
BOOL timeoutOccured = dispatch_semaphore_wait (semaphore, dispatch_time (DISPATCH_TIME_NOW, timeout * NSEC_PER_SEC));
461
461
if (!timeoutOccured) {
462
462
// Balancing the semaphore.
You can’t perform that action at this time.
0 commit comments