npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rn-event-emitter-callback

v0.2.0

Published

React Native event emitter with callback on both Android & iOS.

Readme

React Native Event

React Native event emitter with callback on both Android & iOS.

Sometimes we send event to javascript and want to execute some native codes with javascript result, we have to write lots of template codes, so this library provide the ability to send event with callback.

npm npm npm

iOS Screenshot

React Native Event iOS Screenshot

Android Screenshot

React Native Event Android Screenshot

Build and run the demo

$ cd RNEventDemo/
$ yarn install
$ react-native run-ios # or react-native run-android

Setup

Install:

$ yarn add rn-event-emitter-callback

iOS:

  • You must be consuming React itself via CocoaPods for this to work, see React Native documentation on how to set that up.

  • Add the following to your Podfile and run pod update

    pod 'ReactEventEmitter', :path => '../node_modules/rn-event-emitter-callback/Source/ios/'

Android:

  • Edit android/settings.gradle to look like this (without the +):

    rootProject.name = 'MyApp'
    
    include ':app'
    
    + include ':ReactEventEmitter'
    + project(':ReactEventEmitter').projectDir = new File(rootProject.projectDir, '../node_modules/rn-event-emitter-callback/Source/android')
  • Edit android/app/build.gradle to look like this:

    apply plugin: 'com.android.application'
    
    android {
      ...
    }
    
    dependencies {
      implementation fileTree(dir: "libs", include: ["*.jar"])
      implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
      implementation "com.facebook.react:react-native:+"  // From node_modules
      implementation 'org.greenrobot:eventbus:3.1.1'
    + implementation project(':ReactEventEmitter')
    }
  • Edit MainApplication.java to look like this:

    package com.myapp;
    
    + import me.tom.react.event.ReactEventEmitterPackage;
    
    ....
    
      @Override
      protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
          new MainReactPackage()
    +   , new ReactEventEmitterPackage()
        );
      }
    
    }

Demo

API

JavaScript

ReactEventEmitter.addListener(name, { params, callback });
ReactEventEmitter.removeListener(name);

iOS

- (void)sendEvent:(RCTBridge *)bridge name:(NSString *)name;
- (void)sendEvent:(RCTBridge *)bridge name:(NSString *)name
           params:(id)params;
- (void)sendEvent:(RCTBridge *)bridge name:(NSString *)name
         callback:(ReactEventEmitterCallbackHandler)callback;
- (void)sendEvent:(RCTBridge *)bridge name:(NSString *)name
           params:(id)params
         callback:(ReactEventEmitterCallbackHandler)callback;

Android

public void sendEvent(ReactContext context, String name);
public void sendEvent(ReactContext context, String name, @Nullable Object params);
public void sendEvent(ReactContext context,
                      String name,
                      @Nullable ReactEventEmitterCallbackHandler callbackHandler);
public void sendEvent(ReactContext context,
                      String name,
                      @Nullable Object params,
                      @Nullable ReactEventEmitterCallbackHandler callbackHandler);

Note

The callback is run in main thread.

License

MIT