Closed
Conversation
piaskowyk
commented
Oct 5, 2023
| #import <React/RCTUIManager.h> | ||
|
|
||
| @interface RCTUIManager (Reanimated) | ||
| @property (atomic) NSNumber *isViewTreesSynchronized; |
Member
Author
There was a problem hiding this comment.
It needs to be NSNumber, because I can't inject BOOL field with objc_setAssociatedObject method
tomekzaw
reviewed
Oct 5, 2023
| - (void)setIsViewTreesSynchronized:(NSNumber *)isViewTreesSynchronized | ||
| { | ||
| objc_setAssociatedObject(self, @selector(isViewTreesSynchronized), isViewTreesSynchronized, OBJC_ASSOCIATION_RETAIN); | ||
| } |
| { | ||
| objc_setAssociatedObject(self, @selector(isViewTreesSynchronized), isViewTreesSynchronized, OBJC_ASSOCIATION_RETAIN); | ||
| } | ||
| - (id)isViewTreesSynchronized |
Member
There was a problem hiding this comment.
Suggested change
| - (id)isViewTreesSynchronized | |
| - (NSNumber *)isViewTreesSynchronized |
| } | ||
| BOOL canUpdateSynchronously = trySynchronously && ![strongSelf.uiManager hasEnqueuedUICommands]; | ||
|
|
||
| auto isViewTreesSynchronized = [[strongSelf.uiManager isViewTreesSynchronized] intValue] == 1; |
Member
There was a problem hiding this comment.
Suggested change
| auto isViewTreesSynchronized = [[strongSelf.uiManager isViewTreesSynchronized] intValue] == 1; | |
| auto isViewTreesSynchronized = [[strongSelf.uiManager isViewTreesSynchronized] boolValue]; |
|
|
||
| - (void)setNeedsLayout; | ||
|
|
||
| - (id)isViewTreesSynchronized; |
Member
There was a problem hiding this comment.
Suggested change
| - (id)isViewTreesSynchronized; | |
| - (NSNumber *)isViewTreesSynchronized; |
a7bfbb8 to
f9d44b9
Compare
Member
Author
|
Closed due to: #5224 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a problem with race conditions during updating parent view and mounting children. The problem occurs in some specific circumstances:
In this situation (repro in attached example code) may happen race conditions. See at the graph:
Style updating by Reanimated
Mounting new view by React
So when we merge both graph in single one, It should behave in this way:
But because Reanimated is trying to perform update synchronously it looks like that:
In this specific situation, the React Shadow Tree and UI Native Tree are not synchronized. To resolve this issue, I disabled the synchronous style update through Reanimated until those trees can be synchronized once more.
Screen.Recording.2023-10-05.at.14.43.58.mov
Screen.Recording.2023-10-05.at.14.40.24.mov
Fixes #4932
Test plan
Example code