-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Implement dispatchCommand
on Paper
#4586
Conversation
new GuardedRunnable(mContext.getExceptionHandler()) { | ||
@Override | ||
public void runGuarded() { | ||
mUIManager.dispatchCommand(viewTag, commandId, commandArgs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, this will be run on the mqt_native_module
thread so there may be a slight delay if we don't synchronize it properly with the UI thread. Instead, maybe we should push commands to the queue here and flush the queue in performOperations
which is already synchronized with the UI thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this already works fine:
android2.mp4
ios2.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo dispatchCommand
method by definition is an asynchronous operation, so on iOS we should use RCTExecuteOnUIManagerQueue
instead of RCTUnsafeExecuteOnUIManagerQueueSync
I think.
I just wondering if we should add even short information to the documentation about the possibility of using the dispatchCommand
method from UI Thread. What do tho think?
The rest of PR looks good 👍
Summary
Previously,
dispatchCommand
was available only on Fabric. This PR implementsdispatchCommand
for Android and iOS (Paper) as well as exports the function inreact-native-reanimated.d.ts
.Android:
android.mp4
iOS:
ios.mp4
Test plan
DispatchCommandExample.tsx