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

Action logger not showing logs using react native #2283

Closed
dstollie opened this issue Nov 10, 2017 · 1 comment
Closed

Action logger not showing logs using react native #2283

dstollie opened this issue Nov 10, 2017 · 1 comment

Comments

@dstollie
Copy link

dstollie commented Nov 10, 2017

In a story we try use the action('validate barcode') method to send actions. But for some reason the action logger does not present them.

--- Update
We've figured out that action does not work inside a closure

This doesnt work:

onClose={() => {action('close')}}

This does work:

onClose={action('close')}

Situation

  • Yarn
  • React v0.50
  • Node 8.5.0
  • React 16
@Hypnosphi
Copy link
Member

Hypnosphi commented Nov 11, 2017

action(name) doesn't log anything by itself, it just creates and returns a logger function. You can either pass it directly as a handler (onClose={action('close')}), or call it:

onClose={(...args) => {
  /* do your stuff */
  action('close')(...args)
}}

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

No branches or pull requests

3 participants