-
-
Notifications
You must be signed in to change notification settings - Fork 961
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
GestureDetector: more checks for mounted component #2335
GestureDetector: more checks for mounted component #2335
Conversation
if (!mountedRef.current) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one actually happened to me and I can confirm that in my application, adding this check fixes it.
if (!mountedRef.current) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one didn't happen to me (yet), but I added it for good measure - we should probably never assume in an setImmediate
call that the component did not unmount before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ❤️!
…266) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-native-gesture-handler](https://togithub.com/software-mansion/react-native-gesture-handler) | [`~2.8.0` -> `~2.9.0`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.8.0/2.9.0) | [![age](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/compatibility-slim/2.8.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/confidence-slim/2.8.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>software-mansion/react-native-gesture-handler</summary> ### [`v2.9.0`](https://togithub.com/software-mansion/react-native-gesture-handler/releases/tag/2.9.0) [Compare Source](https://togithub.com/software-mansion/react-native-gesture-handler/compare/2.8.0...2.9.0) #### ❗ Important changes - Support React Native 0.71 by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2313 #### 🐛 Bug fixes - Use `ReturnType` instead of explicit `AnimatedInterpolation` type by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2294 - Fix default `shouldCancelWhenOutside` on iOS and Android by [@​Warus15](https://togithub.com/Warus15) in [software-mansion/react-native-gesture-handler#2297 - Fix `onBegin` and `onTouchesDown` event ordering on iOS by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2278 - Fix buttons getting locked in some cases on Android by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2315 - fix RNGH not working in pnpm project by [@​chj-damon](https://togithub.com/chj-damon) in [software-mansion/react-native-gesture-handler#2334 - GestureDetector: more checks for mounted component by [@​phryneas](https://togithub.com/phryneas) in [software-mansion/react-native-gesture-handler#2335 - Fix `GestureDetector` not working when the underlying view changes by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2092 - Cocoapods: Fix deprecated/removed File.exists method by [@​tomekzaw](https://togithub.com/tomekzaw) in [software-mansion/react-native-gesture-handler#2368 #### 🔢 Miscellaneous - Update React Native to 0.70.3 in the example apps by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2267 - Reformat iOS codebase by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2296 - Update the commit hash in `.git-blame-ignore-revs` by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2306 - Provide proper Algolia Search API key by [@​kacperkapusciak](https://togithub.com/kacperkapusciak) in [software-mansion/react-native-gesture-handler#2308 - Fix search modal styling in the docs by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2309 - Bump loader-utils from 2.0.0 to 2.0.3 in /docs by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2311 - Fixed typo in doc: cancelsToucesInView > cancelsTouchesInView by [@​vidalmaxime](https://togithub.com/vidalmaxime) in [software-mansion/react-native-gesture-handler#2318 - Bump decode-uri-component from 0.2.0 to 0.2.2 by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2338 - Bump loader-utils from 2.0.3 to 2.0.4 in /docs by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2321 - Bump qs from 6.10.1 to 6.11.0 by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2342 - Bump decode-uri-component from 0.2.0 to 0.2.2 in /FabricExample by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2340 - \[docs] Fixed doubleTap example in docs by [@​robwalkerco](https://togithub.com/robwalkerco) in [software-mansion/react-native-gesture-handler#2349 - Bump json5 from 2.2.1 to 2.2.3 in /docs by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2366 - Bump json5 from 2.2.1 to 2.2.3 in /FabricExample by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2365 #### New Contributors - [@​vidalmaxime](https://togithub.com/vidalmaxime) made their first contribution in [software-mansion/react-native-gesture-handler#2318 - [@​chj-damon](https://togithub.com/chj-damon) made their first contribution in [software-mansion/react-native-gesture-handler#2334 - [@​robwalkerco](https://togithub.com/robwalkerco) made their first contribution in [software-mansion/react-native-gesture-handler#2349 **Full Changelog**: software-mansion/react-native-gesture-handler@2.8.0...2.9.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/dooboolab/dooboo-ui). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNjAuMCIsInVwZGF0ZWRJblZlciI6IjM0LjE2MC4wIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…296) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-native-gesture-handler](https://togithub.com/software-mansion/react-native-gesture-handler) | [`2.8.0` -> `2.9.0`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.8.0/2.9.0) | [![age](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/compatibility-slim/2.8.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/react-native-gesture-handler/2.9.0/confidence-slim/2.8.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>software-mansion/react-native-gesture-handler</summary> ### [`v2.9.0`](https://togithub.com/software-mansion/react-native-gesture-handler/releases/tag/2.9.0) [Compare Source](https://togithub.com/software-mansion/react-native-gesture-handler/compare/2.8.0...2.9.0) #### ❗ Important changes - Support React Native 0.71 by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2313 #### 🐛 Bug fixes - Use `ReturnType` instead of explicit `AnimatedInterpolation` type by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2294 - Fix default `shouldCancelWhenOutside` on iOS and Android by [@​Warus15](https://togithub.com/Warus15) in [software-mansion/react-native-gesture-handler#2297 - Fix `onBegin` and `onTouchesDown` event ordering on iOS by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2278 - Fix buttons getting locked in some cases on Android by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2315 - fix RNGH not working in pnpm project by [@​chj-damon](https://togithub.com/chj-damon) in [software-mansion/react-native-gesture-handler#2334 - GestureDetector: more checks for mounted component by [@​phryneas](https://togithub.com/phryneas) in [software-mansion/react-native-gesture-handler#2335 - Fix `GestureDetector` not working when the underlying view changes by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2092 - Cocoapods: Fix deprecated/removed File.exists method by [@​tomekzaw](https://togithub.com/tomekzaw) in [software-mansion/react-native-gesture-handler#2368 #### 🔢 Miscellaneous - Update React Native to 0.70.3 in the example apps by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2267 - Reformat iOS codebase by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2296 - Update the commit hash in `.git-blame-ignore-revs` by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2306 - Provide proper Algolia Search API key by [@​kacperkapusciak](https://togithub.com/kacperkapusciak) in [software-mansion/react-native-gesture-handler#2308 - Fix search modal styling in the docs by [@​j-piasecki](https://togithub.com/j-piasecki) in [software-mansion/react-native-gesture-handler#2309 - Bump loader-utils from 2.0.0 to 2.0.3 in /docs by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2311 - Fixed typo in doc: cancelsToucesInView > cancelsTouchesInView by [@​vidalmaxime](https://togithub.com/vidalmaxime) in [software-mansion/react-native-gesture-handler#2318 - Bump decode-uri-component from 0.2.0 to 0.2.2 by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2338 - Bump loader-utils from 2.0.3 to 2.0.4 in /docs by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2321 - Bump qs from 6.10.1 to 6.11.0 by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2342 - Bump decode-uri-component from 0.2.0 to 0.2.2 in /FabricExample by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2340 - \[docs] Fixed doubleTap example in docs by [@​robwalkerco](https://togithub.com/robwalkerco) in [software-mansion/react-native-gesture-handler#2349 - Bump json5 from 2.2.1 to 2.2.3 in /docs by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2366 - Bump json5 from 2.2.1 to 2.2.3 in /FabricExample by [@​dependabot](https://togithub.com/dependabot) in [software-mansion/react-native-gesture-handler#2365 #### New Contributors - [@​vidalmaxime](https://togithub.com/vidalmaxime) made their first contribution in [software-mansion/react-native-gesture-handler#2318 - [@​chj-damon](https://togithub.com/chj-damon) made their first contribution in [software-mansion/react-native-gesture-handler#2334 - [@​robwalkerco](https://togithub.com/robwalkerco) made their first contribution in [software-mansion/react-native-gesture-handler#2349 **Full Changelog**: software-mansion/react-native-gesture-handler@2.8.0...2.9.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/dooboolab/dooboo-ui). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzUuMTEuMCJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Description
This builds on top of #2262 - I encountered more cases where a component that was immediately remounting was running into race conditions, so I added checks to every
setImmediate
call.