Skip to content

Commit

Permalink
Revert D19456326: Migrate ReactTextInputManager to be bridgeless
Browse files Browse the repository at this point in the history
Differential Revision:
D19456326

Original commit changeset: 5e9643793cd7

fbshipit-source-id: 07d23cc25c4ba242a8b8c04ac5e76d9c9656186d
  • Loading branch information
rratmansky authored and facebook-github-bot committed Jan 28, 2020
1 parent af1762c commit f8a75d5
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
import com.facebook.react.uimanager.Spacing;
import com.facebook.react.uimanager.StateWrapper;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIManagerHelper;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewDefaults;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;
Expand Down Expand Up @@ -848,11 +848,6 @@ private static void updateStagedInputTypeFlag(
view.setStagedInputType((view.getStagedInputType() & ~flagsToUnset) | flagsToSet);
}

private static EventDispatcher getEventDispatcher(
ReactContext reactContext, ReactEditText editText) {
return UIManagerHelper.getEventDispatcherForReactTag(reactContext, editText.getId());
}

private class ReactTextInputTextWatcher implements TextWatcher {

private EventDispatcher mEventDispatcher;
Expand All @@ -861,7 +856,7 @@ private class ReactTextInputTextWatcher implements TextWatcher {

public ReactTextInputTextWatcher(
final ReactContext reactContext, final ReactEditText editText) {
mEventDispatcher = getEventDispatcher(reactContext, editText);
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
mEditText = editText;
mPreviousText = null;
}
Expand Down Expand Up @@ -999,7 +994,8 @@ protected void addEventEmitters(
editText.setOnFocusChangeListener(
new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
EventDispatcher eventDispatcher = getEventDispatcher(reactContext, editText);
EventDispatcher eventDispatcher =
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
if (hasFocus) {
eventDispatcher.dispatchEvent(new ReactTextInputFocusEvent(editText.getId()));
} else {
Expand Down Expand Up @@ -1029,7 +1025,8 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent) {
// * !blurOnSubmit && !isMultiline => Prevent default behaviour (return true).
// Additionally we always generate a `submit` event.

EventDispatcher eventDispatcher = getEventDispatcher(reactContext, editText);
EventDispatcher eventDispatcher =
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();

eventDispatcher.dispatchEvent(
new ReactTextInputSubmitEditingEvent(
Expand Down Expand Up @@ -1070,7 +1067,7 @@ private class ReactContentSizeWatcher implements ContentSizeWatcher {
public ReactContentSizeWatcher(ReactEditText editText) {
mEditText = editText;
ReactContext reactContext = getReactContext(editText);
mEventDispatcher = getEventDispatcher(reactContext, editText);
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
}

@Override
Expand Down Expand Up @@ -1114,7 +1111,7 @@ public ReactSelectionWatcher(ReactEditText editText) {
mReactEditText = editText;

ReactContext reactContext = getReactContext(editText);
mEventDispatcher = getEventDispatcher(reactContext, editText);
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
}

@Override
Expand Down Expand Up @@ -1148,7 +1145,7 @@ private class ReactScrollWatcher implements ScrollWatcher {
public ReactScrollWatcher(ReactEditText editText) {
mReactEditText = editText;
ReactContext reactContext = getReactContext(editText);
mEventDispatcher = getEventDispatcher(reactContext, editText);
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
}

@Override
Expand Down

0 comments on commit f8a75d5

Please sign in to comment.