/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.react.views.textinput;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.events.Event;
import com.facebook.react.uimanager.events.RCTEventEmitter;
import com.facebook.react.uimanager.events.RCTModernEventEmitter;

/**
 * Event emitted by EditText native view when text changes. VisibleForTesting from {@link
 * TextInputEventsTestCase}.
 */
public class ReactTextChangedEvent extends Event<ReactTextChangedEvent> {

  public static final String EVENT_NAME = "topChange";

  private String mText;
  private int mEventCount;

  @Deprecated
  public ReactTextChangedEvent(int viewId, String text, int eventCount) {
    this(-1, viewId, text, eventCount);
  }

  public ReactTextChangedEvent(int surfaceId, int viewId, String text, int eventCount) {
    super(surfaceId, viewId);
    mText = text;
    mEventCount = eventCount;
  }

  @Override
  public String getEventName() {
    return EVENT_NAME;
  }

  @Override
  public void dispatch(RCTEventEmitter rctEventEmitter) {
    rctEventEmitter.receiveEvent(getViewTag(), getEventName(), serializeEventData());
  }

  @Override
  public void dispatchModern(RCTModernEventEmitter rctEventEmitter) {
    rctEventEmitter.receiveEvent(
        getSurfaceId(), getViewTag(), getEventName(), serializeEventData());
  }

  private WritableMap serializeEventData() {
    WritableMap eventData = Arguments.createMap();
    eventData.putString("text", mText);
    eventData.putInt("eventCount", mEventCount);
    eventData.putInt("target", getViewTag());
    return eventData;
  }
}

@@ -227,16 +227,53 @@
 input;%0A%0A
+import androidx.annotation.Nullable;%0A
 import c
@@ -407,134 +407,8 @@
 ent;
-%0Aimport com.facebook.react.uimanager.events.RCTEventEmitter;%0Aimport com.facebook.react.uimanager.events.RCTModernEventEmitter;
 %0A%0A/*
@@ -1100,373 +1100,40 @@
 %0A  @
-Override%0A  public void dispatch(RCTEventEmitter rctEventEmitter) %7B%0A    rctEventEmitter.receiveEvent(getViewTag(), getEventName(), serializeEventData());%0A  %7D%0A%0A  @Override%0A  public void dispatchModern(RCTModernEventEmitter rctEventEmitter) %7B%0A    rctEventEmitter.receiveEvent(%0A        getSurfaceId(), getViewTag(), getEventName(), serializeEventData());%0A  %7D%0A%0A  private
+Nullable%0A  @Override%0A  protected
  Wri
@@ -1145,17 +1145,11 @@
 Map 
-serialize
+get
 Even

Support RCTModernEventEmitter+RCTEventEmitter in ReactTextChangedEvent Event class