0.2.23 • Published 8 months ago

react-native-event v0.2.23

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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

API Docs

0.2.16

10 months ago

0.2.15

10 months ago

0.2.14

10 months ago

0.2.13

10 months ago

0.2.23

8 months ago

0.2.12

10 months ago

0.2.21

10 months ago

0.2.10

10 months ago

0.2.20

10 months ago

0.2.19

10 months ago

0.2.18

10 months ago

0.2.17

10 months ago

0.2.7

10 months ago

0.2.6

10 months ago

0.2.9

10 months ago

0.2.8

10 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