mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-27 22:54:46 +08:00
Send layout events on shadow queue
Summary: We currently wait until after views have been updated on the main thread before sending layout events. This means that any code that relies on those events to update the UI will lag the atual layout by at least one frame. This changes the RCTUIManager to send the event immediately after layout has occured on the shadow thread. This noticably improves the respinsiveness of the layout example in UIExplorer, which now updates the dimension labels immediately instead of waiting until after the layout animation has completed.
This commit is contained in:
@@ -185,6 +185,10 @@ var View = React.createClass({
|
||||
* Invoked on mount and layout changes with
|
||||
*
|
||||
* {nativeEvent: { layout: {x, y, width, height}}}.
|
||||
*
|
||||
* This event is fired immediately once the layout has been calculated, but
|
||||
* the new layout may not yet be reflected on the screen at the time the
|
||||
* event is received, especially if a layout animation is in progress.
|
||||
*/
|
||||
onLayout: PropTypes.func,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user