Repository navigation
Conversation
|
@ottob is attempting to deploy a commit to the Nuclear Pasta Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🤖 posted by [drax] Reviewer, Ovidiu's review bot
thanks ottob, nice catch! I reproduced this on main before testing the fix.
repro on main: I built a temporary screen with a DraxProvider nested inside a dragHandle DraxView, each with its own DraxHandle. When you drag an inner item, its hover copy's DraxHandle picks up the outer view's gesture (a probe showed the outer gesture tag in the inner hover). Once that hover unmounts, the outer grip stops starting drags. It fails silently, with no error or log, until the screen remounts. The counters ended at outer 1 | inner 1 after three attempts.
on this branch: the hover DraxHandle sees a null context and renders as a plain view. outer → inner → outer → inner → outer all registered (outer 3 | inner 2).
I also dragged items on the reorderable list, drag handles and color drag & drop screens and saw no regressions. yarn typecheck and yarn lint pass, and there are no unit tests in the repo yet.
a few non-blocking notes:
- the comment at
src/DraxHandle.tsx:35-38says hover content sits outside the handle context tree. after this PR, that's guaranteed by the explicit reset inHoverLayer, so it'd be nice to point there. - the same inheritance probably applies to
SortableBoardContext/SortableItemContextin a nested provider's hover (for example, aSortableContainerin hover content could auto-register with an outer board). I didn't test that, and it's fine as a follow-up.
| > | ||
| <Reanimated.View style={[styles.content, dimensionStyle, visualStyle]}> | ||
| {hoverContentRef.current} | ||
| <DraxHandleContext.Provider value={null}> |
There was a problem hiding this comment.
🤖 posted by [drax] Reviewer, Ovidiu's review bot
verified on iOS: on main, after one drag inside a nested provider, the outer DraxHandle no longer drags; with this it keeps working. could you add a one-line comment here explaining why? something like: hover content must not inherit a parent DraxView's DraxHandleContext, otherwise a DraxHandle in the hover copy attaches the parent's gesture to a second GestureDetector and the parent's handle goes dead after the hover unmounts.
Summary
HoverLayercontent in<DraxHandleContext.Provider value={null}>so anyDraxHandlerendered inside a hover clone always seesctx === nulland renders as a plain view without aGestureDetector.DraxProvider,HoverLayeris a sibling outside the draggedDraxView'sDraxHandleContext.Provider. However, when a nestedDraxProvider(e.g., an inner sortable list) is rendered inside an outer<DraxView dragHandle>, the nestedHoverLayeris a descendant of the outerDraxHandleContext.Provider.DraxProviderclones its children (including its<DraxHandle>) into the innerHoverLayer, which otherwise inherits the outerDraxView's gesture instance from context and crashesreact-native-gesture-handlerwith:[react-native-gesture-handler] Using the same gesture instance across multiple GestureDetectors is not possible. Create a separate gesture for each detector.