mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/40748 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 fbshipit-source-id: f6a9d5c973b97aede879baa8b952cc1be2447f28
35 lines
880 B
Objective-C
35 lines
880 B
Objective-C
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <React/RCTShadowView.h>
|
|
#import <yoga/YGEnums.h>
|
|
|
|
@interface RCTRootShadowView : RCTShadowView
|
|
|
|
/**
|
|
* Minimum size to layout all views.
|
|
* Defaults to CGSizeZero
|
|
*/
|
|
@property (nonatomic, assign) CGSize minimumSize;
|
|
|
|
/**
|
|
* Available size to layout all views.
|
|
* Defaults to {INFINITY, INFINITY}
|
|
*/
|
|
@property (nonatomic, assign) CGSize availableSize;
|
|
|
|
/**
|
|
* Layout direction (LTR or RTL) inherited from native environment and
|
|
* is using as a base direction value in layout engine.
|
|
* Defaults to value inferred from current locale.
|
|
*/
|
|
@property (nonatomic, assign) YGDirection baseDirection;
|
|
|
|
- (void)layoutWithAffectedShadowViews:(NSPointerArray *)affectedShadowViews;
|
|
|
|
@end
|