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

GestureDetector: more checks for mounted component #2335

Merged

Conversation

phryneas
Copy link
Contributor

@phryneas phryneas commented Dec 1, 2022

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.

Comment on lines +173 to +175
if (!mountedRef.current) {
return;
}
Copy link
Contributor Author

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.

Comment on lines +153 to +155
if (!mountedRef.current) {
return;
}
Copy link
Contributor Author

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.

Copy link
Member

@j-piasecki j-piasecki left a comment

Choose a reason for hiding this comment

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

Thanks ❤️!

@j-piasecki j-piasecki merged commit 4467b88 into software-mansion:main Dec 12, 2022
hyochan pushed a commit to dooboolab-community/dooboo-ui that referenced this pull request Mar 12, 2023
…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
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2294
- Fix default `shouldCancelWhenOutside` on iOS and Android by
[@&#8203;Warus15](https://togithub.com/Warus15) in
[software-mansion/react-native-gesture-handler#2297
- Fix `onBegin` and `onTouchesDown` event ordering on iOS by
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2315
- fix RNGH not working in pnpm project by
[@&#8203;chj-damon](https://togithub.com/chj-damon) in
[software-mansion/react-native-gesture-handler#2334
- GestureDetector: more checks for mounted component by
[@&#8203;phryneas](https://togithub.com/phryneas) in
[software-mansion/react-native-gesture-handler#2335
- Fix `GestureDetector` not working when the underlying view changes by
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2092
- Cocoapods: Fix deprecated/removed File.exists method by
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2267
- Reformat iOS codebase by
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2306
- Provide proper Algolia Search API key by
[@&#8203;kacperkapusciak](https://togithub.com/kacperkapusciak) in
[software-mansion/react-native-gesture-handler#2308
- Fix search modal styling in the docs by
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2311
- Fixed typo in doc: cancelsToucesInView > cancelsTouchesInView by
[@&#8203;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
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2321
- Bump qs from 6.10.1 to 6.11.0 by
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2340
- \[docs] Fixed doubleTap example in docs by
[@&#8203;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
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2365

#### New Contributors

- [@&#8203;vidalmaxime](https://togithub.com/vidalmaxime) made their
first contribution in
[software-mansion/react-native-gesture-handler#2318
- [@&#8203;chj-damon](https://togithub.com/chj-damon) made their first
contribution in
[software-mansion/react-native-gesture-handler#2334
- [@&#8203;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>
hyochan pushed a commit to dooboolab-community/dooboo-ui that referenced this pull request Mar 19, 2023
…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
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2294
- Fix default `shouldCancelWhenOutside` on iOS and Android by
[@&#8203;Warus15](https://togithub.com/Warus15) in
[software-mansion/react-native-gesture-handler#2297
- Fix `onBegin` and `onTouchesDown` event ordering on iOS by
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2315
- fix RNGH not working in pnpm project by
[@&#8203;chj-damon](https://togithub.com/chj-damon) in
[software-mansion/react-native-gesture-handler#2334
- GestureDetector: more checks for mounted component by
[@&#8203;phryneas](https://togithub.com/phryneas) in
[software-mansion/react-native-gesture-handler#2335
- Fix `GestureDetector` not working when the underlying view changes by
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2092
- Cocoapods: Fix deprecated/removed File.exists method by
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2267
- Reformat iOS codebase by
[@&#8203;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
[@&#8203;j-piasecki](https://togithub.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2306
- Provide proper Algolia Search API key by
[@&#8203;kacperkapusciak](https://togithub.com/kacperkapusciak) in
[software-mansion/react-native-gesture-handler#2308
- Fix search modal styling in the docs by
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2311
- Fixed typo in doc: cancelsToucesInView > cancelsTouchesInView by
[@&#8203;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
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2321
- Bump qs from 6.10.1 to 6.11.0 by
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2340
- \[docs] Fixed doubleTap example in docs by
[@&#8203;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
[@&#8203;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
[@&#8203;dependabot](https://togithub.com/dependabot) in
[software-mansion/react-native-gesture-handler#2365

#### New Contributors

- [@&#8203;vidalmaxime](https://togithub.com/vidalmaxime) made their
first contribution in
[software-mansion/react-native-gesture-handler#2318
- [@&#8203;chj-damon](https://togithub.com/chj-damon) made their first
contribution in
[software-mansion/react-native-gesture-handler#2334
- [@&#8203;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>
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

Successfully merging this pull request may close these issues.

None yet

2 participants