天热头疼吃什么药| 怀孕初期不能吃什么| 佛珠生菇讲述什么道理| 烧心吃什么食物好得快| 天蝎座是什么星座| 小学生什么时候开学| 血红蛋白是指什么| 梦到吃肉是什么意思周公解梦| 什么生长| 破伤风针有什么作用| 安宫牛黄丸什么时候吃| 是否是什么意思| 人流后吃什么药| 港澳通行证办理需要什么证件| 未退化胸腺是什么意思| 梦见僵尸是什么预兆| 一饿就胃疼是什么原因| emma是什么意思| 什么叫骨质增生| 闰六月有什么讲究| 红眼病滴什么眼药水| 仙灵脾又叫什么| 生殖细胞是什么| 解解乏是什么意思| 生殖疱疹用什么药效果好| 身体逐渐消瘦是什么原因| 四川属于什么气候| 死猪不怕开水烫是什么意思| 甲减要多吃什么食物好| 类风湿因子高说明什么| 胃烧灼吃什么立马缓解| 胃萎缩是什么意思| 章鱼吃什么食物| hb是什么意思| 梦见自己理发是什么意思| 茶叶属于什么类目| 看胃挂什么科室| 月经不调看什么科室| ecco是什么品牌| 大便羊屎粒是什么原因| 蝉代表什么生肖| 如何看五行缺什么| 做三明治需要什么材料| 甲状腺球蛋白低是什么意思| 夜长梦多是什么意思| 广菜是什么菜| 骨髓不造血是什么病| 下巴底下长痘痘是什么原因| 屌丝是什么| 老年人腿疼是什么原因引起的| 粉底和气垫的区别是什么| 莲子是什么| 脚酸疼是什么原因引起的吗| 转氨酶是什么意思| 血压低容易得什么病| 腾蛇是什么意思| 三候是什么意思| 长脓包是什么原因| 第一次见女方家长带什么礼物好| 床上放什么可以驱蟑螂| 附件炎吃什么药效果好| 出岫是什么意思| 抽油烟机买什么样的好| 什么是地包天牙齿图片| 怄气是什么意思| 信指什么生肖| 子宫占位是什么意思| 孕妇能吃什么| 尿酸高是什么意思| 性生活是什么感觉| 脸上突然长斑是什么原因引起的| 凌晨6点是什么时辰| 缺钾吃什么食物补得最快| 双子和什么星座最配| 2020属什么生肖| 什么朦胧| 科举制什么时候废除| 人丝是什么面料| 甘蔗什么时候成熟| 工勤人员是什么意思| 为什么狐臭女很漂亮| 什么东西有助于睡眠| 流鼻血是什么病的前兆| 前列腺液是什么东西| 女王是什么意思| 兰陵为什么改名枣庄| 鱼露是什么味道| 糖皮质激素是什么药| 治疗幽门螺旋杆菌用什么药| 糖尿病的诊断标准是什么| 筷子买什么材质的好| 水上漂是什么意思| 什么都没有| 胃热口干口苦口臭吃什么药好| 什么食物补气血| 什么饮料不含糖| 慢性胃炎吃什么好| 橘红是什么| 亚撒西是什么意思| 仕字五行属什么| 祥林嫂是什么样的人| 孩子睡觉咬牙齿是什么原因引起的| 8月13号什么星座| 姜子牙属什么生肖| 领盒饭是什么意思| 什么人不能喝豆浆| 血脂高有什么症状表现| 少一个睾丸有什么影响| 中华田园犬为什么禁养| 尿蛋白高是什么原因| 拉杆箱什么材质的好| 饱和脂肪酸是什么| 罗西尼手表什么档次| 胸闷气短是什么原因| 指甲看什么科| 木瓜是什么季节的水果| 甲泼尼龙是什么药| 吃什么对肺有好处| 什么矿泉水最好| 粿条是什么做的| 轱辘是什么意思| 奶嚼口是什么| 瓜尔佳氏现在姓什么| 经常喝藕粉有什么好处| 牛肉和什么不能一起吃| 我好想你是什么歌| 现在什么时辰| 什么什么如什么| 缝纫机油是什么油| 什么奶粉比较好| 健脾祛湿吃什么药| 四月七号是什么星座| horns是什么意思| 血小板低是什么症状| 狗狗打疫苗前后要注意什么| 男戴观音女戴佛是什么意思| 尿路感染 吃什么| 胸口正中间疼是什么病| 素有是什么意思| 宫颈hpv感染是什么病| 儿童正常体温在什么范围| 言过其实是什么意思| 一个火一个丙念什么| 阴虚火旺吃什么中药| tac是什么| 梦见买衣服是什么预兆| 血压低吃什么东西好| 焯水什么意思| 日出东方下一句是什么| 什么药降尿酸最好| 三月初六是什么星座| 人活着的意义是什么| 直肠ca是什么意思| 痢疾是什么原因引起的| 喝胶原蛋白肽有什么好处| 胃反流吃什么药好| 不能生育的女人有什么特征| 什么牌子的冰箱最好| scarves是什么意思| 眼睑炎用什么药| 做梦梦见大火是什么意思| 十三幺是什么意思| mlb是什么牌子| 维生素c阳性是什么意思| 一拃长是什么意思| 冰箱里有什么细菌| 青苹果什么时候成熟| 王秋儿和王冬儿什么关系| 南无阿弥陀佛是什么意思| 因果是什么意思| 左束支传导阻滞是什么意思| 干可以加什么偏旁| 腹泻什么意思| 女生安全期什么意思| 浑水摸鱼是什么意思| 一度电是什么概念| 朱砂有什么作用与功效| 小狗能吃什么水果| 淋巴肉为什么不能吃| 醋泡花生米有什么功效| 偏光镜是什么意思| 迪赛尼斯属于什么档次| 治疗肝脏硬化要吃什么药好| 夏天猪骨煲什么汤最好| 疝气是什么病怎样治疗| 画蛇添足是什么生肖| 虎眼石五行属什么| 抗核抗体阳性是什么意思| 鱼字五行属什么| 偏好是什么意思| 尿床去医院挂什么科| 什么洗发水好| 咳嗽吐血是什么原因| 倒刺是什么原因引起的| 7.22是什么星座| 11度穿什么衣服| 恢复伤口吃什么好得快| 2020是什么生肖| 脂肪肝有什么症状| 双肾盂是什么意思| 膝盖积水是什么原因造成的| 左氧氟沙星治什么| 规培是什么| 灵隐寺求什么最灵验| 户口分户需要什么条件| 芒果吃多了有什么坏处| 济南有什么好吃的| 下象棋有什么好处| 时间短吃什么药| 为什么尽量不打免疫球蛋白| 临床路径是什么意思| 10.31什么星座| 前置胎盘是什么原因引起的| 经常过敏是什么原因| 血常规是什么意思| 釜底抽薪是什么计| ad是什么病| 物以类聚形容什么动物| 一个骨一个宽是什么字| 猫传腹是什么| 冠状动脉ct检查什么| 下午五点是什么时辰| 垂爱是什么意思| 一动就大汗淋漓是什么原因| 尿泡多是什么原因| 红蓝光照射有什么作用| 手指甲上有白点是什么原因| 急性中耳炎吃什么药| 网络诈骗打什么电话| 电泳是什么意思| 水痘长什么样子的图片| 咖啡过敏的症状是什么| 浅笑嫣然是什么意思| 什么东东| 间质性肺炎是什么意思| 什么什么团结| 什么时候种胡萝卜最好| 男生生日礼物送什么| 什么是肠漏| 腹泻是什么原因| 吃豆腐什么意思| 防冻液红色和绿色有什么区别| 为什么会突然得荨麻疹| 拔罐红色是什么原因| 男模是什么| 左侧头疼是什么原因引起的| norm是什么意思| 胸部dr是什么| 蛇属于什么类动物| 梦见刺猬是什么意思| 尿道口发炎用什么药| 蚊子会传染什么病| 产检挂什么科| 左旋肉碱是什么东西| 中国的国球是什么球| 九月三号是什么星座| 鼻塞流清鼻涕吃什么药| 老觉得饿是什么原因| 亡羊补牢的寓意是什么| kcal是什么意思| 细胞是什么| 什么什么团结| 有口无心是什么意思| 内瘘是什么意思| 百度
Skip to content
This repository was archived by the owner on Apr 26, 2025. It is now read-only.

raphamorim/react-tv

Repository files navigation

react-tv: React Renderer for low memory applications.

react-tv-cli: React Packager for TVs.

Currently under development.

React-TV Logo

import React from 'react'
import ReactTV, { Platform } from 'react-tv'

class Clock extends React.Component {
  state = { date: new Date() }

  componentDidMount() {
    setInterval(() => this.setState({date: new Date()}), 1000)
  }

  render() {
    if (Platform('webos')) {
      return (
        <h1>Time is {this.state.date.toLocaleTimeString()}</h1>
      )
    }

    return <h2>This App is available only at LG webOS</h2>
  }
}

ReactTV.render(<Clock/>, document.getElementById('root'))

Summary

About React-TV

React-TV is an ecosystem for TV based React applications (from the renderer to CLI for pack/build applications).
At the moment we're focusing on webOS and SmartTV.
React-TV's aims to be a better tool for building and developing fast for TVs.

Understanding the Problem

tl;dr: Crafting a high-performance TV user interface using React

Crafting a high-performance TV user interface using React is a real challenge, because of some reasons:

  • Limited graphics acceleration
  • Single core CPUs
  • High Memory Usage for a common TV App

These restrictions make super responsive 60fps experiences especially tricky. The strategy is step in the renderer: Applying reactive concepts to unblock the processing on the renderer layer, plug the TV's keyListener, avoid React.createElement.

In addition: Unify the build for multiple TV platforms.

Articles

Friendly list of tutorials and articles:

To install react-tv-cli (CLI Packager):

$ yarn global add react-tv-cli
Support for React-TV-CLI
Target Platform Status Available Version
LG webOS stable 0.3.1
Samsung Tizen ongoing x
Samsung Orsay not started yet x
Sony PS4 not started yet x
Nintendo Switch not started yet x

Developing for webOS

Short Description: webOS, also known as Open webOS or LG webOS, (previously known as HP webOS and Palm webOS, stylized as webOS) is a Linux kernel-based multitasking operating system for smart devices such as Smart TVs and it has been used as a mobile operating system.


First of all, setup your webOS Environment:

Then, init your react-tv project:

$ react-tv-cli init <my-app-name>

From the project directory, install the dependencies to enable building:

$ yarn install

You will need to keep the list of files related to your app on the React-TV entry up to date in package.json. The init command will already add index.html, bundle.js and style.css to the package.

{
  "name": "my-app-name",
  "react-tv": {
    "files": [
      "index.html",
      "bundle.js",
      "style.css"
    ]
  }
}

To build your project:

$ yarn build

Once the project is built, you can run it on a specific device or emulator:

$ react-tv-cli run-webos <device>
  • When you not specify the device, it runs on VirtualBox webOS Simulator

To install react-tv (React Renderer):

$ yarn add react-tv

Platform

When building a cross-platform TV app, you'll want to re-use as much code as possible. You'll probably have different scenarios where different code might be necessary.
For instance, you may want to implement separated visual components for LG-webOS and Samsung-Tizen.

React-TV provides the Platform module to easily organize your code and separate it by platform:

import { Platform } from 'react-tv'

console.log(Platform('webos')) // true
console.log(Platform('tizen')) // false
console.log(Platform('orsay')) // false

renderOnAppLoaded

Takes a component and returns a higher-order component version of that component, which renders only after application was launched, allows to not write diffent logics for many devices.

import { renderOnAppLoaded } from 'react-tv'

const Component = () => (<div></div>)
const App = renderOnAppLoaded(Component)

findDOMNode

Similar to react-dom findDOMNode

Navigation

If you want to start with Navigation for TVs. React-TV provides a package for spatial navigation with declarative support based on Netflix navigation system.

React-TV Navigation exports withFocusable and withNavigation which act as helpers for Navigation.

import React from 'react'
import ReactTV from 'react-tv'
import { withFocusable, withNavigation } from 'react-tv-navigation'

const Item = ({focused, setFocus, focusPath}) => {
  focused = (focused) ? 'focused' : 'unfocused'
  return (
    <div onClick={() => { setFocus() }} >
      It's {focused} Item
    </div>
  )
}

const Button = ({setFocus}) => {
  return (
    <div onClick={() => { setFocus('item-1') }}>
      Back To First Item!
    </div>
  )
}

const FocusableItem = withFocusable(Item)
const FocusableButton = withFocusable(Button)

function App({currentFocusPath}) {
  return (
    <div>
      <h1>Current FocusPath: '{currentFocusPath}'</h1>,
      <FocusableItem focusPath='item-1'/>
      <FocusableItem focusPath='item-2'/>
      <FocusableButton
        focusPath='button'
        onEnterPress={() => console.log('Pressed enter on Button!')}/>
    </div>
  )
}

const NavigableApp = withNavigation(App)

ReactTV.render(<NavigableApp/>, document.querySelector('#app'))

See examples/navigation for more details about usage.

Examples

Clock App Example

Youtube App Example

References:

webOS

Videos

Windows
OSX

Essentials to beginner

Developing for SmartTV Guidelines

React Basics and Renderer Architecture

Roadmap

Stage 1

Initial proof-of-concept. [DONE]

  • CLI Build Abstraction of LG webOS (run-webos, run-webos-dev)
  • Create a guide or script to Install all LG webOS environment
  • Renderer ReactElements to simple DOM
    • Support HOF and HOC
    • Support State and Lifecycle
    • Keyboard Navigation
  • Check webos Platform
  • Migrate to React-Reconciler

Stage 2 [IN PROGRESS]

Implement essential functionality needed for daily use by early adopters.

  • Support render to Canvas instead DOM using React.CanvasComponent
  • run-webos support TV device as param
  • Optmizate DOMRenderer for TV
  • Start CLI for Tizen
  • Develop helpers for webOS debbug (e.g: Log System).
  • Support Cross Platform
    • Check executable bin path for Windows, OSX and Linux
  • Bind all TV key listeners on React.Element
  • Improve documentation
  • Benchmark it

Stage 3

Add additional features users expect from a Renderer. Then fix bugs and stabilize through continuous daily use. At this point we can start to experiment with innovative ideas and paradigms.

  • Start CLI for Orsay
  • Update Benchmarks
  • Handle common errors
  • Reactive Renderer
  • Testing and stability

See ReactTV's Changelog.

Currently ReactTV is licensed by MIT License

Credits

Thanks react-dom for be example and a inspiration code :)

既视感什么意思 92年的属什么生肖 日加立念什么字 鹅口疮是什么原因引起的 1980属什么
ybb是什么意思 蚊子长什么样 连续打喷嚏是什么原因 prime是什么意思 心率快是什么原因引起的
女人经期吃什么食物好 明天是什么 神经系统是由什么组成的 什么的芦苇 塞翁失马是什么意思
我是什么结构 白蛋白下降是什么原因 硕的拼音是什么 考号是什么 煞气是什么意思
肺结节看什么科hcv9jop4ns3r.cn 夏朝前面是什么朝代hcv7jop6ns6r.cn 牛膝有什么功效hcv8jop1ns6r.cn nsfw什么意思96micro.com 搁浅了是什么意思hcv7jop4ns5r.cn
五常法指的是什么hcv8jop0ns7r.cn 红细胞高是什么原因hcv8jop1ns4r.cn 梦到拔牙是什么预兆hcv9jop6ns3r.cn 轮回是什么意思hcv9jop6ns2r.cn 胰腺炎恢复期吃什么好hcv8jop1ns7r.cn
指甲扁平是什么原因hcv8jop0ns8r.cn 经常吃豆腐有什么好处和坏处hcv8jop5ns0r.cn 肺部条索影是什么意思hcv9jop1ns2r.cn 什么是有机食品和无机食品hcv9jop8ns0r.cn 狗下崽前有什么征兆hcv8jop9ns4r.cn
腰痛宁胶囊为什么要用黄酒送服hcv7jop6ns0r.cn 血沉是查什么hcv7jop6ns8r.cn 黄骨鱼是什么鱼hcv7jop7ns2r.cn 梦见自己和别人结婚是什么意思hcv8jop7ns3r.cn 中书舍人是什么官职hcv8jop7ns0r.cn
百度