com.facebook.react.uimanager.events.RCTEventEmitter Java Examples
The following examples show how to use
com.facebook.react.uimanager.events.RCTEventEmitter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RNRtmpView.java From react-native-rtmpview with MIT License | 6 votes |
public void onPlaybackStateChanged(RNRtmpPlaybackState playbackState, Throwable error) { WritableMap event = Arguments.createMap(); event.putString("state", playbackState.getFieldDescription()); event.putInt("playback_state", mPlayer.getPlaybackState()); event.putBoolean("play_when_ready", mPlayer.getPlayWhenReady()); if (error != null) { event.putString("error", error.toString()); } event.putMap("qos", getQos()); ReactContext reactContext = (ReactContext)getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent( getId(), Events.EVENT_PLAYBACK_STATE.toString(), event); }
Example #2
Source File: WheelChangeListenerImpl.java From react-native-date-picker with MIT License | 6 votes |
@Override public void onChange(Wheel picker) { WritableMap event = Arguments.createMap(); TimeZone timeZone = state.getTimeZone(); SimpleDateFormat dateFormat = uiManager.getDateFormat(); Calendar minDate = state.getMinimumDate(); Calendar maxDate = state.getMaximumDate(); try { dateFormat.setTimeZone(timeZone); Calendar date = Calendar.getInstance(timeZone); String toParse = wheels.getDateString(); Date newDate = dateFormat.parse(toParse); date.setTime(newDate); if (minDate != null && date.before(minDate)) uiManager.animateToDate(minDate); else if (maxDate != null && date.after(maxDate)) uiManager.animateToDate(maxDate); else { event.putString("date", Utils.dateToIso(date)); event.putString("dateString", uiManager.getDateString()); DatePickerManager.context.getJSModule(RCTEventEmitter.class) .receiveEvent(rootView.getId(), "dateChange", event); } } catch (ParseException e) { e.printStackTrace(); } }
Example #3
Source File: ImageLoadEvent.java From react-native-GPay with MIT License | 6 votes |
@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); }
Example #4
Source File: OnLayoutEvent.java From react-native-GPay with MIT License | 5 votes |
@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); }
Example #5
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onTime(TimeEvent timeEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onTime"); event.putDouble("position", timeEvent.getPosition()); event.putDouble("duration", timeEvent.getDuration()); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topTime", event); }
Example #6
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onPause(PauseEvent pauseEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onPause"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topPause", event); updateWakeLock(false); if (!wasInterrupted) { userPaused = true; } }
Example #7
Source File: ScratchView.java From react-native-scratch with MIT License | 5 votes |
public void reportScratchProgress() { final Context context = getContext(); if (context instanceof ReactContext) { WritableMap event = Arguments.createMap(); event.putDouble("progressValue", Math.round(scratchProgress * 100.0f) / 100.0); ((ReactContext) context).getJSModule(RCTEventEmitter.class).receiveEvent(getId(), RNTScratchViewManager.EVENT_SCRATCH_PROGRESS_CHANGED, event); } }
Example #8
Source File: ScratchView.java From react-native-scratch with MIT License | 5 votes |
public void reportScratchState() { final Context context = getContext(); if (context instanceof ReactContext) { WritableMap event = Arguments.createMap(); event.putBoolean("isScratchDone", cleared); ((ReactContext) context).getJSModule(RCTEventEmitter.class).receiveEvent(getId(), RNTScratchViewManager.EVENT_SCRATCH_DONE, event); } }
Example #9
Source File: ScratchView.java From react-native-scratch with MIT License | 5 votes |
public void reportTouchState(boolean state) { final Context context = getContext(); if (context instanceof ReactContext) { WritableMap event = Arguments.createMap(); event.putBoolean("touchState", state); ((ReactContext) context).getJSModule(RCTEventEmitter.class).receiveEvent(getId(), RNTScratchViewManager.EVENT_TOUCH_STATE_CHANGED, event); } }
Example #10
Source File: ScratchView.java From react-native-scratch with MIT License | 5 votes |
public void reportImageLoadFinished(boolean success) { final Context context = getContext(); if (context instanceof ReactContext) { WritableMap event = Arguments.createMap(); event.putBoolean("success", success); ((ReactContext) context).getJSModule(RCTEventEmitter.class).receiveEvent(getId(), RNTScratchViewManager.EVENT_IMAGE_LOAD, event); } }
Example #11
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onBeforeComplete(BeforeCompleteEvent beforeCompleteEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onBeforeComplete"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topBeforeComplete", event); updateWakeLock(false); }
Example #12
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onComplete(CompleteEvent completeEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onComplete"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topComplete", event); updateWakeLock(false); }
Example #13
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onReady(ReadyEvent readyEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onPlayerReady"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topOnPlayerReady", event); updateWakeLock(true); }
Example #14
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onPlaylistItem(PlaylistItemEvent playlistItemEvent) { if (!mIsBound) { doBindService(); } currentPlayingIndex = playlistItemEvent.getIndex(); WritableMap event = Arguments.createMap(); event.putString("message", "onPlaylistItem"); event.putInt("index",playlistItemEvent.getIndex()); event.putString("playlistItem", playlistItemEvent.getPlaylistItem().toJson().toString()); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topPlaylistItem", event); }
Example #15
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onBuffer(BufferEvent bufferEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onBuffer"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topBuffer", event); updateWakeLock(true); }
Example #16
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onPlay(PlayEvent playEvent) { requestAudioFocus(); WritableMap event = Arguments.createMap(); event.putString("message", "onPlay"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topPlay", event); updateWakeLock(true); userPaused = false; wasInterrupted = false; }
Example #17
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onPlaylistComplete(PlaylistCompleteEvent playlistCompleteEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onPlaylistComplete"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topPlaylistComplete", event); updateWakeLock(false); }
Example #18
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onSetupError(SetupErrorEvent setupErrorEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onSetupError"); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topSetupPlayerError", event); updateWakeLock(false); }
Example #19
Source File: RangeSliderViewManager.java From rn-range-slider with MIT License | 5 votes |
@Override protected RangeSlider createViewInstance(final ThemedReactContext reactContext) { final RangeSlider slider = new RangeSlider(reactContext); slider.setOnValueChangeListener(new RangeSlider.OnValueChangeListener() { @Override public void onValueChanged(long lowValue, long highValue, boolean fromUser) { WritableMap event = Arguments.createMap(); event.putDouble("lowValue", lowValue); event.putDouble("highValue", highValue); event.putBoolean("fromUser", fromUser); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(slider.getId(), ON_VALUE_CHANGED_EVENT_NAME, event); } }); slider.setOnSliderTouchListener(new RangeSlider.OnSliderTouchListener() { @Override public void onTouchStart() { reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(slider.getId(), ON_TOUCH_START_EVENT_NAME, Arguments.createMap()); } @Override public void onTouchEnd() { reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(slider.getId(), ON_TOUCH_END_EVENT_NAME, Arguments.createMap()); } }); return slider; }
Example #20
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onControlBarVisibilityChanged(ControlBarVisibilityEvent controlBarVisibilityEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onControlBarVisible"); event.putBoolean("controls", controlBarVisibilityEvent.isVisible()); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topControlBarVisible", event); updateWakeLock(true); }
Example #21
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onSeek(SeekEvent seekEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onSeek"); event.putDouble("position", seekEvent.getPosition()); event.putDouble("offset", seekEvent.getOffset()); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topSeek", event); }
Example #22
Source File: RNJWPlayerView.java From react-native-jw-media-player with MIT License | 5 votes |
@Override public void onSeeked(SeekedEvent seekedEvent) { WritableMap event = Arguments.createMap(); event.putString("message", "onSeeked"); event.putDouble("position", seekedEvent.getPosition()); getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topSeeked", event); }
Example #23
Source File: ImageFilter.java From react-native-image-filter-kit with MIT License | 5 votes |
private void sendJSEvent(final @Nonnull String eventName, final @Nullable String arg) { WritableMap event = Arguments.createMap(); if (arg != null) { event.putString( eventName.equals(ImageFilterEvent.ON_FILTERING_ERROR) ? "message" : "uri", arg ); } ((ReactContext)getContext()).getJSModule(RCTEventEmitter.class).receiveEvent( getId(), eventName, event ); }
Example #24
Source File: NativeAnimatedNodeTraversalTest.java From react-native-GPay with MIT License | 5 votes |
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))); } }; }
Example #25
Source File: RNJitsiMeetViewManager.java From react-native-jitsi-meet with Apache License 2.0 | 5 votes |
public void onConferenceTerminated(Map<String, Object> data) { WritableMap event = Arguments.createMap(); event.putString("url", (String) data.get("url")); event.putString("error", (String) data.get("error")); mReactContext.getJSModule(RCTEventEmitter.class).receiveEvent( mJitsiMeetViewReference.getJitsiMeetView().getId(), "conferenceTerminated", event); }
Example #26
Source File: BrightcovePlayerView.java From react-native-brightcove-player with MIT License | 5 votes |
public void setFullscreen(boolean fullscreen) { this.mediaController.show(); WritableMap event = Arguments.createMap(); event.putBoolean("fullscreen", fullscreen); ReactContext reactContext = (ReactContext) BrightcovePlayerView.this.getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(BrightcovePlayerView.this.getId(), BrightcovePlayerManager.EVENT_TOGGLE_ANDROID_FULLSCREEN, event); }
Example #27
Source File: RNRtmpView.java From react-native-rtmpview with MIT License | 5 votes |
@Override public void onBitrateRecalculated(double bitrateInKbps) { this.mLastBitrateCalculation = bitrateInKbps; Log.i(APP_NAME, String.format("onBitrateCalculated: %f", bitrateInKbps)); WritableMap event = Arguments.createMap(); event.putString("bitrate", String.format(Locale.US, "%f", bitrateInKbps)); ReactContext reactContext = (ReactContext)getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent( getId(), Events.EVENT_BITRATE_RECALCULATED.toString(), event); }
Example #28
Source File: RNRtmpView.java From react-native-rtmpview with MIT License | 5 votes |
public void onFirstVideoFrameRendered() { WritableMap event = Arguments.createMap(); ReactContext reactContext = (ReactContext)getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent( getId(), Events.EVENT_FIRST_VIDEO_FRAME_RENDERED.toString(), event); }
Example #29
Source File: RNRtmpView.java From react-native-rtmpview with MIT License | 5 votes |
public void onLoadStateChanged(RNRtmpLoadState loadState) { WritableMap event = Arguments.createMap(); event.putString("state", loadState.getFieldDescription()); ReactContext reactContext = (ReactContext)getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent( getId(), Events.EVENT_LOAD_STATE.toString(), event); }
Example #30
Source File: UIManagerModule.java From react-native-GPay with MIT License | 5 votes |
@Override public void initialize() { getReactApplicationContext().registerComponentCallbacks(mMemoryTrimCallback); mEventDispatcher.registerEventEmitter( DEFAULT, getReactApplicationContext().getJSModule(RCTEventEmitter.class)); }