Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: undefined is not a function" error when trying to receive an event. #28

Open
u2gilles opened this issue Apr 13, 2023 · 0 comments

Comments

@u2gilles
Copy link

u2gilles commented Apr 13, 2023

In a react native app, I define events like so in event.ts file :

import { createEvent } from "react-event-hook";

export const { useNextListener, emitNext } = createEvent("next")();
export const { usePreviousListener, emitPrevious } = createEvent("previous")();

Then I emit it

import { emitNext, emitPrevious } from "../events";
...
  onPress={() => {
    emitNext();
   }}
  size={iconSize}
/>
...

But when I want to received, I get a TypeError: undefined is not a function error.

import { useNextListener, usePreviousListener } from "../events";

  useNextListener(() => {
    console.log("useNextListener");
    handleSkipToNext();
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant