Skip to content

[docs] Update examples#4091

Open
relextm19 wants to merge 27 commits intomainfrom
@relextm19/docs-examples
Open

[docs] Update examples#4091
relextm19 wants to merge 27 commits intomainfrom
@relextm19/docs-examples

Conversation

@relextm19
Copy link
Copy Markdown
Collaborator

@relextm19 relextm19 commented Apr 15, 2026

Description

Updated docs examples for v2 and v3 api. Removed videos from docs.

Test plan

Manually tested changes

Copilot AI review requested due to automatic review settings April 15, 2026 10:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the docs site examples and dependencies for docs-gesture-handler, aligning interactive gesture examples with the newer docs structure and updated runtime packages.

Changes:

  • Update docs pages to load examples from new locations (and remove embedded preview videos).
  • Add/refresh versioned 2.x example implementations under versioned_docs.
  • Bump the docs site’s React Native ecosystem deps (RNGH, Reanimated, RN Web, Worklets) and adjust the Babel plugin accordingly.

Reviewed changes

Copilot reviewed 36 out of 37 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/docs-gesture-handler/yarn.lock Dependency lock updates after package bumps.
packages/docs-gesture-handler/package.json Bumps docs-site deps (RNGH, Reanimated, RN Web, Worklets).
packages/docs-gesture-handler/babel.config.js Switches Babel plugin to react-native-worklets/plugin.
packages/docs-gesture-handler/versioned_docs/version-2.x/gestures/tap-gesture.md Points 2.x doc page to versioned example imports; removes video blocks.
packages/docs-gesture-handler/versioned_docs/version-2.x/gestures/rotation-gesture.md Same: versioned example imports; removes video blocks.
packages/docs-gesture-handler/versioned_docs/version-2.x/gestures/pinch-gesture.md Same: versioned example imports; removes video blocks.
packages/docs-gesture-handler/versioned_docs/version-2.x/gestures/pan-gesture.md Same: versioned example imports; removes video blocks.
packages/docs-gesture-handler/versioned_docs/version-2.x/gestures/long-press-gesture.md Same: versioned example imports; removes video blocks.
packages/docs-gesture-handler/versioned_docs/version-2.x/gestures/hover-gesture.md Same: versioned example imports; removes video blocks.
packages/docs-gesture-handler/versioned_docs/version-2.x/gestures/fling-gesture.md Same: versioned example imports; removes video blocks.
packages/docs-gesture-handler/versioned_docs/version-2.x/examples/TapGestureBasic.js Adds a versioned 2.x tap example.
packages/docs-gesture-handler/versioned_docs/version-2.x/examples/RotationGestureBasic.js Adds a versioned 2.x rotation example.
packages/docs-gesture-handler/versioned_docs/version-2.x/examples/PinchGestureBasic.js Adds a versioned 2.x pinch example.
packages/docs-gesture-handler/versioned_docs/version-2.x/examples/PanGestureBasic.js Updates versioned 2.x pan example sizing/measurement.
packages/docs-gesture-handler/versioned_docs/version-2.x/examples/LongPressGestureBasic.js Adds a versioned 2.x long-press example.
packages/docs-gesture-handler/versioned_docs/version-2.x/examples/HoverGestureBasic.js Adds a versioned 2.x hover example.
packages/docs-gesture-handler/versioned_docs/version-2.x/examples/FlingGestureBasic.js Updates versioned 2.x fling example sizing/measurement.
packages/docs-gesture-handler/static/examples/TapGestureBasic.js Migrates static tap example to useTapGesture.
packages/docs-gesture-handler/static/examples/RotationGestureBasic.js Migrates static rotation example to usePanGesture.
packages/docs-gesture-handler/static/examples/RotationGestureBasicSrc.js Removes old *Src file (raw-loader now targets main example).
packages/docs-gesture-handler/static/examples/PinchGestureBasic.js Migrates static pinch example to usePanGesture and new measurement logic.
packages/docs-gesture-handler/static/examples/PinchGestureBasicSrc.js Removes old *Src file (raw-loader now targets main example).
packages/docs-gesture-handler/static/examples/PanGestureBasic.js Migrates static pan example to usePanGesture and new measurement logic.
packages/docs-gesture-handler/static/examples/LongPressGestureBasic.js Migrates static long-press example to useLongPressGesture.
packages/docs-gesture-handler/static/examples/HoverGestureBasic.js Migrates static hover example to useHoverGesture.
packages/docs-gesture-handler/static/examples/FlingGestureBasic.js Migrates static fling example to useFlingGesture.
packages/docs-gesture-handler/docs/legacy-gestures/rotation-gesture.md Updates raw-loader import to point at main example file.
packages/docs-gesture-handler/docs/legacy-gestures/pinch-gesture.md Updates raw-loader import to point at main example file.
packages/docs-gesture-handler/docs/legacy-gestures/pan-gesture.md Updates raw-loader import to point at main example file.
packages/docs-gesture-handler/docs/legacy-gestures/fling-gesture.md Updates raw-loader import to point at main example file.
packages/docs-gesture-handler/docs/gestures/use-tap-gesture.mdx Removes embedded preview video blocks.
packages/docs-gesture-handler/docs/gestures/use-rotation-gesture.mdx Updates raw-loader import + removes embedded preview video blocks.
packages/docs-gesture-handler/docs/gestures/use-pinch-gesture.mdx Updates raw-loader import + removes embedded preview video blocks.
packages/docs-gesture-handler/docs/gestures/use-pan-gesture.mdx Updates raw-loader import + removes embedded preview video blocks.
packages/docs-gesture-handler/docs/gestures/use-long-press-gesture.mdx Removes embedded preview video blocks.
packages/docs-gesture-handler/docs/gestures/use-hover-gesture.mdx Removes embedded preview video blocks.
packages/docs-gesture-handler/docs/gestures/use-fling-gesture.mdx Updates raw-loader import + removes embedded preview video blocks.
Comments suppressed due to low confidence (6)

packages/docs-gesture-handler/versioned_docs/version-2.x/examples/PanGestureBasic.js:84

  • GestureHandlerRootView doesn’t forward refs, so ref={containerRef} will be ignored and measureInWindow won’t update maxTranslateX/Y. This will keep the clamp bounds at 0 and prevent dragging. Put the ref on an inner View wrapper instead.
    packages/docs-gesture-handler/versioned_docs/version-2.x/examples/PanGestureBasic.js:71
  • clamp is called inside .onUpdate, which runs as a worklet when using the Reanimated-integrated Gesture API. A plain JS helper can cause runtime failures when called from a worklet. Add a 'worklet' directive to clamp or inline the clamp logic in the callback.
    packages/docs-gesture-handler/versioned_docs/version-2.x/examples/PanGestureBasic.js:76
  • Same worklet concern for Y translation: clamp is invoked in the worklet .onUpdate callback. Ensure clamp is worklet-safe to avoid runtime errors.
    packages/docs-gesture-handler/versioned_docs/version-2.x/examples/PanGestureBasic.js:42
  • maxTranslateY is set to height / 2, which lets the 100px-tall box translate beyond the container’s vertical bounds. To keep it fully visible, subtract half the box size (similar to the X calculation).
    packages/docs-gesture-handler/static/examples/PanGestureBasic.js:71
  • onUpdate callbacks created by usePanGesture run as worklets; calling a plain JS helper like clamp from inside them can throw at runtime (“tried to call a non-worklet function”). Mark clamp as a worklet (add a 'worklet' directive) or inline the min/max logic inside the callbacks.
    onUpdate: (event) => {
      translationX.value = clamp(
        prevTranslationX.value + event.translationX,
        -maxTranslateX.value,
        maxTranslateX.value
      );

packages/docs-gesture-handler/versioned_docs/version-2.x/examples/FlingGestureBasic.js:63

  • clamp is called inside the worklet .onStart callback (Reanimated-integrated Gesture API). If clamp isn’t workletized, this can throw at runtime. Add a 'worklet' directive to clamp or inline the clamp logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/docs-gesture-handler/static/examples/PanGestureBasic.js Outdated
Comment thread packages/docs-gesture-handler/static/examples/PinchGestureBasic.js
Comment thread packages/docs-gesture-handler/static/examples/PanGestureBasic.js Outdated
Comment thread packages/docs-gesture-handler/static/examples/PinchGestureBasic.js Outdated
Comment thread packages/docs-gesture-handler/static/examples/PanGestureBasic.js
Comment thread packages/docs-gesture-handler/static/examples/FlingGestureBasic.js
Comment thread packages/docs-gesture-handler/static/examples/PinchGestureBasic.js Outdated
@m-bert m-bert added Documentation Documentation change/enhancement labels Apr 16, 2026
@m-bert m-bert changed the title Update docs examples [docs] Update examples Apr 16, 2026
Copy link
Copy Markdown
Collaborator

@m-bert m-bert left a comment

Choose a reason for hiding this comment

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

Good job 🎉

Please also update section Gesture Handler 2.

Comment thread packages/docs-gesture-handler/static/examples/PanGestureBasic.js Outdated
Comment thread packages/docs-gesture-handler/static/examples/PanGestureBasic.js Outdated
Comment thread packages/docs-gesture-handler/static/examples/PanGestureBasic.js
Comment thread packages/docs-gesture-handler/docs/gestures/use-pinch-gesture.mdx Outdated
Comment thread packages/docs-gesture-handler/docs/gestures/use-rotation-gesture.mdx Outdated
const colorIndex = useSharedValue(1);

const tap = Gesture.Tap().onEnd(() => {
if (colorIndex.value > COLORS.length) {
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.

Same as in not versioned file

Comment thread packages/docs-gesture-handler/package.json Outdated
relextm19 and others added 6 commits April 16, 2026 20:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>
Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>
…n/react-native-gesture-handler into @relextm19/docs-examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Documentation change/enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants