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

[androidTV] Scrollview still scrollable with dpad when scrollEnabled={false} #29774

Closed
TheDuc opened this issue Aug 26, 2020 · 16 comments
Closed
Labels
Component: ScrollView Platform: Android Android applications. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@TheDuc
Copy link

TheDuc commented Aug 26, 2020

Description

A scrollview with the scrollEnabled prop set to false still scrolls on tv remote dpad input on androidTV.
Also onScroll events are fired when the list is scrolled this way.

React Native version:

0.61.5

Expected Results

The scrollview should not scroll when scrollEnabled is set to false, regardless of touch, mouse or dpad input.

@gedeagas
Copy link
Contributor

gedeagas commented Aug 26, 2020

@TheDuc can you confirm this behavior still exist on the latest react-native version?

Support for handling DPAD is already merged.
00c8b3c

@TheDuc
Copy link
Author

TheDuc commented Aug 28, 2020

@gedeagas Thanks for your comment, but that merge is also in the 0.61.5 release.
Currently the executeKeyEvent method is overridden, but that does not seem to work correctly.
I have overridden the dispatchKeyEvent method with the same code, and that seems to work, but needs more testing

@gedeagas
Copy link
Contributor

gedeagas commented Aug 28, 2020

Yeah, I just try this out yesterday and can confirm that it's not working. And changing executeKeyEvent dispatchKeyEvent fixes the problem.

@TheDuc can you make a pr about this on ReactHorizontalScrollView & ReactScrollView. And thx for making an issue.

@safaiyeh
Copy link
Contributor

Thanks for the issue @TheDuc and thank you for investigating @gedeagas!

Accepting this as a valid issue.

@freddieerg
Copy link

freddieerg commented Sep 3, 2020

As a hack, if you add snapToInterval (also broken on dpad), scrollEnabled should behave as expected. I found this out because I'm currently trying to create a horizontal FlatList that will move a set interval amount on dpad-left & dpad-right. Thought I'd be able to do it with snapToInterval but it's completely broken with dpad.

@TheDuc
Copy link
Author

TheDuc commented Nov 10, 2020

any updates on this? I created this merge request quite a long time ago, and nothing has happened.
The issue still persists even with the latest React-Native version (0.63.3 as of now)

@safaiyeh
Copy link
Contributor

Hi @TheDuc thanks for the PR. You might have an easier time merging into react-native-tvos as they maintain Android TV as well

@TheDuc
Copy link
Author

TheDuc commented Nov 11, 2020

@safaiyeh Thanks for the response, I will create a PR for react-native-tvos, however, the readme and the name clearly state that it is mainly Apple TV focused.
Moreover, may I hereby conclude that the react-native "Learn once, write anywhere" paradigm is completely abandoned, as far as tv's are concerned anyways?

@safaiyeh
Copy link
Contributor

Yeah I talked to the maintainer of tvos today. They are working on renaming and making it clear they are maintaining AndroidTV.

Core RN is focused on Android and iOS. Other platforms are maintained by other folks but are still unified in your app's codebase. Creating all native components for platforms is a big task for 1 repo, so it's spread out amongst people who have a bigger stake in other platforms

@prakash-altair
Copy link

prakash-altair commented Nov 12, 2020

@TheDuc @gedeagas @safaiyeh I tried with overriding dispatchKeyEvent but it dosen't work scroll view still scrolls
I have a Vertical ScrollView with scrollEnabled={false} and inside it have a multiple HorizontalScrollView with scrollEnabled={false}. When Dpad up down is presses HorizontalScrollview which is present inside Vertical ScrillView moves like listview.
As attached in the image even when focus is on left menu scrollview scrolls
Screenshot_1605201615

@TheDuc
Copy link
Author

TheDuc commented Nov 12, 2020

@prakash-altair Indeed, the fix is not working anymore since this PR #25105.
If you revert only those changes and apply my fix, it will work again.

@prakash-altair
Copy link

prakash-altair commented Nov 15, 2020

@TheDuc
Thanks for the lead.
Just doing changes mentioned here will solve the issue. No need of changes as mentioned in your PR

@TheDuc
Copy link
Author

TheDuc commented Nov 17, 2020

@prakash-altair Thanks for raising this issue in the react-native-tvos repository and for your efforts!
That change does solve other issues for me but unfortunately not the scrolling issue.
I have a list of items and I only want to programmatically scroll to the next (scrollToIndex) on arrow press.
The behaviour I still see is that on arrow press the list scrolls a little bit first, and after that calls scrollToIndex and correctly scrolls to the next item.

@prakashjais99
Copy link

@TheDuc have you set scrollEnabled={false} working great for me after setting this prop

@github-actions
Copy link

github-actions bot commented Jul 1, 2023

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jul 1, 2023
@github-actions
Copy link

github-actions bot commented Jul 8, 2023

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as completed Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: ScrollView Platform: Android Android applications. Resolution: PR Submitted A pull request with a fix has been provided. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

7 participants