From a08d77468661a2f23211148e56660810add3c226 Mon Sep 17 00:00:00 2001 From: Danilo Ercoli Date: Fri, 29 Jun 2018 11:21:41 +0200 Subject: [PATCH] Slightly changed the code to be sure `setIsSettingTextFromJS` is only called when the text is actually set. --- .../mobile/ReactNativeAztec/ReactAztecManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java b/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java index 8c867ca4727ff1..46629352449989 100644 --- a/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java +++ b/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecManager.java @@ -89,17 +89,21 @@ public Map getExportedCustomBubblingEventTypeConstants() { @ReactProp(name = "text") public void setText(ReactAztecText view, ReadableMap inputMap) { - view.setIsSettingTextFromJS(true); if (!inputMap.hasKey("eventCount")) { - view.fromHtml(inputMap.getString("text")); + setTextfromJS(view, inputMap.getString("text")); } else { // Don't think there is necessity of this branch, but justin case we want to // force a 2nd setText from JS side to Native, just set a high eventCount int eventCount = inputMap.getInt("eventCount"); if (view.mNativeEventCount < eventCount) { - view.fromHtml(inputMap.getString("text")); + setTextfromJS(view, inputMap.getString("text")); } } + } + + private void setTextfromJS(ReactAztecText view, String text) { + view.setIsSettingTextFromJS(true); + view.fromHtml(text); view.setIsSettingTextFromJS(false); }