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

[Android TV] Adjacent Scrollviews strange D-Pad behaviour at start/end of view #20100

Closed
2 of 3 tasks
Weetbix opened this issue Jul 8, 2018 · 1 comment
Closed
2 of 3 tasks
Labels
Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@Weetbix
Copy link

Weetbix commented Jul 8, 2018

Unable to test this on 0.56 as it's currently broken on windows.

Environment

Environment:
  OS: Windows 10
  Node: 8.5.0
  Yarn: 1.1.0
  npm: 5.3.0
  Watchman: Not Found
  Xcode: N/A
  Android Studio: Not Found

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: 0.55.4 => 0.55.4

Description

When we have 2 or more horizontal ScrollViews, the D-Pad navigation behaviour is strange when navigating past the beginning or end of the ScrollView.

When at the beginning or end of the scrollview, if there are any off screen elements in an adjacent scroll view, navigating with the D-Pad in their direction will navigate to an item in that horizontal scrollview.

For example:

  • There are 2 horizontal scroll views, with 10 items each, of which only 5 are displayed on screen
  • Navigate to the last item in the first scroll view
  • Navigate right once again
  • Notice the focus moves to the right-most visible item in the second scroll view.

Alternatively:

  • There are 2 horizontal scroll views, with 10 items each, of which only 5 are displayed on screen
  • On the top list, navigate all the way to the last item
  • Switch to the second list, and make sure the first item is highlighted
  • Navigate left (the end of the list)
  • Notice focus shifts up to the item in the horizontal scroll view above.

In these situations I would not expect any navigation to occur at all.

Here is a gif illustrating the issue, where only D-Pad left or right are used:

scollbug2

This combined with #20099, #19917 make it impossible to make a well behaving, standard style android TV app with nested scrollviews (a la youtube etc). :

Reproducible Demo

import React, {Component} from 'react';
import {View, Text, TouchableOpacity, ScrollView} from 'react-native';

export default class App extends Component {
  render() {
    const data = [];
    for (let i = 0; i < 10; i++)
      data.push(i);

    return (
      <View>
        {[1, 2].map(() => (
          <ScrollView horizontal style={{height: 210}}>
            {data.map(i => (
              <TouchableOpacity key={i}>
                <View
                  style={{
                    backgroundColor: 'grey',
                    width: 200,
                    height: 200,
                  }}
                >
                  <Text style={{fontSize: 60}}>{i}</Text>
                </View>
              </TouchableOpacity>
            ))}
          </ScrollView>
        ))}
      </View>
    );
  }
@react-native-bot
Copy link
Collaborator

I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label Jul 16, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Jul 18, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
facebook-github-bot pushed a commit that referenced this issue Feb 21, 2019
Summary:
Add properties to be able to set the nextFocus. It can be very useful with Android TV.

New android View properties :

* nextFocusDown binded to [setNextFocusDownId](https://developer.android.com/reference/android/view/View.html#setNextFocusDownId(int))
* nextFocusForward binded to [setNextFocusForwardId](https://developer.android.com/reference/android/view/View.html#setNextFocusForwardId(int))
* nextFocusLeft binded to [setNextFocusLeftId](https://developer.android.com/reference/android/view/View.html#setNextFocusLeftId(int))
* nextFocusRight binded to [setNextFocusRightId](https://developer.android.com/reference/android/view/View.html#setNextFocusRightId(int))
* nextFocusUp binded to [setNextFocusUpId](https://developer.android.com/reference/android/view/View.html#setNextFocusUpId(int))

Can be used to fix :

* Fixes #20593
* Fixes #20100

Same PR as #22080 but accorded to changes on master
Pull Request resolved: #22082

Differential Revision: D14162740

Pulled By: cpojer

fbshipit-source-id: 9a13a185d4e8307ce67014fb076c62d135c487c3
mbardauskas pushed a commit to mbardauskas/react-native that referenced this issue Feb 21, 2019
Summary:
Add properties to be able to set the nextFocus. It can be very useful with Android TV.

New android View properties :

* nextFocusDown binded to [setNextFocusDownId](https://developer.android.com/reference/android/view/View.html#setNextFocusDownId(int))
* nextFocusForward binded to [setNextFocusForwardId](https://developer.android.com/reference/android/view/View.html#setNextFocusForwardId(int))
* nextFocusLeft binded to [setNextFocusLeftId](https://developer.android.com/reference/android/view/View.html#setNextFocusLeftId(int))
* nextFocusRight binded to [setNextFocusRightId](https://developer.android.com/reference/android/view/View.html#setNextFocusRightId(int))
* nextFocusUp binded to [setNextFocusUpId](https://developer.android.com/reference/android/view/View.html#setNextFocusUpId(int))

Can be used to fix :

* Fixes facebook#20593
* Fixes facebook#20100

Same PR as facebook#22080 but accorded to changes on master
Pull Request resolved: facebook#22082

Differential Revision: D14162740

Pulled By: cpojer

fbshipit-source-id: 9a13a185d4e8307ce67014fb076c62d135c487c3
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants