Open alvaroguzmancode opened 3 years ago
:warning: | Missing Reproducible Example |
---|---|
:information_source: | It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner. |
In other versions we use for detect control events as Fire TV. https://reactnative.dev/docs/building-for-tv
Same issue but on Android TV. It used to be defined within the react-native module and working in react-native 0.61.5, however after upgrading to 0.63.0 it's no longer found.
Using the documentation which states var TVEventHandler = require('TVEventHandler');
. Using this throws TVEventHandler could not be found within the project or in these directories
when access like this._tvEventHandler = new TVEventHandler();
It looks like this issue was raised when this module got removed because of the 'react-native-tvos' fork of react-native. The developers knew that TVEventHandler would break for Android and my guess is that since react-native-tvos is used for Android and tvOS it was removed as well. Makes sense.
I think the documentation needs to be updated so that 'TVEventHandler' is part of the react-native-tvos but it's currently saying it's part of react-native.
I solved it in version 0.63.4 importing it like this import TVEventHandler from 'react-native/Libraries/Components/AppleTV/TVEventHandler';
I solved it in version 0.63.4 importing it like this
import TVEventHandler from 'react-native/Libraries/Components/AppleTV/TVEventHandler';
Did that work for your Fire TV as well considering it's Android based?
I've gotten it to work myself on 0.63.4 but through the react-native package:
import { TVEventHandler } from 'react-native';
Yep, it working on android. I saw the solution you tell me on other pages, but it didn't work for me.
Makes me wonder... is the entire TV support for Android TV being removed? Earlier there used to be a TVTouchable.js under Libraries/Components/Touchable which was used for handling the focus/blur/select events for Touchable components for TV.
Those events keep working, I use with TouchableOpacity and manage the focus with states and custom styles.
my SOLUTION:
TVEventHandler will not work with default react-native": "0.64, you will have to change it with "react-native": "npm:react-native-tvos@latest" To do so, use this command: yarn add react-native@npm:react-native-tvos@latest then clean and rebuild your project. 🎉
Description
const TVEventHandler = require('TVEventHandler'); not found In other versions it is found in node_modules/react-native/Libraries/Components/AppleTV/TVEventHandler.js
React Native version:
System: OS: Linux 5.10 Kali GNU/Linux Rolling 2021.1 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 6.73 GB / 32 GB Shell: 5.8 - /usr/bin/zsh Binaries: Node: 12.21.0 - /usr/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.5.2 - /usr/bin/npm Watchman: Not Found SDKs: Android SDK: Not Found IDEs: Android Studio: Not Found Languages: Java: 11.0.11-ea - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.0 => 0.64.0 npmGlobalPackages: react-native: Not Found Thanks for you atention.