fix(pinch): stop native-stack overflow on rapid pinch under Reanimated 4#127
Open
ssahil97 wants to merge 1 commit into
Open
fix(pinch): stop native-stack overflow on rapid pinch under Reanimated 4#127ssahil97 wants to merge 1 commit into
ssahil97 wants to merge 1 commit into
Conversation
…erflow under Reanimated 4 usePinchCommons' reset() wrote gestureEnd.value inside its own withTiming callback unconditionally. Under Reanimated 4.x, valueSetter fires a still-live animation's callback(false) before clearing _animation when the value is overwritten, so the self-write re-enters the same callback and recurses to a 'Maximum call stack size exceeded (native stack depth)' crash on rapid pinch in/out. Gate the write on `finished`, matching usePanCommons which never self-writes. gestureEnd is an internal gimmick (never read in a style), so this is behavior-preserving. Fixes Glazzes#126
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #126.
usePinchCommonsreset()wrotegestureEnd.valueinside its ownwithTimingcallback unconditionally. Under Reanimated 4.x,valueSetterinvokes a still-live animation'scallback(false)when the value is overwritten/cancelled before clearing_animation, so the self-write re-enters the same callback and recurses toMaximum call stack size exceeded (native stack depth)on rapid pinch in/out.This gates the reset on
finished, mirroringusePanCommons(which never self-writes the shared value). On a real finish it writes once and the re-entrantfinished === falsecall is a single no-op level deep; on cancel it never writes.gestureEndis an internal gimmick (never read in a style), so the change is behavior-preserving.Verified on-device (iOS, RN 0.86, Reanimated 4.5.0): rapid pinch in/out no longer overflows the native stack.