mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputEvent Event class
Summary: Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one. Changelog: [Internal] Reviewed By: PeteTheHeat, mdvacca Differential Revision: D26056680 fbshipit-source-id: 2a57f15c01a585af9ddbe08cf6dd60922d4f64b3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
346b1f1df4
commit
a5a94ce786
+3
-13
@@ -7,11 +7,10 @@
|
||||
|
||||
package com.facebook.react.views.textinput;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
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
|
||||
@@ -52,18 +51,9 @@ public class ReactTextInputEvent extends Event<ReactTextInputEvent> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@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() {
|
||||
protected WritableMap getEventData() {
|
||||
WritableMap eventData = Arguments.createMap();
|
||||
WritableMap range = Arguments.createMap();
|
||||
range.putDouble("start", mRangeStart);
|
||||
|
||||
Reference in New Issue
Block a user