0.2.23 • Published 7 months ago
react-native-event v0.2.23
react-native-event
React context for subscribing to all react native interaction events.
For a react-dom version, check out react-dom-event
Example 1
import { useCallback, Fragment } from "react";
import { TouchableOpacity } from "react-native";
import { useEvent, EventProvider } from "react-native-event";
function UseEventComponent() {
const handler = useCallback((event) => {
/* do something with any event */
});
useEvent(handler, [handler]);
return <Fragment />;
}
const App = () => {
return (
<Fragment>
<EventProvider>
<UseEventComponent />
<TouchableOpacity onPress={() => {}} />
</EventProvider>
<TouchableOpacity onPress={() => {}} />
</Fragment>
);
};
export default App;
// any press will call the global event handler
Documentation
0.2.16
8 months ago
0.2.15
8 months ago
0.2.14
8 months ago
0.2.13
8 months ago
0.2.23
7 months ago
0.2.12
8 months ago
0.2.21
8 months ago
0.2.10
9 months ago
0.2.20
8 months ago
0.2.19
8 months ago
0.2.18
8 months ago
0.2.17
8 months ago
0.2.7
9 months ago
0.2.6
9 months ago
0.2.9
9 months ago
0.2.8
9 months ago
0.2.3
2 years ago
0.2.4
2 years ago
0.2.2
3 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.1.0
3 years ago