0.2.23 • Published 4 months ago

react-native-event v0.2.23

Weekly downloads
-
License
MIT
Repository
github
Last release
4 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

5 months ago

0.2.15

5 months ago

0.2.14

5 months ago

0.2.13

5 months ago

0.2.23

4 months ago

0.2.12

5 months ago

0.2.21

5 months ago

0.2.10

6 months ago

0.2.20

5 months ago

0.2.19

5 months ago

0.2.18

5 months ago

0.2.17

5 months ago

0.2.7

6 months ago

0.2.6

6 months ago

0.2.9

6 months ago

0.2.8

6 months ago

0.2.3

1 year ago

0.2.4

1 year 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