0.2.23 • Published 6 months ago

react-native-event v0.2.23

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

7 months ago

0.2.15

7 months ago

0.2.14

7 months ago

0.2.13

7 months ago

0.2.23

6 months ago

0.2.12

7 months ago

0.2.21

7 months ago

0.2.10

8 months ago

0.2.20

7 months ago

0.2.19

7 months ago

0.2.18

7 months ago

0.2.17

7 months ago

0.2.7

8 months ago

0.2.6

8 months ago

0.2.9

8 months ago

0.2.8

8 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