[General] Fix relations not being applied in api V1#4207
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes legacy (API v1) gesture-handler “relations” (e.g. waitFor, simultaneousHandlers, blocksHandlers) not being applied on initial handler creation, and prevents relations from being accidentally cleared by re-filtering already-filtered config.
Changes:
- Call
RNGestureHandlerModule.configureRelationsimmediately aftercreateGestureHandlerso relations are applied on first mount. - Stop using
filterConfigto re-filter relation props during updates; use a newselectPropertieshelper to pick relation fields without re-transforming them. - Add
selectPropertiesutility tohandlers/utils.ts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/react-native-gesture-handler/src/handlers/utils.ts | Adds selectProperties helper intended to avoid non-idempotent filterConfig behavior for relations. |
| packages/react-native-gesture-handler/src/handlers/createHandler.tsx | Applies relations on creation and switches update-time relation extraction to selectProperties. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
m-bert
left a comment
There was a problem hiding this comment.
filterConfigisn't idempotent
And I think it should be, right? Anyway, that's probably not for now. Leaving ✅ so it is not blocked before release.
Also, do you know why Android worked anyway?
It wouldn't hurt, but I don't know if something relies on it at this point.
No 😞 |
Description
configureRelationswasn't called after creating the gesture, only after the update.filterConfigisn't idempotent, and calling it a second time resulted in the relations arrays being cleared. Adds a simpleselectPropertiesutil to use instead.Test plan
Test legacy Multitap example