ArturKalach / react-native-a11y

A11y Library for RN
MIT License
30 stars 2 forks source link

useA11yEnabled cleanup callback is throwing an error on development #32

Closed leobastiani closed 7 months ago

leobastiani commented 1 year ago

I encountered an error during development, and I'm unsure if this issue is occurring in production (although it's likely not).

image

I made a research and I found that this is the line of the error and this is not assigned because here we are using

return listener.remove;

and we lose this pointer

the best alternative for me is to use

return () => listener.remove();

but we could also use

return listener.remove.bind(listener);
ArturKalach commented 1 year ago

Hello @leobastiani, Thank you a lot for a help and creating issue. It makes sense, just tried to use FP rules, but forgot this binging)

This has been fixed with version 0.3.2.

I won't close this issue until I fix it in "0.3.0-android.2" which is used for supporting old version of RN

ArturKalach commented 7 months ago