@@ -33,10 +33,6 @@ public class ReactShadowNode : IDisposable
33
33
private int _totalNativeChildren ;
34
34
private ReactShadowNode _nativeParent ;
35
35
private IList < ReactShadowNode > _nativeChildren ;
36
- private float _absoluteLeft ;
37
- private float _absoluteTop ;
38
- private float _absoluteRight ;
39
- private float _absoluteBottom ;
40
36
41
37
/// <summary>
42
38
/// Instantiates a <see cref="ReactShadowNode"/>.
@@ -498,22 +494,22 @@ public int TotalNativeChildren
498
494
/// <summary>
499
495
/// The screen horizontal position.
500
496
/// </summary>
501
- public int ScreenX => ( int ) Math . Round ( LayoutX ) ;
497
+ public int ScreenX { get ; private set ; }
502
498
503
499
/// <summary>
504
500
/// The screen vertical position.
505
501
/// </summary>
506
- public int ScreenY => ( int ) Math . Round ( LayoutY ) ;
502
+ public int ScreenY { get ; private set ; }
507
503
508
504
/// <summary>
509
505
/// The screen width.
510
506
/// </summary>
511
- public int ScreenWidth => ( int ) Math . Round ( _absoluteRight - _absoluteLeft ) ;
507
+ public int ScreenWidth { get ; private set ; }
512
508
513
509
/// <summary>
514
510
/// The screen height.
515
511
/// </summary>
516
- public int ScreenHeight => ( int ) Math . Round ( _absoluteBottom - _absoluteTop ) ;
512
+ public int ScreenHeight { get ; private set ; }
517
513
518
514
/// <summary>
519
515
/// The measure function.
@@ -1089,12 +1085,35 @@ internal bool DispatchUpdates(
1089
1085
1090
1086
if ( HasNewLayout )
1091
1087
{
1092
- _absoluteLeft = absoluteX + LayoutX ;
1093
- _absoluteTop = absoluteY + LayoutY ;
1094
- _absoluteRight = absoluteX + LayoutX + LayoutWidth ;
1095
- _absoluteBottom = absoluteY + LayoutY + LayoutHeight ;
1096
- nativeViewHierarchyOptimizer . HandleUpdateLayout ( this ) ;
1097
- return true ;
1088
+ var layoutX = LayoutX ;
1089
+ var layoutY = LayoutY ;
1090
+ var newAbsoluteLeft = ( int ) Math . Round ( absoluteX + layoutX ) ;
1091
+ var newAbsoluteTop = ( int ) Math . Round ( absoluteY + layoutY ) ;
1092
+ var newAbsoluteRight = ( int ) Math . Round ( absoluteX + layoutX + LayoutWidth ) ;
1093
+ var newAbsoluteBottom = ( int ) Math . Round ( absoluteY + layoutY + LayoutHeight ) ;
1094
+
1095
+ var newScreenX = ( int ) Math . Round ( layoutX ) ;
1096
+ var newScreenY = ( int ) Math . Round ( layoutY ) ;
1097
+ var newScreenWidth = newAbsoluteRight - newAbsoluteLeft ;
1098
+ var newScreenHeight = newAbsoluteBottom - newAbsoluteTop ;
1099
+
1100
+ var layoutHasChanged =
1101
+ newScreenX != ScreenX ||
1102
+ newScreenY != ScreenY ||
1103
+ newScreenWidth != ScreenWidth ||
1104
+ newScreenHeight != ScreenHeight ;
1105
+
1106
+ ScreenX = newScreenX ;
1107
+ ScreenY = newScreenY ;
1108
+ ScreenWidth = newScreenWidth ;
1109
+ ScreenHeight = newScreenHeight ;
1110
+
1111
+ if ( layoutHasChanged )
1112
+ {
1113
+ nativeViewHierarchyOptimizer . HandleUpdateLayout ( this ) ;
1114
+ }
1115
+
1116
+ return layoutHasChanged ;
1098
1117
}
1099
1118
else
1100
1119
{
0 commit comments