diff --git a/packages/docs-reanimated/docs/advanced/dispatchCommand.mdx b/packages/docs-reanimated/docs/advanced/dispatchCommand.mdx index 4bd2c16f0e4..d1a2d0bda1c 100644 --- a/packages/docs-reanimated/docs/advanced/dispatchCommand.mdx +++ b/packages/docs-reanimated/docs/advanced/dispatchCommand.mdx @@ -4,71 +4,82 @@ sidebar_position: 7 # dispatchCommand -import DocsCompatibilityInfo from '../_shared/_docs_compatibility_info.mdx'; +import DispatchCommandSrc from '!!raw-loader!@site/src/examples/DispatchCommand'; - +`dispatchCommand` allows you to run commands on a native component from the UI thread directly. -Allows to dispatch command on a native component synchronously from the UI thread. +## Reference + +```javascript +import { dispatchCommand } from 'react-native-reanimated'; + +function App() { + const animatedRef = useAnimatedRef(); + + const gesture = Gesture.Tap().onStart(() => { + // highlight-next-line + dispatchCommand(animatedRef, 'focus'); + }); + + return ( + <> + + +