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 - TVEventHandler doesn't recognize D-Pad (arrow) event's #20924

Closed
3 tasks done
davidwico opened this issue Aug 30, 2018 · 3 comments
Closed
3 tasks done

Android TV - TVEventHandler doesn't recognize D-Pad (arrow) event's #20924

davidwico opened this issue Aug 30, 2018 · 3 comments
Labels
Platform: Android Android applications. Platform: Linux Building on Linux. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@davidwico
Copy link

davidwico commented Aug 30, 2018

Environment

React Native Environment Info:
    System:
      OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
      CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      Memory: 2.07 GB / 15.42 GB
      Shell: 4.4.19 - /bin/bash
    Binaries:
      Node: 8.9.0 - ~/.nvm/versions/node/v8.9.0/bin/node
      npm: 5.5.1 - ~/.nvm/versions/node/v8.9.0/bin/npm
    SDKs:
      Android SDK:
        Build Tools: 23.0.1, 23.0.2, 25.0.1, 25.0.2, 25.0.3, 26.0.2, 27.0.3, 28.0.1
        API Levels: 21, 22, 23, 24, 25, 26, 27
    npmPackages:
      react: 16.4.1 => 16.4.1 
      react-native: latest => 0.56.0 
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1

Tested on Android Studio, TV emulator and two physical android TV boxes. All devices with android 8.0 and the same result of testing.

Description

According to official documentation https://facebook.github.io/react-native/docs/building-for-apple-tv
it's possible to intercept D-Pad events like:

(evt && evt.eventType === 'left')
but it seems to not work. The only events I can intercept are: focus, blur, select and playPause.

rn

Code

import React, { Component } from 'react';
import { View, Text, TouchableHighlight, Button, Image } from 'react-native';

var TVEventHandler = require('TVEventHandler');

export default class MainScreenContainer extends Component {
  enableTVEventHandler() {
    this.tvEventHandler = new TVEventHandler();
    this.tvEventHandler.enable(this, function(cmp, evt) {
      if (evt) {
        console.log(evt);
      }
    });
  }

  componentDidMount() {
    this.enableTVEventHandler();
  }

  consoleHello = () => {
    console.log('Hello');
  };

  render() {
    return (
      <View style={{ flex: 1 }}>
        <Button hasTVPreferredFocus onPress={this.consoleHello} title="Hello1" />
        <TouchableHighlight touchableHandleActivePressIn onPressIn={this.consoleHello} onPress={this.consoleHello}>
          <Text> Touch Here </Text>
        </TouchableHighlight>
        <Button onPress={this.consoleHello} title="Hello3" />
      </View>
    );
  }
}

Three simple focusable elements to navigate between. I tried to get Up, Down events while navigating between buttons/touchable component. No results. Only blur, select, focus, playPause.

Anyone can help me ?

Update:

Today I receive new bluetooth remote for testing that contains more buttons.
Situation is the same (arrow actions still don't recognized) but there are 2 more events that get recognized by TVEventHandler (rewind and fastForward).

rn3

@davidwico davidwico changed the title Android TV - TVEventHandler don't recognize all event's Android TV - TVEventHandler doesn't recognize D-Pad (arrow) event's Aug 30, 2018
@react-native-bot react-native-bot added the Platform: Android Android applications. label Aug 30, 2018
@react-native-bot
Copy link
Collaborator

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.

@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.56 and verify if the issue still exists.

The ":rewind:Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@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 Sep 15, 2018
facebook-github-bot pushed a commit that referenced this issue Sep 24, 2018
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes #20924
DPad arrow events were missing from `KEY_EVENTS_ACTIONS` which meant that they were not broadcasted by `TVEventHandler`.
Pull Request resolved: #21143

Differential Revision: D10007851

Pulled By: mdvacca

fbshipit-source-id: 9a03cad249a4a1917975d1de10b6112e69d32a72
grabbou pushed a commit that referenced this issue Oct 2, 2018
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes #20924
DPad arrow events were missing from `KEY_EVENTS_ACTIONS` which meant that they were not broadcasted by `TVEventHandler`.
Pull Request resolved: #21143

Differential Revision: D10007851

Pulled By: mdvacca

fbshipit-source-id: 9a03cad249a4a1917975d1de10b6112e69d32a72
t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes facebook#20924
DPad arrow events were missing from `KEY_EVENTS_ACTIONS` which meant that they were not broadcasted by `TVEventHandler`.
Pull Request resolved: facebook#21143

Differential Revision: D10007851

Pulled By: mdvacca

fbshipit-source-id: 9a03cad249a4a1917975d1de10b6112e69d32a72
@facebook facebook locked as resolved and limited conversation to collaborators Sep 15, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. Platform: Linux Building on Linux. 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