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

Deterministic onLayout event ordering for iOS Paper #40748

Closed
wants to merge 1 commit into from

Commits on Oct 10, 2023

  1. Deterministic onLayout event ordering for iOS Paper (facebook#40748)

    Summary:
    
    The ordering of `onLayout` events is non-deterministic on iOS Paper, due to nodes being added to an `NSHashTable` before iteration, instead of an ordered collection.
    
    We don't do any lookups on the collection, so I think this was chosen over `NSMutableArray` for the sake of `[NSHashTable weakObjectsHashTable]`, to avoid retain/release. Using a collection which does retain/release seems to cause a crash due to double release or similar, so those semantics seem intentional (though I'm not super familiar with the model here).
    
    We can replicate the memory semantics with ordering by using `NSPointerArray` (which is unfortunately not parameterized). This change does that, so we get consistently top-down layout events (matching Fabric, and Android Paper as of D49627996). This lets us use multiple layout events to calculate right/bottom edge insets deterministically.
    
    Changelog:
    [iOS][Changed] -  Deterministic onLayout event ordering for iOS Paper
    
    Reviewed By: luluwu2032
    
    Differential Revision: D50093411
    NickGerleman authored and facebook-github-bot committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    9cc8cb4 View commit details
    Browse the repository at this point in the history