Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synchronise dispatching of view commands through RuntimeScheduler #47604

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Nov 14, 2024

  1. [skip ci] move reference to RuntimeScheduler to pointer (facebook#47605)

    Summary:
    
    changelog: [internal]
    
    use a pointer to RuntimeScheduler instead of getting a reference to it from context container each time.
    
    Differential Revision: D65909100
    sammy-SC authored and facebook-github-bot committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    a5d6dbb View commit details
    Browse the repository at this point in the history
  2. synchronise dispatching of view commands through RuntimeScheduler (fa…

    …cebook#47604)
    
    Summary:
    
    ## Changelog:
    
    [iOS] [Fixed] - Fixed use of view commands from layout effects
    
    Mounting of views is delayed by runtime scheduler to allow React to run layout effects. Execution of view commands must by queued together with mounting of views, otherwise it might be executed before views are mounted. When this happens, view commands are ignored.
    
    So before, if view command was executed from layout effect (or ref function), it would get dispatched to the UI thread as quickly as possible. But mounting of views would be delayed. To fix this, both mounting of views and view commands are put on the same queue inside of RuntimeScheduler.
    
    ## What about Android?
    Android employs a [retry mechanism](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java#L211) that was needed for react tag based view commands. In paper, one could send a view command to a react tag which was completely disconnected from whether a view exists or not.
    
    iOS was built with ref commands in mind, so it doesn't have this mechanism.
    
    
    Fixes: facebook#47576
    
    Reviewed By: javache, cipolleschi
    
    Differential Revision: D65909191
    sammy-SC authored and facebook-github-bot committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    133896a View commit details
    Browse the repository at this point in the history