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

This is good stuff, just needs a small fix #4

Open
fermmm opened this issue Jun 21, 2021 · 3 comments
Open

This is good stuff, just needs a small fix #4

fermmm opened this issue Jun 21, 2021 · 3 comments

Comments

@fermmm
Copy link

fermmm commented Jun 21, 2021

This is a very simple package and the code quality is good, also works great after applying a fix.

Problems:

  • Sometimes onChange is not executed
  • onChange is not executed when entering the page

These are small problems and easy to fix.

Solution:

Change line 19:
const [lastValue, setLastValue] = useState<boolean>(false);
for this:
const [lastValue, setLastValue] = useState<boolean>(null);

Remove line 29:
setLastValue(false);

The package is only 1 file so if the maintainer doesn't fix it anyone can just copy the code into a file with no problems.

@SvanBoxel
Copy link
Owner

Hi @fermmm! Thank you for openings this issue. Please go ahead and open a pull request addressing this. Happy to review, accept, and merge it for you.

@martymfly
Copy link

This is a very simple package and the code quality is good, also works great after applying a fix.

Problems:

  • Sometimes onChange is not executed
  • onChange is not executed when entering the page

These are small problems and easy to fix.

Solution:

Change line 19:
const [lastValue, setLastValue] = useState<boolean>(false);
for this:
const [lastValue, setLastValue] = useState<boolean>(null);

Remove line 29:
setLastValue(false);

The package is only 1 file so if the maintainer doesn't fix it anyone can just copy the code into a file with no problems.

Thanks for the fix!

@ddikodroid
Copy link

This is a very simple package and the code quality is good, also works great after applying a fix.

Problems:

  • Sometimes onChange is not executed
  • onChange is not executed when entering the page

These are small problems and easy to fix.

Solution:

Change line 19: const [lastValue, setLastValue] = useState<boolean>(false); for this: const [lastValue, setLastValue] = useState<boolean>(null);

Remove line 29: setLastValue(false);

The package is only 1 file so if the maintainer doesn't fix it anyone can just copy the code into a file with no problems.

any explanation why those lines fix the issue?

ddikodroid added a commit to ddikodroid/visibility-sensor-react-native that referenced this issue Mar 30, 2022
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

4 participants