From f53267f7031dec9f8e61c679bf786d025d634eb6 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 10 Jun 2020 22:45:53 -0700 Subject: [PATCH] Migrate ReactText view to use uiManager.receiveEvent instead of ReactEventEmitter Summary: This diff refactors ReactTextView to use uiManager.receiveEvent instead of ReactEventEmitter. ReactEventEmitter.class should be replaced for uiManager.receiveEvent. changelog: [internal] Reviewed By: JoshuaGross Differential Revision: D21982548 fbshipit-source-id: 4ed5825f62c761564aa533f4e8bb1155036df7e2 --- .../com/facebook/react/views/text/ReactTextView.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java index 3d7988087ff..f7a0a18995f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java @@ -37,7 +37,6 @@ import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.ViewDefaults; import com.facebook.react.uimanager.common.UIManagerType; import com.facebook.react.uimanager.common.ViewUtil; -import com.facebook.react.uimanager.events.RCTEventEmitter; import com.facebook.react.views.view.ReactViewBackgroundManager; import java.util.ArrayList; import java.util.Collections; @@ -100,8 +99,9 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie protected void onLayout( boolean changed, int textViewLeft, int textViewTop, int textViewRight, int textViewBottom) { // TODO T62882314: Delete this method when Fabric is fully released in OSS + int reactTag = getId(); if (!(getText() instanceof Spanned) - || ViewUtil.getUIManagerType(getId()) == UIManagerType.FABRIC) { + || ViewUtil.getUIManagerType(reactTag) == UIManagerType.FABRIC) { /** * In general, {@link #setText} is called via {@link ReactTextViewManager#updateExtraData} * before we are laid out. This ordering is a requirement because we utilize the data from @@ -257,9 +257,9 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie WritableMap event = Arguments.createMap(); event.putArray("inlineViews", inlineViewInfoArray2); - reactContext - .getJSModule(RCTEventEmitter.class) - .receiveEvent(getId(), "topInlineViewLayout", event); + if (uiManager != null) { + uiManager.receiveEvent(reactTag, "topInlineViewLayout", event); + } } }