Skip to content

docs: document the hinge sensor type and add a foldable playground - #10653

Draft
pawicao wants to merge 4 commits into
@pawicao/animated-sensor-hingefrom
@pawicao/hinge-sensor-docs
Draft

pawicao wants to merge 4 commits into
@pawicao/animated-sensor-hingefrom
@pawicao/hinge-sensor-docs

Conversation

@pawicao

@pawicao pawicao commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Note

This PR description is AI-generated.

Requires #10651.

Summary

#10651 adds SensorType.HINGE, and the useAnimatedSensor page did not mention it. I documented the new type: HINGE in the sensor list, the ValueHinge shape, the HingeStatus enum, the fact that it takes no config, a usage snippet that folds two panels with rotateY, and a platform table with the Samsung quantisation remark. The live demos on the page run on web, where no hinge exists, so I added a playground in the style of the other sensor playgrounds: a slider drives a CSS foldable mock and the code box shows the angle in radians and the derived status.

Test plan

yarn format:md reports no diff and the docs lint passes. The docs typecheck reports errors in the new example file because the docs package resolves react-native-reanimated from npm, which has no SensorType.HINGE yet; the same script also fails on pre-existing files.

Changelog

  • I added a changelog fragment with yarn changelog:add for each changed package, or this PR does not change react-native-reanimated or react-native-worklets.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change documents hinge sensor support with new types, statuses, output fields, and platform rules. It adds an interactive hinge playground with slider controls and a two-panel visualization. It also adds a React Native example that uses hinge angle data to rotate two panels around a shared edge.

Priority: ⬇️ Low

Change: Other

Merge Risk: 🔵 Low · up to 64867

The hinge playground’s angle field remains awkward to edit after clearing it, but the impact is limited to the documentation demo.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main changes: documenting the hinge sensor type and adding a foldable playground.
Description check ✅ Passed The description directly explains the hinge sensor documentation, foldable playground, platform behavior, and test results.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 67ac028e-68ed-4d58-8f24-058fab341be2

📥 Commits

Reviewing files that changed from the base of the PR and between 1acbe5c and e08deb1.

📒 Files selected for processing (6)
  • docs/docs-reanimated/docs/device/useAnimatedSensor.mdx
  • docs/docs-reanimated/src/components/InteractivePlayground/index.tsx
  • docs/docs-reanimated/src/components/InteractivePlayground/useAnimatedHingePlayground/Example.tsx
  • docs/docs-reanimated/src/components/InteractivePlayground/useAnimatedHingePlayground/index.tsx
  • docs/docs-reanimated/src/components/InteractivePlayground/useAnimatedHingePlayground/styles.module.css
  • docs/docs-reanimated/src/examples/AnimatedHinge.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

max={FLAT_DEGREES}
step={1}
value={degrees}
onChange={setDegrees}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reject non-finite angle input.

When a user clears the number input, Range emits NaN. This setter stores it. The playground then renders angle: NaN and rotateY(NaNdeg), so the code preview and foldable model are invalid. Normalize the value here, or make Range suppress non-finite values.

Proposed fix
-      onChange={setDegrees}
+      onChange={(value) => {
+        if (Number.isFinite(value)) {
+          setDegrees(value);
+        }
+      }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
onChange={setDegrees}
onChange={(value) => {
if (Number.isFinite(value)) {
setDegrees(value);
}
}}

@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch from 66c11e5 to 4fdfa08 Compare September 22, 2026 11:11
@pawicao
pawicao added this pull request to stack #10660 September 22, 2026 11:36
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch from 4fdfa08 to 9cd0222 Compare September 22, 2026 11:59
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch 2 times, most recently from 3530faf to 648678e Compare September 22, 2026 13:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: a7a2f87d-add8-4f5a-899f-5e1c039e61d8

📥 Commits

Reviewing files that changed from the base of the PR and between 9cd0222 and 648678e.

📒 Files selected for processing (1)
  • docs/docs-reanimated/src/components/InteractivePlayground/index.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

Comment on lines +216 to +218
if (!Number.isFinite(newValue)) {
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve an editable empty state in Range.

When a user selects the current number and deletes it, parseFloat returns NaN. This branch skips onChange, so the controlled TextField retains the old value and prevents keyboard replacement. Keep a string draft for the text field, or commit the clamped numeric value on blur.

@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch 3 times, most recently from 945cdd1 to cfc3a52 Compare September 22, 2026 13:47
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch 2 times, most recently from 4d2a781 to acffbaf Compare September 23, 2026 09:47
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch from acffbaf to e584608 Compare September 23, 2026 10:16
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch from ade3b17 to ed53545 Compare September 23, 2026 10:33
@pawicao
pawicao removed this pull request from stack #10660 September 23, 2026 10:34
@pawicao
pawicao added this pull request to stack #10674 September 23, 2026 10:34
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch from ed53545 to e665f90 Compare September 23, 2026 10:37
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch 2 times, most recently from ba8e23e to 3a9f0e6 Compare September 23, 2026 11:28
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch 2 times, most recently from cf8b07b to dc00278 Compare September 24, 2026 12:23
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch from dc00278 to 7fc6e5c Compare September 24, 2026 13:10
@pawicao
pawicao force-pushed the @pawicao/hinge-sensor-docs branch from 7fc6e5c to aa51470 Compare September 24, 2026 14:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant