Skip to content
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

Wrong highlighted element when using scrollTo method of Scroll View #10

Open
deyanskiq opened this issue May 9, 2022 · 3 comments
Open
Labels
bug Something isn't working question Further information is requested

Comments

@deyanskiq
Copy link

I'm trying to implement an overlay tutorial with highlighting on different components of a scrollable home page.

When scrolling the home page (using a combination of scroll view reference and scrollTo method), the highlighted element is not the correct one. Its position offset is equal to the distance from how much the screen was scrolled down.

Attaching a screenshot (red squared is the expected position)

Screenshot 2022-05-09 at 16 21 51

@Charanor
Copy link
Owner

Can you show me your code? Is the overlay inside the scroll view also? If not; can you try to place the overlay inside the scroll view?

@Charanor Charanor added bug Something isn't working question Further information is requested labels May 10, 2022
@davidteejay
Copy link

I'm experiencing this too. I put the overlay as the last item in the scroll view, and added a delay in highlighting the element until after scrollTo is done. After scrolling and setting the highlight, the highlight is placed in the wrong place

@Charanor
Copy link
Owner

Charanor commented Aug 14, 2024

I'm experiencing this too. I put the overlay as the last item in the scroll view, and added a delay in highlighting the element until after scrollTo is done. After scrolling and setting the highlight, the highlight is placed in the wrong place

Without a minimal verifiable code example it's hard to debug and help.

Also did you check these two steps in the README?

  1. In certain setups, the position of the highlighted element might be off by a fraction. If this happens to you, set the rootRef of HighlightableElementProvider manually to the root element of your app. However in most circumstances this is not necessary.
  2. If your HighlightedElement is inside a scroll view (like in the demo video above) the HighlightOverlay must also be inside the scroll view, otherwise the highlighted element will not properly overlay the "root" element. This is because of how React Native handles measuring positions & sizes. I'm working on possible fixes to make this more user-friendly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants