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

feat(plugin): multiple worklet referencing #6904

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tjzel
Copy link
Collaborator

@tjzel tjzel commented Jan 15, 2025

Summary

Some time ago I added a feature of worklet referencing to the Plugin, but this was limited to only a single reference:

function foo(){
	// UI stuff
};

runOnUI(foo)(); // ok, `foo` will get workletized

function bar(){
	// UI stuff
};

const foobar = bar;

runOnUI(foobar); // error, foobar didn't get workletized

This PR allows for any amount of references in the reference chain. Simultaneously I discovered that Gesture Handler callbacks didn't benefit from worklet referencing, i.e. the following code would be invalid:

function foo(){
	// do something
}

const pan = Gesture.Pan().onActive(foo) // `foo` wouldn't be workletized

This PR adds this QoL feat for Gesture Handler callbacks.

Test plan

I added new unit tests for these cases.

@tomekzaw tomekzaw self-requested a review January 16, 2025 10:05
@tjzel tjzel marked this pull request as ready for review January 20, 2025 17:16
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.

1 participant