From d49f696f6e3a2cbcc30d1068d40fd5585ac2acbc Mon Sep 17 00:00:00 2001 From: Vince Mi Date: Wed, 15 Aug 2018 21:53:11 -0700 Subject: [PATCH] Add EditText View param to TextChangedEvent --- .../src/main/java/com/facebook/litho/widget/EditTextSpec.java | 2 +- .../main/java/com/facebook/litho/widget/TextChangedEvent.java | 3 +++ .../src/main/java/com/facebook/litho/widget/TextInputSpec.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/EditTextSpec.java b/litho-widget/src/main/java/com/facebook/litho/widget/EditTextSpec.java index a38758a4051..c2330a2c272 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/EditTextSpec.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/EditTextSpec.java @@ -741,7 +741,7 @@ public void afterTextChanged(Editable s) { } if (mTextChangedEventHandler != null) { com.facebook.litho.widget.EditText.dispatchTextChangedEvent( - mTextChangedEventHandler, s.toString()); + mTextChangedEventHandler, EditTextWithEventHandlers.this, s.toString()); } } } diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextChangedEvent.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextChangedEvent.java index 31e078f9ce8..b97f13f3ec7 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextChangedEvent.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextChangedEvent.java @@ -16,6 +16,7 @@ package com.facebook.litho.widget; +import android.widget.EditText; import com.facebook.litho.annotations.Event; /** @@ -23,5 +24,7 @@ */ @Event public class TextChangedEvent { + + public EditText view; public String text; } diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java index 6904923fa5d..cfb018bb05b 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java @@ -484,7 +484,7 @@ public EditTextWithEventHandlers(Context context) { protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { super.onTextChanged(text, start, lengthBefore, lengthAfter); if (mTextChangedEventHandler != null) { - TextInput.dispatchTextChangedEvent(mTextChangedEventHandler, text.toString()); + TextInput.dispatchTextChangedEvent(mTextChangedEventHandler, EditTextWithEventHandlers.this, text.toString()); } }