{"id":4016,"url":"https://github.com/iddan/react-native-canvas","last_synced_at":"2025-05-14T19:02:19.607Z","repository":{"id":30106140,"uuid":"33655927","full_name":"iddan/react-native-canvas","owner":"iddan","description":"A Canvas component for React Native","archived":false,"fork":false,"pushed_at":"2024-06-02T10:23:51.000Z","size":1362,"stargazers_count":1011,"open_issues_count":32,"forks_count":171,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-11T06:17:33.824Z","etag":null,"topics":["canvas","graphics","javascript","native","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iddan.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-09T07:53:25.000Z","updated_at":"2025-03-23T02:38:25.000Z","dependencies_parsed_at":"2024-06-24T05:05:37.615Z","dependency_job_id":null,"html_url":"https://github.com/iddan/react-native-canvas","commit_stats":{"total_commits":166,"total_committers":21,"mean_commits":7.904761904761905,"dds":0.536144578313253,"last_synced_commit":"329a2f9c5d1ba6958260511faf070550c66a983c"},"previous_names":["lwansbrough/react-native-canvas"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iddan%2Freact-native-canvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iddan%2Freact-native-canvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iddan%2Freact-native-canvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iddan%2Freact-native-canvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iddan","download_url":"https://codeload.github.com/iddan/react-native-canvas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351394,"owners_count":21089272,"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":["canvas","graphics","javascript","native","react"],"created_at":"2024-01-05T20:16:58.541Z","updated_at":"2025-04-11T06:17:38.332Z","avatar_url":"https://github.com/iddan.png","language":"JavaScript","readme":"# 🎆 react-native-canvas\n\nA Canvas component for React Native\n\n```bash\nnpm install react-native-webview\nreact-native link react-native-webview\nnpm install react-native-canvas\n```\n\n### Usage\n\n```JSX\nimport React, { Component } from 'react';\nimport Canvas from 'react-native-canvas';\n\nconst App = () =\u003e {\n  const handleCanvas = (canvas) =\u003e {\n    if (!canvas) return;\n\n    const ctx = canvas.getContext('2d');\n    ctx.fillStyle = 'purple';\n    ctx.fillRect(0, 0, 100, 100);\n  };\n\n  return (\n    \u003cCanvas ref={handleCanvas}/\u003e\n  );\n}\n```\n\n### API\n\n#### Canvas\n\n###### Canvas#height\n\nReflects the height of the canvas in pixels\n\n###### Canvas#width\n\nReflects the width of the canvas in pixels\n\n###### Canvas#getContext()\n\nReturns a canvas rendering context. Currently only supports 2d context.\n\n###### Canvas#toDataURL()\n\nReturns a `Promise` that resolves to DataURL.\n\n#### CanvasRenderingContext2D\n\nStandard CanvasRenderingContext2D. [MDN](https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D). Only difference is `await` should be used to retrieve values from methods.\n\n```javascript\nconst ctx = canvas.getContext(\"2d\");\n```\n\n#### Image\n\nWebView Image constructor. Unlike in the browsers accepts canvas as first argument. [MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image)\n\n```javascript\nconst image = new Image(canvas, height, width);\n```\n\n#### Path2D\n\nPath2D API constructor. Unlike in the browsers, this requires the canvas as first argument. See also https://developer.mozilla.org/en-US/docs/Web/API/Path2D/Path2D.\n\n```javascript\nconst path = new Path2D(canvas);\n```\n","funding_links":[],"categories":["Components","JavaScript","Libraries"],"sub_categories":["UI","Others"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiddan%2Freact-native-canvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiddan%2Freact-native-canvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiddan%2Freact-native-canvas/lists"}