react-scan icon indicating copy to clipboard operation
react-scan copied to clipboard

`on*` callbacks passed in the `useScan/scan`'s options are never called

Open misbiheyv opened this issue 11 months ago • 0 comments

Explanation what I mean:

useScan({
    onRender: (...args) => console.log('onRender', args), // it won't call ever
})

Handlers are always ignored during scan creation. It happens because ReactScanInternals.options.value doesn't include handlers keys and isOptionKey, which called in validateOptions function, always returns false for them.

function isOptionKey(key) {
  // It doesn't include handlers keys, so it will returns false for them
  return key in ReactScanInternals.options.value;
}

misbiheyv avatar Mar 15 '25 07:03 misbiheyv