npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-tvos-controller

v0.2.4

Published

TvOS remote controller module for react native.

Downloads

419

Readme

react-native-tvos-controller

npm version Awesome

TvOS remote controller module for react native. Including "tap","long press","swipe" and "pan" gesture.

React Native for TVOS

react-native-tvos-controller demo video

Install

npm install --save react-native-tvos-controller

Automatically link

With React Native 0.27+

react-native link react-native-tvos-controller

With older versions of React Native

You need rnpm (npm install -g rnpm)

rnpm link react-native-tvos-controller

Manually link

If Automatically link can't work, you should link the module manually. Manually Link Tutorial

  1. Add the following to your Project: node_modules/react-native-tvos-controller/ios/RNtvoscontroller.xcodeproj

  2. Add the following to Link Binary With Libraries: libRNtvoscontroller.a

  3. Add the following to your Header Search Paths: $(SRCROOT)/../node_modules/react-native-tvos-controller/ios/RNtvoscontroller

Usage

import reactNativeTvosController from "react-native-tvos-controller"

connect

reactNativeTvosController.connect()

Connect the remote controller of apple TV.

enablePanGesture

reactNativeTvosController.enablePanGesture();

You will receive the specific moving offset tracing data if you enable the pan gesture. You can't receive the swipe event anymore.

You can receive the swipe event and other gestures when it was enabled simultaneously recognizing reactNativeTvosController.enableRecognizeSimultaneously()

disablePanGesture

reactNativeTvosController.disablePanGesture();

You won't receive the specific moving offset tracing data if you disable the pan gesture. You can continue receiving the swipe event.

enableRecognizeSimultaneously

reactNativeTvosController.enableRecognizeSimultaneously();

Events from all recognizers are sending simultaneously.

disableRecognizeSimultaneously

reactNativeTvosController.disableRecognizeSimultaneously();

Disable. Events will be send from the first recognized gesture recognizer.

subscribe

Subscribe the native events of Apple TV's remote controller.

events

TAP
var tapSubscription = reactNativeTvosController.subscribe('TAP',
    (e) => {
      console.log("tapped");
      console.log(JSON.stringify(e));
      /*
      e.type : "PlayPause" || "Menu" || "Select" || "UpArrow" || "DownArrow" || "LeftArrow" || "RightArrow"
      e.code : 0 || 1 || 2 || 3 || 4 || 5 || 6
      */
    });
    tapSubscription(); //Cancel Subscription
SWIPE
var swipeSubscription = reactNativeTvosController.subscribe('SWIPE',
    (e) => {
      console.log("swiped");
      console.log(JSON.stringify(e));
      /*
      e.direction : "Right" || "Down" || "Left" || "Up"
      e.code : 0 || 1 || 2 || 3
      */
    });
    swipeSubscription(); //Cancel Subscription
LONGPRESS
var longPressSubscription = reactNativeTvosController.subscribe('LONGPRESS',
    (e) => {
      console.log("longPressed");
      console.log(JSON.stringify(e));
      /*
      e.state : "Began" || "Ended"
      e.code : 0 || 1
      */
    });
    longPressSubscription(); //Cancel Subscription
PAN
var panSubscription = reactNativeTvosController.subscribe('PAN',
    (e) => {
      console.log("panned");
      console.log(JSON.stringify(e));
      /*
      e.state : "Began" || "Changed" || "Ended"
      e.x : (x offset)
      e.y : (y offset)
      e.velocityX : number
      e.velocityY : number
      */
    });
    panSubscription(); //Cancel Subscription