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

rn-leanback

v1.0.5

Published

Leanback implementation for React Native Android TV

Downloads

322

Readme

react-native-leanback

Android TV leanback wrapper for React Native

Installation

Move styles.xml and values.xml to your androidtv resources folder.

Install via package.json:

"@reactseals/react-native-leanback": "2.0.3"

Install from the command line:

npm install @reactseals/[email protected]

Usage

import { Row } from '@reactseals/react-native-leanback';

<Row
    data={data}
    attributes={{
        width: 313,
        height: 173,
    }}
    style={{ width: '100%' }}
    title="Title for row"
    onFocus={(item) => console.log(item)}
    onPress={(item) => console.log(item)}
/>
import { Grid } from 'react-native-leanback';

<Grid
    data={data}
    attributes={{
        width: 313,
        height: 173,
    }}
    style={{ width: '100%' }}
    onFocus={(item) => console.log(item)}
    onPress={(item) => console.log(item)}
    onDataIdsReady={(item) => console.log(item)}
/>

Data Model

| Key | Required | Description | | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- | | id | yes | Unique id of the card | | cardImageUrl | yes | Card image url | | videoUrl | no | Video url | | title | no | Title of the card, visible underneath of the image | | description | no | Description of the card, visible underneath of the title | | displayLiveBadge | no | Hides or displays live stream badge | | liveBadgeColor | no | Color of the badge which represents live stream | | liveProgressBarColor | no | Progress bar color | | overlayImageUrl | no | Url of overlay image visible on the top of the card image | | overlayText | no | Overlay text visible on the top of card image | | overlayPosition | no | Position of overlay text | | progress | no | Percentage which indicates progress of live stream | | backgroundColor | no | Background color of the card | | programStartTimestamp | no | Timestamp of live stream start. Must be combined with programEndTimestamp then progress gets automatically calculated | | programEndTimestamp | no | Timestamp of live stream end. Must be combined with programStartTimestamp then progress gets automatically calculated | | viewId | no | Unique viewId which can be used to prevent or force focus. If it's not defined then random unique id is generated automatically |

Props

| Prop | Type | Default | Description | | ------------------------------------ | ---------------------------------------------- | ----------- | --------------------------------------------------------------------------------------------- | | data | array | | Data for row. See Data Model | | style | object | | Container holder style | | title | string | | Row title | | numOfCols | enum(4, 5, 6) | 4 | Number how many columns grid should contain(Grid only) | | showOnlyFocusedInfo | boolean | false | Show info field block underneath ONLY when card is focused(Grid only) | | forbiddenFocusDirections | array of enum('up', 'down', 'left', 'right') | | Prevents any element to be focused when user navigates out of grid/row to provided directions | | nextFocusUpId | string | | Designates the next view to receive focus when the user navigates up | | nextFocusDownId | string | | Designates the next view to receive focus when the user navigates down | | nextFocusLeftId | string | | Designates the next view to receive focus when the user navigates left | | nextFocusRightId | string | | Designates the next view to receive focus when the user navigates right | | attributes.width | integer | | Width of card | | attributes.height | integer | | Height of card | | attributes.cardShape | enum('round', 'square') | square | Shape of the card | | attributes.focusedCardAlignment | enum('left', 'center') | center | Alignment of focus | | attributes.numberOfRows | number | 1 | Number of rows in Row component | | attributes.borderRadius | number | | Border radius | | attributes.imageTransformationMode | enum('noTransformation','centerCrop') | fitCenter | Transformation mode of the card image |

Methods

requestFocus()

Imperative method for requesting focus of specific Row or Grid E.g.

ref.current.requestFocus()

Here ref.current refers to the ref passed to the Grid or Row component.

Example

//TODO