|
18 | 18 | import com.facebook.infer.annotation.Assertions; |
19 | 19 | import com.facebook.react.bridge.ReadableMap; |
20 | 20 | import com.facebook.react.bridge.ReadableMapKeySetIterator; |
21 | | -import com.facebook.react.uimanager.events.EventDispatcher; |
22 | 21 |
|
23 | 22 | /** |
24 | 23 | * Base node class for representing virtual tree of React nodes. Shadow nodes are used primarily |
@@ -203,37 +202,18 @@ public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) { |
203 | 202 | float absoluteX, |
204 | 203 | float absoluteY, |
205 | 204 | UIViewOperationQueue uiViewOperationQueue, |
206 | | - NativeViewHierarchyOptimizer nativeViewHierarchyOptimizer, |
207 | | - EventDispatcher eventDispatcher) { |
| 205 | + NativeViewHierarchyOptimizer nativeViewHierarchyOptimizer) { |
208 | 206 | if (mNodeUpdated) { |
209 | 207 | onCollectExtraUpdates(uiViewOperationQueue); |
210 | 208 | } |
211 | 209 |
|
212 | 210 | if (hasNewLayout()) { |
213 | | - float absoluteLeft = Math.round(absoluteX + getLayoutX()); |
214 | | - float absoluteTop = Math.round(absoluteY + getLayoutY()); |
215 | | - float absoluteRight = Math.round(absoluteX + getLayoutX() + getLayoutWidth()); |
216 | | - float absoluteBottom = Math.round(absoluteY + getLayoutY() + getLayoutHeight()); |
217 | | - // If the layout didn't change this should calculate exactly same values, it's fine to compare |
218 | | - // floats with "==" in this case |
219 | | - if (absoluteLeft != mAbsoluteLeft || absoluteTop != mAbsoluteTop || |
220 | | - absoluteRight != mAbsoluteRight || absoluteBottom != mAbsoluteBottom) { |
221 | | - mAbsoluteLeft = absoluteLeft; |
222 | | - mAbsoluteTop = absoluteTop; |
223 | | - mAbsoluteRight = absoluteRight; |
224 | | - mAbsoluteBottom = absoluteBottom; |
225 | | - |
226 | | - nativeViewHierarchyOptimizer.handleUpdateLayout(this); |
227 | | - if (mShouldNotifyOnLayout) { |
228 | | - eventDispatcher.dispatchEvent( |
229 | | - OnLayoutEvent.obtain( |
230 | | - getReactTag(), |
231 | | - getScreenX(), |
232 | | - getScreenY(), |
233 | | - getScreenWidth(), |
234 | | - getScreenHeight())); |
235 | | - } |
236 | | - } |
| 211 | + mAbsoluteLeft = Math.round(absoluteX + getLayoutX()); |
| 212 | + mAbsoluteTop = Math.round(absoluteY + getLayoutY()); |
| 213 | + mAbsoluteRight = Math.round(absoluteX + getLayoutX() + getLayoutWidth()); |
| 214 | + mAbsoluteBottom = Math.round(absoluteY + getLayoutY() + getLayoutHeight()); |
| 215 | + |
| 216 | + nativeViewHierarchyOptimizer.handleUpdateLayout(this); |
237 | 217 | } |
238 | 218 | } |
239 | 219 |
|
@@ -284,6 +264,10 @@ public void setShouldNotifyOnLayout(boolean shouldNotifyOnLayout) { |
284 | 264 | mShouldNotifyOnLayout = shouldNotifyOnLayout; |
285 | 265 | } |
286 | 266 |
|
| 267 | + /* package */ boolean shouldNotifyOnLayout() { |
| 268 | + return mShouldNotifyOnLayout; |
| 269 | + } |
| 270 | + |
287 | 271 | /** |
288 | 272 | * Adds a child that the native view hierarchy will have at this index in the native view |
289 | 273 | * corresponding to this node. |
|
0 commit comments