Skip to content

Conversation

hosseinmd
Copy link
Contributor

Summary

The method of using this Hook is not like React hooks and it needs to get deps in the last parameter like react hooks

useBackHandler(() => {
  if (isFocused) {
    setFocused(false);
    return true;
  }
  return false;
},[isFocused])

Test Plan

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I updated the typed files (TS and Flow)

Copy link
Member

@pvinis pvinis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good one, thanks!

@hosseinmd
Copy link
Contributor Author

This module has many PRs but why no one to organize them.

@LinusU LinusU added the major Increment the major version when merged label Nov 16, 2020
@hosseinmd
Copy link
Contributor Author

hosseinmd commented Dec 7, 2020

We can't manage backhandler when that is on the previous page,
Imagine you have Two Page by react-navigation. both pages have a back handler if the previous page a re-render occurred, Backhandler will add listener again so if the user clicks the back button previous page back handler will call
I think this PR could reduce these issues.

@pvinis
Copy link
Member

pvinis commented Feb 21, 2025

closing in favor of #418.

@pvinis pvinis closed this Feb 21, 2025
pvinis added a commit that referenced this pull request Feb 21, 2025
Co-authored-by: Hossein Mohammadi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Increment the major version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants