{"id":13773666,"url":"https://github.com/doodlewind/react-ssd1306","last_synced_at":"2025-04-06T21:16:04.961Z","repository":{"id":45788388,"uuid":"218877030","full_name":"doodlewind/react-ssd1306","owner":"doodlewind","description":"📟 A React Renderer for SSD1306 OLED chip on Raspberry Pi.","archived":false,"fork":false,"pushed_at":"2022-10-07T15:24:20.000Z","size":92,"stargazers_count":379,"open_issues_count":3,"forks_count":25,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-30T19:09:09.134Z","etag":null,"topics":["c-module","demo","quickjs","raspberry-pi","react-native","react-renderer","ssd1306","tutorial"],"latest_commit_sha":null,"homepage":"https://github.com/doodlewind/react-ssd1306/blob/master/docs/tutorial.md","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doodlewind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-31T23:18:40.000Z","updated_at":"2025-03-25T01:45:03.000Z","dependencies_parsed_at":"2023-01-19T14:10:15.673Z","dependency_job_id":null,"html_url":"https://github.com/doodlewind/react-ssd1306","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodlewind%2Freact-ssd1306","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodlewind%2Freact-ssd1306/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodlewind%2Freact-ssd1306/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodlewind%2Freact-ssd1306/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doodlewind","download_url":"https://codeload.github.com/doodlewind/react-ssd1306/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247550691,"owners_count":20956987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-module","demo","quickjs","raspberry-pi","react-native","react-renderer","ssd1306","tutorial"],"created_at":"2024-08-03T17:01:18.746Z","updated_at":"2025-04-06T21:16:04.940Z","avatar_url":"https://github.com/doodlewind.png","language":"C","readme":"# React SSD1306\nA React Renderer for SSD1306 OLED chip on Raspberry Pi\n\n![](./docs/demo.jpg)\n\nFor those who doesn't have the device, a canvas-based web emulator is also included!\n\n## Introduction\nThis project demonstrates how to:\n\n* Use React together with [QuickJS](https://bellard.org/quickjs/) on Raspberry Pi.\n* Develop basic C module for QuickJS.\n* Build a custom \"**native \u0026 dynamic**\" renderer for React.\n\nCheckout the [Tutorial](./docs/tutorial.md), or my [Chinese blog post](https://ewind.us/2019/react-ssd1306) for details. \n\n## Getting Started\nThis project is originally designed to work on Raspberry Pi, but a web emulator is also available and works out of the box. Notice that no matter you run it on web or native, the whole React-related codebase is exactly the same.\n\n### Web Approach\nYou can try out the reconciler example, even if you don't have a Raspberry Pi. In this way only Node.js and [ParcelJS](https://parceljs.org/) are required:\n\n``` bash\ncd react-ssd1306/app\nparcel src/index.html\n```\n\nThen just open `https://localhost:1234` to see the emulator.\n\n### Native Approach\nConnect the chip, make sure you have QuickJS and Node.js installed on your Raspberry Pi, with I2C interface enabled. Few extra packages are also required:\n\n``` bash\nsudo apt-get install i2c-tools libi2c-dev\n```\n\n\u003e Node.js is only required for JS module bundling and package management here.\n\nInit the project:\n\n``` bash\ncd react-ssd1306/app\nnpm install \u0026\u0026 cd ..\nnpm run build # build JS and C modules\nnpm start # start the compiled binary\n```\n\n## Usage\nSimply edit `./app/index.js` as main entrance:\n\n``` js\nimport './polyfill.js'\nimport React from 'react'\nimport { SSD1306Renderer, Text, Pixel } from './renderer.js'\n\nclass App extends React.Component {\n  constructor () {\n    super()\n    this.state = { hello: 'Hello React!', p: 0 }\n  }\n\n  render () {\n    const { hello, p } = this.state\n    return (\n      \u003cReact.Fragment\u003e\n        \u003cText row={0} col={0}\u003e{hello}\u003c/Text\u003e\n        \u003cText row={1} col={0}\u003eHello QuickJS!\u003c/Text\u003e\n        \u003cPixel x={p} y={p} /\u003e\n      \u003c/React.Fragment\u003e\n    )\n  }\n\n  componentDidMount () {\n    // XXX: Emulate event driven update\n    setTimeout(() =\u003e this.setState({ hello: 'Hello Pi!', p: 42 }), 2000)\n    setTimeout(() =\u003e this.setState({ hello: '', p: -1 }), 4000)\n  }\n}\n\nSSD1306Renderer.render(\u003cApp /\u003e)\n```\n\n## License\nMIT\n","funding_links":[],"categories":["Hardware","C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoodlewind%2Freact-ssd1306","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoodlewind%2Freact-ssd1306","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoodlewind%2Freact-ssd1306/lists"}