- Android TV
- 🚧 tvOS
- Native layer: To run React Native project on Android TV make sure to make the following changes to
Platform.android.js. You can check whether code is running on Android TV by doing
Access to touchable controls: When running on Android TV the Android framework will automatically apply a directional navigation scheme based on relative position of focusable elements in your views. The
Touchablemixin has code added to detect focus changes and use existing methods to style the components properly and initiate the proper actions when the view is selected using the TV remote, so
TouchableNativeFeedbackwill work as expected. In particular:
onFocuswill be executed when the touchable view goes into focus
onBlurwill be executed when the touchable view goes out of focus
onPresswill be executed when the touchable view is actually selected by pressing the "select" button on the TV remote.
TV remote/keyboard input: A new native class,
ReactAndroidTVRootViewHelper, sets up key events handlers for TV remote events. When TV remote events occur, this class fires a JS event. This event will be picked up by instances of the
TVEventHandlerand listen for these events, as in the following code:
Dev Menu support: On the simulator, cmd-M will bring up the developer menu, similar to Android. To bring it up on a real Android TV device, press the menu button or long press the fast-forward button on the remote. (Please do not shake the Android TV device, that will not work :) )
InputTextcomponents do not work for now (i.e. they cannot receive focus).