by meinto

global event listener extension for react or react-native

139 Stars 14 Forks Last release: Not found MIT License 24 Commits 3 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

React Native Event Listeners

(This package isn't only restricted to react-native projects. The source is written in plain js with no dependencies to react-native.)

Financial Contributors on Open Collective npm version dependencie status dev-dependency status npm npm travis build Coverage Status


In some very specific cases it can be charming to have a simple global event listener. While working with global event listeners you don't have to pass touch events through the component tree into other components or can bypass easily the redux architecture for example.


npm install --save react-native-event-listeners


yarn add react-native-event-listeners

Usage Example

Hint: The event listeners also work across different files. You only have to import the

in every file you need to send or receive your events.

import { EventRegister } from 'react-native-event-listeners'



  • / class Receiver extends PureComponent { constructor(props) {

      this.state = {
          data: 'no data',


    componentWillMount() {

      this.listener = EventRegister.addEventListener('myCustomEvent', (data) => {


    componentWillUnmount() {



    render() {

      return <text>{}</text>

    } }


  • / const Sender = (props) => ( {
          EventRegister.emit('myCustomEvent', 'it works!!!')
    >Send Event )


// import
import { EventRegister } from 'react-native-event-listeners'

| static method | return value | description | | :------------------ | :---------------- | :------------------------------------------------------------- | | addEventListener | string | boolean | return value is the id of the event listener or false on error | | removeEventListener | boolean | true on success otherwise false | | removeAllListeners | boolean | true on success otherwise false | | emitEvent | void | no return value | | on | string | boolean | shorthand for addEventListener | | rm | boolean | shorthand for removeEventListener | | rmAll | boolean | shorthand for removeAllListeners | | emit | void | shorthand for emitEvent |


Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]



Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.