
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
react-native-event-manager
Advanced tools
allows an object to notify other objects about changes in their state
The React Native Event Manager is a utility library designed to simplify event handling and management in React Native applications. It provides a centralized event management system that allows components to communicate efficiently through events.
npm install react-native-event-manager
The ComponentA checks for changes in the 'onUpdate' state
import { useOnEvent } from 'react-native-event-manager'
function ComponentA(): JSX.Element {
const [value, setValue] = useState(-1)
useOnEvent('onUpdate', (newValue) => {
setValue(newValue)
})
return(
<Text>{value}</Text>
)
}
The ComponentB notify a change to the 'onUpdate' state
import { notifyEvent } from 'react-native-event-manager'
function ComponentB(): JSX.Element {
const [count, setCount] = useState(0)
const handlePress = () => {
notifyEvent('onUpdate', count)
setCount(count + 1)
}
return(
<Button title='Send' onPress={handlePress}/>
)
}
constructor()
Initializes the EventManager instance.
get()
Retrieves the singleton instance of the EventManager.
getListener(index: number): EventListener | undefined
Retrieves a listener at the specified index.
getListenerCount(): number
Returns the number of registered listeners.
removeAllListener(eventName: string | null): boolean
Removes all listeners for the specified event name. If eventName is null, removes all listeners.
remove(listener: EventListener): boolean
Removes the specified listener from the event manager.
sync(eventName: string): Promise<V | null>
Returns a Promise that resolves with the value of the next occurrence of the specified event.
on(eventName: string, callback: Callback): EventListener
Subscribes a listener to the specified event. Returns the created EventListener.
once(eventName: string, callback: Callback): EventListener
Subscribes a listener to the specified event, automatically removing it after the first occurrence. Returns the created EventListener.
notify(eventName: string, value?: V): void
Notifies all listeners of the specified event with an optional value.
constructor(eventManager: EventManager, name: string, callback: Callback)
Initializes an EventListener instance with the specified event manager, event name, and callback function.
remove()
Removes the listener from the event manager.
update(value?: T)
Notifies all registered callbacks with an optional value.
useOnEvent(eventName: string, callback: Callback)
A React hook for subscribing to a specific event. Automatically removes the listener on component unmount.
useOnEvents(observers: { [key: string]: Callback; })
A React hook for subscribing to multiple events specified in the observers object. Automatically removes all listeners on component unmount.
notifyEvent(eventName: string, value?: V): void
Notifies all listeners of the specified event with an optional value.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
FAQs
allows an object to notify other objects about changes in their state
The npm package react-native-event-manager receives a total of 0 weekly downloads. As such, react-native-event-manager popularity was classified as not popular.
We found that react-native-event-manager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.