mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 19:44:13 +00:00
Deprecate UIManagerModule#getEventDispatcher and refactor usages
Reviewed By: shergin Differential Revision: D7832079 fbshipit-source-id: 263a2f8ff96ab6e14b91395644710b4d5f36dc50
This commit is contained in:
parent
a04ad8d8fb
commit
54acf3a431
@ -194,8 +194,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout
|
||||
return;
|
||||
}
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
EventDispatcher eventDispatcher = reactContext.getNativeModule(UIManagerModule.class)
|
||||
.getEventDispatcher();
|
||||
EventDispatcher eventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, eventDispatcher);
|
||||
}
|
||||
|
||||
@ -281,8 +280,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout
|
||||
return;
|
||||
}
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
EventDispatcher eventDispatcher = reactContext.getNativeModule(UIManagerModule.class)
|
||||
.getEventDispatcher();
|
||||
EventDispatcher eventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
mJSTouchDispatcher.handleTouchEvent(event, eventDispatcher);
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,6 @@
|
||||
|
||||
package com.facebook.react.flat;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@ -26,7 +21,6 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
@ -34,11 +28,14 @@ import com.facebook.react.touch.OnInterceptTouchEventListener;
|
||||
import com.facebook.react.touch.ReactHitSlopView;
|
||||
import com.facebook.react.touch.ReactInterceptingViewGroup;
|
||||
import com.facebook.react.uimanager.PointerEvents;
|
||||
import com.facebook.react.uimanager.ReactClippingViewGroup;
|
||||
import com.facebook.react.uimanager.ReactCompoundViewGroup;
|
||||
import com.facebook.react.uimanager.ReactPointerEventsView;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.views.image.ImageLoadEvent;
|
||||
import com.facebook.react.uimanager.ReactClippingViewGroup;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A view that the {@link FlatShadowNode} hierarchy maps to. Can mount and draw native views as
|
||||
@ -129,8 +126,7 @@ import com.facebook.react.uimanager.ReactClippingViewGroup;
|
||||
}
|
||||
|
||||
ReactContext reactContext = ((ReactContext) view.getContext());
|
||||
UIManagerModule uiManagerModule = reactContext.getNativeModule(UIManagerModule.class);
|
||||
uiManagerModule.getEventDispatcher().dispatchEvent(
|
||||
reactContext.<EventDispatcher>getEventDispatcher().dispatchEvent(
|
||||
new ImageLoadEvent(reactTag, imageLoadEvent));
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.react.bridge.EventDispatcher;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.app.Activity;
|
||||
@ -55,4 +56,9 @@ public class ThemedReactContext extends ReactContext {
|
||||
public @Nullable Activity getCurrentActivity() {
|
||||
return mReactApplicationContext.getCurrentActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends EventDispatcher> T getEventDispatcher() {
|
||||
return mReactApplicationContext.getEventDispatcher();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.OnBatchCompleteListener;
|
||||
import com.facebook.react.bridge.PerformanceCounter;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
@ -703,6 +704,10 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
mUIImplementation.setViewHierarchyUpdateDebugListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is deprecated, use {@link ReactContext#getEventDispatcher()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public EventDispatcher getEventDispatcher() {
|
||||
return mEventDispatcher;
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ import android.widget.CompoundButton;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
|
||||
/** View manager for {@link ReactCheckBox} components. */
|
||||
public class ReactCheckBoxManager extends SimpleViewManager<ReactCheckBox> {
|
||||
@ -25,8 +25,7 @@ public class ReactCheckBoxManager extends SimpleViewManager<ReactCheckBox> {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
ReactContext reactContext = (ReactContext) buttonView.getContext();
|
||||
reactContext
|
||||
.getNativeModule(UIManagerModule.class)
|
||||
.getEventDispatcher()
|
||||
.<EventDispatcher>getEventDispatcher()
|
||||
.dispatchEvent(new ReactCheckBoxEvent(buttonView.getId(), isChecked));
|
||||
}
|
||||
};
|
||||
|
@ -7,16 +7,10 @@
|
||||
|
||||
package com.facebook.react.views.drawer;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
import android.os.Build;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
@ -25,7 +19,6 @@ import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewGroupManager;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
@ -33,6 +26,9 @@ import com.facebook.react.views.drawer.events.DrawerClosedEvent;
|
||||
import com.facebook.react.views.drawer.events.DrawerOpenedEvent;
|
||||
import com.facebook.react.views.drawer.events.DrawerSlideEvent;
|
||||
import com.facebook.react.views.drawer.events.DrawerStateChangedEvent;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* View Manager for {@link ReactDrawerLayout} components.
|
||||
@ -55,7 +51,7 @@ public class ReactDrawerLayoutManager extends ViewGroupManager<ReactDrawerLayout
|
||||
view.setDrawerListener(
|
||||
new DrawerEventEmitter(
|
||||
view,
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher()));
|
||||
reactContext.<EventDispatcher>getEventDispatcher()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,6 @@ import com.facebook.drawee.controller.ControllerListener;
|
||||
import com.facebook.drawee.controller.ForwardingControllerListener;
|
||||
import com.facebook.drawee.drawable.AutoRotateDrawable;
|
||||
import com.facebook.drawee.drawable.RoundedColorDrawable;
|
||||
|
||||
import com.facebook.drawee.drawable.ScalingUtils;
|
||||
import com.facebook.drawee.generic.GenericDraweeHierarchy;
|
||||
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
|
||||
@ -51,9 +50,7 @@ import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.modules.fresco.ReactNetworkImageRequest;
|
||||
import com.facebook.react.uimanager.FloatUtil;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.views.image.ImageResizeMode;
|
||||
import com.facebook.react.views.imagehelper.ImageSource;
|
||||
import com.facebook.react.views.imagehelper.MultiSourceHelper;
|
||||
import com.facebook.react.views.imagehelper.MultiSourceHelper.MultiSourceResult;
|
||||
@ -234,8 +231,7 @@ public class ReactImageView extends GenericDraweeView {
|
||||
if (!shouldNotify) {
|
||||
mControllerListener = null;
|
||||
} else {
|
||||
final EventDispatcher mEventDispatcher = ((ReactContext) getContext()).
|
||||
getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
final EventDispatcher mEventDispatcher = ((ReactContext) getContext()).<EventDispatcher>getEventDispatcher();
|
||||
|
||||
mControllerListener = new BaseControllerListener<ImageInfo>() {
|
||||
@Override
|
||||
|
@ -7,18 +7,15 @@
|
||||
|
||||
package com.facebook.react.views.modal;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewGroupManager;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* View manager for {@link ReactModalHostView} components.
|
||||
@ -74,7 +71,7 @@ public class ReactModalHostManager extends ViewGroupManager<ReactModalHostView>
|
||||
ThemedReactContext reactContext,
|
||||
final ReactModalHostView view) {
|
||||
final EventDispatcher dispatcher =
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
reactContext.<EventDispatcher>getEventDispatcher();
|
||||
view.setOnRequestCloseListener(
|
||||
new ReactModalHostView.OnRequestCloseListener() {
|
||||
@Override
|
||||
|
@ -370,7 +370,7 @@ public class ReactModalHostView extends ViewGroup implements LifecycleEventListe
|
||||
|
||||
private EventDispatcher getEventDispatcher() {
|
||||
ReactContext reactContext = getReactContext();
|
||||
return reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
return reactContext.<EventDispatcher>getEventDispatcher();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
package com.facebook.react.views.picker;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -16,17 +14,16 @@ import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.views.picker.events.PickerItemSelectEvent;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* {@link ViewManager} for the {@link ReactPicker} view. This is abstract because the
|
||||
@ -89,7 +86,7 @@ public abstract class ReactPickerManager extends SimpleViewManager<ReactPicker>
|
||||
picker.setOnSelectListener(
|
||||
new PickerEventEmitter(
|
||||
picker,
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher()));
|
||||
reactContext.<EventDispatcher>getEventDispatcher()));
|
||||
}
|
||||
|
||||
private static class ReactPickerAdapter extends ArrayAdapter<ReadableMap> {
|
||||
|
@ -9,10 +9,9 @@ package com.facebook.react.views.scroll;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
|
||||
/**
|
||||
* Helper class that deals with emitting Scroll Events.
|
||||
@ -69,7 +68,7 @@ public class ReactScrollViewHelper {
|
||||
}
|
||||
|
||||
ReactContext reactContext = (ReactContext) scrollView.getContext();
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
reactContext.<EventDispatcher>getEventDispatcher().dispatchEvent(
|
||||
ScrollEvent.obtain(
|
||||
scrollView.getId(),
|
||||
scrollEventType,
|
||||
|
@ -13,21 +13,19 @@ import android.graphics.drawable.LayerDrawable;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.ReactShadowNodeImpl;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.yoga.YogaMeasureFunction;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import com.facebook.yoga.YogaMeasureOutput;
|
||||
import com.facebook.yoga.YogaNode;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -109,7 +107,7 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider> {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekbar, int progress, boolean fromUser) {
|
||||
ReactContext reactContext = (ReactContext) seekbar.getContext();
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
reactContext.<EventDispatcher>getEventDispatcher().dispatchEvent(
|
||||
new ReactSliderEvent(
|
||||
seekbar.getId(),
|
||||
((ReactSlider) seekbar).toRealProgress(progress),
|
||||
@ -123,7 +121,7 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider> {
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekbar) {
|
||||
ReactContext reactContext = (ReactContext) seekbar.getContext();
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
reactContext.<EventDispatcher>getEventDispatcher().dispatchEvent(
|
||||
new ReactSlidingCompleteEvent(
|
||||
seekbar.getId(),
|
||||
((ReactSlider) seekbar).toRealProgress(seekbar.getProgress())));
|
||||
|
@ -7,24 +7,21 @@
|
||||
|
||||
package com.facebook.react.views.swiperefresh;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import static com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager.REACT_CLASS;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
|
||||
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewGroupManager;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
|
||||
import static com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager.REACT_CLASS;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* ViewManager for {@link ReactSwipeRefreshLayout} which allows the user to "pull to refresh" a
|
||||
@ -91,7 +88,7 @@ public class SwipeRefreshLayoutManager extends ViewGroupManager<ReactSwipeRefres
|
||||
new OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher()
|
||||
reactContext.<EventDispatcher>getEventDispatcher()
|
||||
.dispatchEvent(new RefreshEvent(view.getId()));
|
||||
}
|
||||
});
|
||||
|
@ -12,19 +12,18 @@ import android.graphics.PorterDuff;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import com.facebook.react.uimanager.ReactShadowNodeImpl;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import com.facebook.yoga.YogaMeasureFunction;
|
||||
import com.facebook.yoga.YogaNode;
|
||||
import com.facebook.yoga.YogaMeasureOutput;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.ReactShadowNodeImpl;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.yoga.YogaMeasureFunction;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import com.facebook.yoga.YogaMeasureOutput;
|
||||
import com.facebook.yoga.YogaNode;
|
||||
|
||||
/**
|
||||
* View manager for {@link ReactSwitch} components.
|
||||
@ -105,7 +104,7 @@ public class ReactSwitchManager extends SimpleViewManager<ReactSwitch> {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
ReactContext reactContext = (ReactContext) buttonView.getContext();
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher().dispatchEvent(
|
||||
reactContext.<EventDispatcher>getEventDispatcher().dispatchEvent(
|
||||
new ReactSwitchEvent(
|
||||
buttonView.getId(),
|
||||
isChecked));
|
||||
|
@ -7,15 +7,13 @@
|
||||
|
||||
package com.facebook.react.views.textinput;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputConnectionWrapper;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A class to implement the TextInput 'onKeyPress' API on android for soft keyboards.
|
||||
@ -66,7 +64,7 @@ class ReactEditTextInputConnectionWrapper extends InputConnectionWrapper {
|
||||
final ReactEditText editText
|
||||
) {
|
||||
super(target, false);
|
||||
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mEventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
mEditText = editText;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@ import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.Spacing;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
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;
|
||||
@ -694,7 +693,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
public ReactTextInputTextWatcher(
|
||||
final ReactContext reactContext,
|
||||
final ReactEditText editText) {
|
||||
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mEventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
mEditText = editText;
|
||||
mPreviousText = null;
|
||||
}
|
||||
@ -752,7 +751,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
new View.OnFocusChangeListener() {
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
EventDispatcher eventDispatcher =
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
reactContext.<EventDispatcher>getEventDispatcher();
|
||||
if (hasFocus) {
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputFocusEvent(
|
||||
@ -789,7 +788,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
// Additionally we always generate a `submit` event.
|
||||
|
||||
EventDispatcher eventDispatcher =
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
reactContext.<EventDispatcher>getEventDispatcher();
|
||||
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputSubmitEditingEvent(
|
||||
@ -818,7 +817,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
public ReactContentSizeWatcher(ReactEditText editText) {
|
||||
mEditText = editText;
|
||||
ReactContext reactContext = (ReactContext) editText.getContext();
|
||||
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mEventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -857,7 +856,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
public ReactSelectionWatcher(ReactEditText editText) {
|
||||
mReactEditText = editText;
|
||||
ReactContext reactContext = (ReactContext) editText.getContext();
|
||||
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mEventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -889,7 +888,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
public ReactScrollWatcher(ReactEditText editText) {
|
||||
mReactEditText = editText;
|
||||
ReactContext reactContext = (ReactContext) editText.getContext();
|
||||
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mEventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,6 @@ import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewGroupManager;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
@ -118,8 +117,7 @@ public class ReactToolbarManager extends ViewGroupManager<ReactToolbar> {
|
||||
|
||||
@Override
|
||||
protected void addEventEmitters(final ThemedReactContext reactContext, final ReactToolbar view) {
|
||||
final EventDispatcher mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class)
|
||||
.getEventDispatcher();
|
||||
final EventDispatcher mEventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
view.setNavigationOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -15,7 +15,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.uimanager.events.NativeGestureUtil;
|
||||
import java.util.ArrayList;
|
||||
@ -159,7 +158,7 @@ public class ReactViewPager extends ViewPager {
|
||||
|
||||
public ReactViewPager(ReactContext reactContext) {
|
||||
super(reactContext);
|
||||
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
mEventDispatcher = reactContext.<EventDispatcher>getEventDispatcher();
|
||||
mIsCurrentItemFromJs = false;
|
||||
setOnPageChangeListener(new PageChangeListener());
|
||||
setAdapter(new Adapter());
|
||||
|
@ -29,17 +29,15 @@ import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.webkit.ConsoleMessage;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.GeolocationPermissions;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.CookieManager;
|
||||
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
@ -48,11 +46,11 @@ import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.SimpleViewManager;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.ContentSizeChangeEvent;
|
||||
import com.facebook.react.uimanager.events.Event;
|
||||
@ -61,9 +59,14 @@ import com.facebook.react.views.webview.events.TopLoadingErrorEvent;
|
||||
import com.facebook.react.views.webview.events.TopLoadingFinishEvent;
|
||||
import com.facebook.react.views.webview.events.TopLoadingStartEvent;
|
||||
import com.facebook.react.views.webview.events.TopMessageEvent;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Manages instances of {@link WebView}
|
||||
@ -683,7 +686,7 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
||||
protected static void dispatchEvent(WebView webView, Event event) {
|
||||
ReactContext reactContext = (ReactContext) webView.getContext();
|
||||
EventDispatcher eventDispatcher =
|
||||
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
||||
reactContext.<EventDispatcher>getEventDispatcher();
|
||||
eventDispatcher.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user