Skip to content

Swipeable and drawer, new api#3803

Merged
akwasniewski merged 16 commits into
nextfrom
@akwasniewski/components-new-api
Nov 17, 2025
Merged

Swipeable and drawer, new api#3803
akwasniewski merged 16 commits into
nextfrom
@akwasniewski/components-new-api

Conversation

@akwasniewski

Copy link
Copy Markdown
Contributor

Description

This PR changes reanimated swipeable and reanimated drawer components implementations to use new hooks API.

Test plan

Check whether 'new swipable' and 'reanimated drawer layout' work in the example app

Andrzej Antoni Kwaśniewski added 2 commits November 5, 2025 09:50
@akwasniewski
akwasniewski changed the base branch from main to next November 5, 2025 09:53
@akwasniewski
akwasniewski requested a review from m-bert November 7, 2025 12:59
@akwasniewski
akwasniewski marked this pull request as ready for review November 7, 2025 12:59

@j-piasecki j-piasecki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like the main changes are due to migration from api v2 to v3. Can we also explore whether we can reduce number of renders using shared value binding?

@akwasniewski

Copy link
Copy Markdown
Contributor Author

Looks like the main changes are due to migration from api v2 to v3. Can we also explore whether we can reduce number of renders using shared value binding?

I've made small adjsutment for swipeable 0f9daeb. I played around a lot with trying to utilise this in drawer, however I could not manage it to work when making drawerOpened a shared value, we need it to be a state, and all other gesture props depend on it, so I don't think we can utilise it there.

@j-piasecki j-piasecki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I could not manage it to work when making drawerOpened a shared value, we need it to be a state, and all other gesture props depend on it, so I don't think we can utilise it there.

We can always explore refactoring it in the future if there's a chance that it will improve performance.

Comment on lines -32 to -33
// TODO: remove, debug info only
backgroundColor: 'red',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

End of an era 😢

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, hah. Without it the swipeable is all red, so I decided it is time.

Comment on lines +457 to +466
const tapGesture = useTap({
shouldCancelWhenOutside: true,
enabled: shouldEnableTap,
onStart: () => {
'worklet';
if (rowState.value !== 0) {
close();
}
},
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why don't we pass relation props to Tap?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad, good catch 6978df7

@akwasniewski
akwasniewski merged commit daa841d into next Nov 17, 2025
2 checks passed
@akwasniewski
akwasniewski deleted the @akwasniewski/components-new-api branch November 17, 2025 19:52
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.

3 participants