Skip to content

Conversation

exzos28
Copy link

@exzos28 exzos28 commented Oct 14, 2025

Summary:

  1. Passing a ref causes a crash in the web:

Here, a single ref is used both for working with useImperativeHandle and for obtaining the position via getBoundingClientRect.

However, when calling getBoundingClientRect, the ref does not exist. It is likely that the implementation of useImperativeHandle has changed in React19 and its createHandle callback overrides current.

  1. Fix updateValue via ref - always call the onValueChange callback.

Test Plan:

I've create an ControlledSliderExample in src/Examples:

Screen.Recording.2025-10-14.at.15.12.43.mov

@exzos28 exzos28 changed the title fix: replace createRef with useRef for refs and handle onSlidingComplete callback exzos 5 minutes ago fix: separate the internal ref from the external one for correct operation of useImperativeHandle and getBoundingClientRect Oct 14, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

return (
<View
ref={containerRef}
ref={containerRef as any}
Copy link

Choose a reason for hiding this comment

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

Bug: Ref Typing Issue Breaks DOM Access

The forwardedRef no longer provides access to the component's DOM element, instead only exposing the updateValue imperative handle. This breaks consumers expecting DOM access (e.g., getBoundingClientRect). The internal containerRef is typed as HTMLElement but requires as any when assigned to the View component, indicating a type mismatch and bypassing type safety.

Fix in Cursor Fix in Web

@exzos28
Copy link
Author

exzos28 commented Oct 22, 2025

anyone?

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