Java 类com.facebook.react.uimanager.events.RCTEventEmitter 实例源码

项目:react-native-twitterkit    文件:TweetView.java   
private void handleError() {
  LogUtils.d(TAG, "handleError");
  if(tweetView != null) {
    tweetView.setVisibility(View.INVISIBLE);
  }

  WritableMap evt = Arguments.createMap();
  evt.putString("message", "Could not load tweet");

  ReactContext ctx = (ReactContext) getContext();
  ctx.getJSModule(RCTEventEmitter.class).receiveEvent(
          getId(),
          "onLoadError",
          evt);

}
项目:react-native-android-piliplayer    文件:PLVideoTextureViewManager.java   
@Override
protected PLVideoTextureView createViewInstance(ThemedReactContext reactContext) {
    themedReactContext = reactContext;
    LayoutInflater inflater=LayoutInflater.from(reactContext);
    mEventEmitter=reactContext.getJSModule(RCTEventEmitter.class);
    //plVideoTextureView=(PLVideoTextureView) inflater.inflate(R.layout.video_view,null);
    plVideoTextureView=new PLVideoTextureView(reactContext);
    plVideoTextureView.setOnPreparedListener(mOnPreparedListener);
    plVideoTextureView.setOnInfoListener(mOnInfoListener);
    plVideoTextureView.setOnErrorListener(mOnErrorListener);
    plVideoTextureView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
    plVideoTextureView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
    plVideoTextureView.setOnCompletionListener(mOnCompletionListener);
    plVideoTextureView.setOnSeekCompleteListener(mOnSeekCompleteListener);
    reactContext.addLifecycleEventListener(this);//监听LifecycleEventListener的生命周期需要添加这句
    return plVideoTextureView;
}
项目:pili-react-native    文件:PiliPlayerViewManager.java   
@Override
protected PLVideoView createViewInstance(ThemedReactContext reactContext) {
    this.reactContext = reactContext;
    mEventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
    mVideoView = new PLVideoView(reactContext);
    // Set some listeners
    mVideoView.setOnPreparedListener(mOnPreparedListener);
    mVideoView.setOnInfoListener(mOnInfoListener);
    mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
    mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
    mVideoView.setOnCompletionListener(mOnCompletionListener);
    mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
    mVideoView.setOnErrorListener(mOnErrorListener);

    reactContext.addLifecycleEventListener(this);
    return mVideoView;
}
项目:react-native-android-bottom-navigation    文件:RNBottomNavigationManager.java   
@Override
protected RNBottomNavigation createViewInstance(final ThemedReactContext reactContext) {
    final RNBottomNavigation bottomNavigation = new RNBottomNavigation(reactContext);

    bottomNavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            WritableMap event = Arguments.createMap();
            event.putInt("selectedPosition", item.getOrder());
            reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
                    bottomNavigation.getId(),
                    "topChange",
                    event
            );

            return true;
        }
    });

    return bottomNavigation;
}
项目:react-native-fast-image    文件:FastImageViewManager.java   
@Override
public boolean onException(
        Exception e,
        GlideUrl uri,
        Target<GlideDrawable> target,
        boolean isFirstResource
) {
    OkHttpProgressGlideModule.forget(uri.toStringUrl());
    if (!(target instanceof ImageViewTarget)) {
        return false;
    }
    ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
    ThemedReactContext context = (ThemedReactContext) view.getContext();
    RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
    int viewId = view.getId();
    eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
    return false;
}
项目:react-native-fast-image    文件:FastImageViewManager.java   
@Override
public boolean onResourceReady(
        GlideDrawable resource,
        GlideUrl uri,
        Target<GlideDrawable> target,
        boolean isFromMemoryCache,
        boolean isFirstResource
) {
    if (!(target instanceof ImageViewTarget)) {
        return false;
    }
    ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
    ThemedReactContext context = (ThemedReactContext) view.getContext();
    RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
    int viewId = view.getId();
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, new WritableNativeMap());
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
    return false;
}
项目:react-native-pili-live    文件:PiliPlayerViewManager.java   
@Override
protected PLVideoView createViewInstance(ThemedReactContext reactContext) {
    this.reactContext = reactContext;
    mEventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
    mVideoView = new PLVideoView(reactContext);
    // Set some listeners
    mVideoView.setOnPreparedListener(mOnPreparedListener);
    mVideoView.setOnInfoListener(mOnInfoListener);
    mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
    mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
    mVideoView.setOnCompletionListener(mOnCompletionListener);
    mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
    mVideoView.setOnErrorListener(mOnErrorListener);

    reactContext.addLifecycleEventListener(this);
    return mVideoView;
}
项目:RNLearn_Project1    文件:ImageLoadEvent.java   
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
  WritableMap eventData = null;

  if (mImageUri != null || mEventType == ON_LOAD) {
    eventData = Arguments.createMap();

    if (mImageUri != null) {
      eventData.putString("uri", mImageUri);
    }

    if (mEventType == ON_LOAD) {
      WritableMap source = Arguments.createMap();
      source.putDouble("width", mWidth);
      source.putDouble("height", mHeight);
      if (mImageUri != null) {
        source.putString("url", mImageUri);
      }
      eventData.putMap("source", source);
    }
  }

  rctEventEmitter.receiveEvent(getViewTag(), getEventName(), eventData);
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:RNLearn_Project1    文件:ImageLoadEvent.java   
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
  WritableMap eventData = null;

  if (mImageUri != null || mEventType == ON_LOAD) {
    eventData = Arguments.createMap();

    if (mImageUri != null) {
      eventData.putString("uri", mImageUri);
    }

    if (mEventType == ON_LOAD) {
      WritableMap source = Arguments.createMap();
      source.putDouble("width", mWidth);
      source.putDouble("height", mHeight);
      if (mImageUri != null) {
        source.putString("url", mImageUri);
      }
      eventData.putMap("source", source);
    }
  }

  rctEventEmitter.receiveEvent(getViewTag(), getEventName(), eventData);
}
项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目:react-native-material-calendarview    文件:ReactMaterialCalendarView.java   
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
    @SuppressLint("SimpleDateFormat") SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    Calendar calendar = date.getCalendar();
    WritableMap event = Arguments.createMap();
    event.putString("date", df.format(calendar.getTime()));
    event.putBoolean("selected", selected);
    ReactContext reactContext = (ReactContext) getContext();
    reactContext
            .getJSModule(RCTEventEmitter.class)
            .receiveEvent(
                    getId(),
                    "topDateChange",
                    event
            );
}
项目:react-native-web-image    文件:WebImageView.java   
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
    super.onLoadFailed(e, errorDrawable);
    ThemedReactContext context = view.getThemedReactContext();
    if (context != null) {
        WritableMap event = Arguments.createMap();
        if (e != null) {
            event.putString("error", e.getMessage());
        } else {
            event.putString("error", "Unknown");
        }
        final Uri uri = view.getImageUri();
        if (uri != null) {
            event.putString("uri", uri.toString());
        }
        context.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "onWebImageError", event);
    }
}
项目:react-native-pili    文件:PiliPlayerViewManager.java   
@Override
protected PLVideoView createViewInstance(ThemedReactContext reactContext) {
    this.reactContext = reactContext;
    mEventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
    mVideoView = new PLVideoView(reactContext);
    // Set some listeners
    mVideoView.setOnPreparedListener(mOnPreparedListener);
    mVideoView.setOnInfoListener(mOnInfoListener);
    mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
    mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
    mVideoView.setOnCompletionListener(mOnCompletionListener);
    mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
    mVideoView.setOnErrorListener(mOnErrorListener);

    reactContext.addLifecycleEventListener(this);
    return mVideoView;
}
项目:react-native-video    文件:RCTVideoView.java   
public RCTVideoView(ThemedReactContext themedReactContext) {
    super(themedReactContext);
    mEventEmitter = themedReactContext.getJSModule(RCTEventEmitter.class);
    Vitamio.isInitialized(themedReactContext);

    mProgressUpdateRunnable = new Runnable() {
        @Override
        public void run() {

            if (mMediaPlayerValid) {
                WritableMap event = Arguments.createMap();
                event.putDouble(EVENT_PROP_CURRENT_TIME, getCurrentPosition() / 1000.0);
                event.putDouble(EVENT_PROP_PLAYABLE_DURATION, mVideoBufferedDuration / 1000.0);
                mEventEmitter.receiveEvent(getId(), Events.EVENT_PROGRESS.toString(), event);
            }
            mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable, 250);
        }
    };
    mProgressUpdateHandler.post(mProgressUpdateRunnable);
}
项目:react-native-maps    文件:PPTGoogleMapManager.java   
/**
 * Called after a tap gesture at a particular coordinate, but only if a marker was not tapped.
 *
 * @param latLng
 */
@Override
public void onMapClick(LatLng latLng) {
    WritableMap event = Arguments.createMap();
    WritableMap data = Arguments.createMap();

    data.putDouble("latitude", latLng.latitude);
    data.putDouble("longitude", latLng.longitude);

    event.putString("event", "didTapAtCoordinate");
    event.putMap("data", data);

    reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
            mapView.getId(),
            "topChange",
            event
    );
}
项目:react-native-maps    文件:PPTGoogleMapManager.java   
/**
 * Handles marker events by emitting react events.
 *
 * @param eventName
 * @param marker
 */
private void handleMarkerEvent(String eventName, Marker marker) {
    WritableMap event = Arguments.createMap();
    WritableMap data = Arguments.createMap();

    data.putDouble("latitude", marker.getPosition().latitude);
    data.putDouble("longitude", marker.getPosition().longitude);
    data.putString("publicId", publicMarkerIds.get(marker.getId()));

    event.putString("event", "didTapMarker");
    event.putMap("data", data);

    reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
            mapView.getId(),
            "topChange",
            event
    );
}
项目:react-native-camera-master    文件:CameraView.java   
@Override
protected void onImageFileSaved(String imagePath) {
    super.onImageFileSaved(imagePath);
    WritableMap event = Arguments.createMap();
    event.putString("message", "file://" + imagePath);
    event.putString("type", "camera_capture");
    ReactContext reactContext = (ReactContext)getContext();
    reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
            getId(),
            "topChange",
            event
    );

    stopCamera();
    startCamera();
}
项目:aurora-imui    文件:ReactChatInputManager.java   
private void initMenu(float density) {
    mShowMenu = true;
    if (mChatInput.getSoftInputState()) {
        EmoticonsKeyboardUtils.closeSoftKeyboard(mChatInput.getInputView());
    }
    if (mChatInput.getSoftInputState() || mChatInput.getMenuState() == View.VISIBLE) {
        EventBus.getDefault().post(new ScrollEvent(false));
    } else {
        EventBus.getDefault().post(new ScrollEvent(true));
    }
    WritableMap event = Arguments.createMap();
    if (mChatInput.getSoftKeyboardHeight() == 0) {
        event.putDouble("height", mInitialChatInputHeight + mMenuContainerHeight / density);
    } else {
        event.putDouble("height", mInitialChatInputHeight + mChatInput.getSoftKeyboardHeight() / density);
    }
    mContext.getJSModule(RCTEventEmitter.class).receiveEvent(mChatInput.getId(), ON_INPUT_SIZE_CHANGED_EVENT, event);
}
项目:react-native-yandexmapkit    文件:RNYandexMapKitView.java   
@Override
public boolean onFinishGeoCode(GeoCode geoCode) {
    if (geoCode != null) {
        WritableMap payload = Arguments.createMap();
        payload.putString("displayName", geoCode.getDisplayName());
        payload.putString("kind", geoCode.getKind());
        payload.putString("title", geoCode.getTitle());
        payload.putString("subtitle", geoCode.getSubtitle());
        WritableMap point = Arguments.createMap();
        GeoPoint geoPoint = geoCode.getGeoPoint();
        point.putDouble("latitude", geoPoint.getLat());
        point.putDouble("longitude", geoPoint.getLon());
        payload.putMap("point", point);

        ReactContext reactContext = (ReactContext) getContext();
        reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(this.getId(), GEOCODING_EVENT, payload);
    }
    return true;
}
项目:react-native-videoplayer    文件:ReactVideoView.java   
public ReactVideoView(ThemedReactContext themedReactContext) {
    super(themedReactContext);

    mThemedReactContext = themedReactContext;
    mEventEmitter = themedReactContext.getJSModule(RCTEventEmitter.class);
    themedReactContext.addLifecycleEventListener(this);

    initializeMediaPlayerIfNeeded();
    setSurfaceTextureListener(this);

    mProgressUpdateRunnable = new Runnable() {
        @Override
        public void run() {

            if (mMediaPlayerValid && !isCompleted &&!mPaused) {
                WritableMap event = Arguments.createMap();
                event.putDouble(EVENT_PROP_CURRENT_TIME, mMediaPlayer.getCurrentPosition() / 1000.0);
                event.putDouble(EVENT_PROP_PLAYABLE_DURATION, mVideoBufferedDuration / 1000.0); //TODO:mBufferUpdateRunnable
                mEventEmitter.receiveEvent(getId(), Events.EVENT_PROGRESS.toString(), event);

                // Check for update after an interval
                // TODO: The update interval is fixed at 250. There is a property in React component that defines this value. Totally ignored !!!
                mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable, 250);
            }
        }
    };
}
项目:react-native-pdf-viewer    文件:PdfView.java   
@Override
public void loadComplete(int pageCount) {
    WritableMap event = Arguments.createMap();
    event.putString("message", String.valueOf(pageCount));
    ReactContext reactContext = (ReactContext) this.getContext();
    reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
            this.getId(),
            "topChange",
            event
    );
}
项目:react-native-twitterkit    文件:TweetView.java   
private void handleSuccess() {
  WritableMap evt = Arguments.createMap();

  ReactContext ctx = (ReactContext) getContext();
  ctx.getJSModule(RCTEventEmitter.class).receiveEvent(
          getId(),
          "onLoadSuccess",
          evt);
}
项目:react-native-collapsing-toolbar    文件:AppBarLayoutManager.java   
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
    WritableMap event = Arguments.createMap();
    event.putDouble("offset", verticalOffset);
    ReactContext reactContext = (ReactContext) appBarLayout.getContext();
    reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(appBarLayout.getId(), "topOffsetChanged", event);
}
项目:react-native-sketch-view    文件:RNSketchViewManager.java   
private void sendEvent(View view, String eventType, WritableMap event) {
  WritableMap nativeEvent = Arguments.createMap();
  nativeEvent.putString("type", eventType);
  nativeEvent.putMap("event", event);
  ReactContext reactContext = (ReactContext) view.getContext();
  reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(view.getId(), "topChange", nativeEvent);
}
项目:react-native-recyclerview-list    文件:ContentSizeChangeEvent.java   
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
  WritableMap data = Arguments.createMap();
  data.putDouble("width", PixelUtil.toDIPFromPixel(mWidth));
  data.putDouble("height", PixelUtil.toDIPFromPixel(mHeight));
  rctEventEmitter.receiveEvent(getViewTag(), EVENT_NAME, data);
}
项目:react-native-recyclerview-list    文件:VisibleItemsChangeEvent.java   
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
    WritableMap data = Arguments.createMap();
    data.putInt("firstIndex", mFirstIndex);
    data.putInt("lastIndex", mLastIndex);
    rctEventEmitter.receiveEvent(getViewTag(), EVENT_NAME, data);
}
项目:react-native-pili-player    文件:PiliLiveViewManager.java   
@Override
protected PLVideoView createViewInstance(ThemedReactContext reactContext) {
    this.reactContext = reactContext;
    mEventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
    mVideoView = new PLVideoView(reactContext);
    // Set some listeners
    mVideoView.setOnPreparedListener(mOnPreparedListener);
    mVideoView.setOnInfoListener(mOnInfoListener);
    mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
    mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
    mVideoView.setOnCompletionListener(mOnCompletionListener);
    mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
    mVideoView.setOnErrorListener(mOnErrorListener);

    reactContext.addLifecycleEventListener(this);
    mProgressUpdateRunnable=new Runnable() {
        @Override
        public void run() {
            if(mVideoView.isPlaying()){
                WritableMap event = Arguments.createMap();
                event.putDouble("currentTime", mVideoView.getCurrentPosition()/1000);
                mEventEmitter.receiveEvent(getTargetId(), PiliPlayerViewManager.Events.PROGRESS.toString(), event);
                mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable,1000);
            }
        }
    };
    return mVideoView;
}
项目:react-native-pili-player    文件:PiliPlayerViewManager.java   
@Override
protected PLVideoView createViewInstance(ThemedReactContext reactContext) {
    this.reactContext = reactContext;
    mEventEmitter = reactContext.getJSModule(RCTEventEmitter.class);

    mVideoView = new PLVideoView(reactContext);

    // Set some listeners
    mVideoView.setOnPreparedListener(mOnPreparedListener);
    mVideoView.setOnInfoListener(mOnInfoListener);
    mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
    mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
    mVideoView.setOnCompletionListener(mOnCompletionListener);
    mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
    mVideoView.setOnErrorListener(mOnErrorListener);
    reactContext.addLifecycleEventListener(this);
    mProgressUpdateRunnable=new Runnable() {
        @Override
        public void run() {
            if(mVideoView.isPlaying()){
                WritableMap event = Arguments.createMap();
                event.putDouble("currentTime", mVideoView.getCurrentPosition()/1000);
                event.putDouble("totalTime", mVideoView.getDuration()/1000); //TODO:mBufferUpdateRunnable
                mEventEmitter.receiveEvent(getTargetId(), Events.PROGRESS.toString(), event);
                mProgressUpdateHandler.postDelayed(mProgressUpdateRunnable,1000);
            }
        }
    };
    return mVideoView;
}
项目:react-native-android-material-calendar-view    文件:MaterialCalendarViewManager.java   
public void onReceiveNativeEvent(final ThemedReactContext reactContext, final MaterialCalendarView materialCalendarView) {
    materialCalendarView.setOnDateChangedListener(new OnDateSelectedListener() {
        @Override
        public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
            WritableMap event = Arguments.createMap();
            event.putString("date", date.getDate().toString());
            event.putInt("day", date.getDay());
            event.putInt("month", date.getMonth());
            event.putInt("year", date.getYear());
            reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(materialCalendarView.getId(), "topChange", event);
        }
    });
}
项目:react-native-fast-image    文件:FastImageViewManager.java   
@Override
public void onProgress(String key, long bytesRead, long expectedLength) {
    List<ImageViewWithUrl> viewsForKey = VIEWS_FOR_URLS.get(key);
    if (viewsForKey != null) {
        for (ImageViewWithUrl view: viewsForKey) {
            WritableMap event = new WritableNativeMap();
            event.putInt("loaded", (int) bytesRead);
            event.putInt("total", (int) expectedLength);
            ThemedReactContext context = (ThemedReactContext) view.getContext();
            RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
            int viewId = view.getId();
            eventEmitter.receiveEvent(viewId, REACT_ON_PROGRESS_EVENT, event);
        }
    }
}
项目:RNLearn_Project1    文件:OnLayoutEvent.java   
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
  WritableMap layout = Arguments.createMap();
  layout.putDouble("x", PixelUtil.toDIPFromPixel(mX));
  layout.putDouble("y", PixelUtil.toDIPFromPixel(mY));
  layout.putDouble("width", PixelUtil.toDIPFromPixel(mWidth));
  layout.putDouble("height", PixelUtil.toDIPFromPixel(mHeight));

  WritableMap event = Arguments.createMap();
  event.putMap("layout", layout);
  event.putInt("target", getViewTag());

  rctEventEmitter.receiveEvent(getViewTag(), getEventName(), event);
}
项目:RNLearn_Project1    文件:NativeAnimatedNodeTraversalTest.java   
private Event createScrollEvent(final int tag, final double value) {
  return new Event(tag) {
    @Override
    public String getEventName() {
      return "topScroll";
    }

    @Override
    public void dispatch(RCTEventEmitter rctEventEmitter) {
      rctEventEmitter.receiveEvent(tag, "topScroll", JavaOnlyMap.of(
        "contentOffset", JavaOnlyMap.of("y", value)));
    }
  };
}
项目:RNLearn_Project1    文件:OnLayoutEvent.java   
@Override
public void dispatch(RCTEventEmitter rctEventEmitter) {
  WritableMap layout = Arguments.createMap();
  layout.putDouble("x", PixelUtil.toDIPFromPixel(mX));
  layout.putDouble("y", PixelUtil.toDIPFromPixel(mY));
  layout.putDouble("width", PixelUtil.toDIPFromPixel(mWidth));
  layout.putDouble("height", PixelUtil.toDIPFromPixel(mHeight));

  WritableMap event = Arguments.createMap();
  event.putMap("layout", layout);
  event.putInt("target", getViewTag());

  rctEventEmitter.receiveEvent(getViewTag(), getEventName(), event);
}
项目:RNLearn_Project1    文件:NativeAnimatedNodeTraversalTest.java   
private Event createScrollEvent(final int tag, final double value) {
  return new Event(tag) {
    @Override
    public String getEventName() {
      return "topScroll";
    }

    @Override
    public void dispatch(RCTEventEmitter rctEventEmitter) {
      rctEventEmitter.receiveEvent(tag, "topScroll", JavaOnlyMap.of(
        "contentOffset", JavaOnlyMap.of("y", value)));
    }
  };
}
项目:aurora-imui    文件:ReactChatInputManager.java   
@Override
public void receiveCommand(ChatInputView root, int commandId, @Nullable ReadableArray args) {
    switch (commandId){
        case CLOSE_SOFT_INPUT:
            EmoticonsKeyboardUtils.closeSoftKeyboard(root.getInputView());
            break;
        case GET_INPUT_TEXT:
            EventBus.getDefault().post(new GetTextEvent(root.getInputView().getText().toString(),
                    AuroraIMUIModule.GET_INPUT_TEXT_EVENT));
            break;
        case RESET_MENU_STATE:
            try {
                WritableMap event = Arguments.createMap();
                mShowMenu = args.getBoolean(0);
                float dp = mContext.getResources().getDisplayMetrics().density;
                mContext.getCurrentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
                if (mInitState) {
                    event.putDouble("height", mInitialChatInputHeight);
                } else {
                    event.putDouble("height", calculateMenuHeight(dp));
                }
                mContext.getJSModule(RCTEventEmitter.class).receiveEvent(mChatInput.getId(), ON_INPUT_SIZE_CHANGED_EVENT, event);
            } catch (Exception e) {
                e.printStackTrace();
            }
            break;
    }
}
项目:ReactNativeSignatureExample    文件:RSSignatureCaptureMainView.java   
@Override public void onDragged() {
  WritableMap event = Arguments.createMap();
  event.putBoolean("dragged", true);
  ReactContext reactContext = (ReactContext) getContext();
  reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topChange", event);

}
项目:react-native-imagewand    文件:RNImageWand.java   
public void onImageInfo(int width, int height) {
    Log.d("abc","Emitting image info");
    WritableMap event = Arguments.createMap();
    event.putInt("width", width);
    event.putInt("height", height);
    ReactContext reactContext = (ReactContext)getContext();
    reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
            getId(),
            "topChange",
            event);
}
项目:react-native-bottom-sheet-behavior    文件:BottomSheetBehaviorManager.java   
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
    WritableMap event = Arguments.createMap();
    event.putDouble("offset", slideOffset);
    ReactContext reactContext = (ReactContext) bottomSheet.getContext();
    reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(bottomSheet.getId(), "topSlide", event);
}
项目:react-native-box-loaders    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class,
      JSCHeapCapture.HeapCapture.class,
      DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
}