-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Back out "chore: Remove deprecated onTextInput callback"
Summary: Original commit changeset: 89101fa53cdc Original Phabricator Diff: D56804590 Changelog: [IOS] [Added] - Un-removed deprecated onTextInput callback Reviewed By: realsoelynn Differential Revision: D57082228 fbshipit-source-id: 30d62164788b94a9f3193bf78a7bee0c7ce464f6
- Loading branch information
1 parent
9da6546
commit deee037
Showing
11 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...ve/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and 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 androidx.annotation.Nullable; | ||
import com.facebook.react.bridge.Arguments; | ||
import com.facebook.react.bridge.WritableMap; | ||
import com.facebook.react.uimanager.common.ViewUtil; | ||
import com.facebook.react.uimanager.events.Event; | ||
|
||
/** | ||
* Event emitted by EditText native view when text changes. VisibleForTesting from {@link | ||
* TextInputEventsTestCase}. | ||
*/ | ||
public class ReactTextInputEvent extends Event<ReactTextInputEvent> { | ||
|
||
public static final String EVENT_NAME = "topTextInput"; | ||
|
||
private String mText; | ||
private String mPreviousText; | ||
private int mRangeStart; | ||
private int mRangeEnd; | ||
|
||
@Deprecated | ||
public ReactTextInputEvent( | ||
int viewId, String text, String previousText, int rangeStart, int rangeEnd) { | ||
this(ViewUtil.NO_SURFACE_ID, viewId, text, previousText, rangeStart, rangeEnd); | ||
} | ||
|
||
public ReactTextInputEvent( | ||
int surfaceId, int viewId, String text, String previousText, int rangeStart, int rangeEnd) { | ||
super(surfaceId, viewId); | ||
mText = text; | ||
mPreviousText = previousText; | ||
mRangeStart = rangeStart; | ||
mRangeEnd = rangeEnd; | ||
} | ||
|
||
@Override | ||
public String getEventName() { | ||
return EVENT_NAME; | ||
} | ||
|
||
@Override | ||
public boolean canCoalesce() { | ||
// We don't want to miss any textinput event, as event data is incremental. | ||
return false; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
protected WritableMap getEventData() { | ||
WritableMap eventData = Arguments.createMap(); | ||
WritableMap range = Arguments.createMap(); | ||
range.putDouble("start", mRangeStart); | ||
range.putDouble("end", mRangeEnd); | ||
|
||
eventData.putString("text", mText); | ||
eventData.putString("previousText", mPreviousText); | ||
eventData.putMap("range", range); | ||
|
||
eventData.putInt("target", getViewTag()); | ||
return eventData; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters