{"id":26214405,"url":"https://github.com/ljunb/react-native-instrument-board","last_synced_at":"2025-04-15T18:41:47.941Z","repository":{"id":92176806,"uuid":"111688363","full_name":"ljunb/react-native-instrument-board","owner":"ljunb","description":"一个应用于React Native App的仪表盘组件。","archived":false,"fork":false,"pushed_at":"2017-11-27T14:47:43.000Z","size":184,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T21:45:33.785Z","etag":null,"topics":["board","instrument","react-native"],"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/ljunb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-11-22T13:34:39.000Z","updated_at":"2022-05-17T09:02:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"b002a91e-ee09-458b-a3e6-02f59bf4e4b2","html_url":"https://github.com/ljunb/react-native-instrument-board","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/ljunb%2Freact-native-instrument-board","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljunb%2Freact-native-instrument-board/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljunb%2Freact-native-instrument-board/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljunb%2Freact-native-instrument-board/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljunb","download_url":"https://codeload.github.com/ljunb/react-native-instrument-board/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249084155,"owners_count":21210150,"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":["board","instrument","react-native"],"created_at":"2025-03-12T10:16:55.249Z","updated_at":"2025-04-15T18:41:47.934Z","avatar_url":"https://github.com/ljunb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-instrument-board\n\n[![npm](https://img.shields.io/npm/v/react-native-instrument-board.svg)](https://www.npmjs.com/package/react-native-instrument-board)\n[![npm](https://img.shields.io/npm/dt/react-native-instrument-board.svg)](https://www.npmjs.com/package/react-native-instrument-board)\n[![npm](https://img.shields.io/npm/l/react-native-instrument-board.svg)](https://github.com/ljunb/react-native-instrument-board/blob/master/LICENSE)\n\n该组件源于公司项目，当前业务主要用于反馈买车用户的一个消费态度，工作之余就将其抽取出来了。主要还是当做一个记录，如果后续时间允许，会考虑写一篇关于做这个组件的文章，写写当时遇到的问题和一些技术点。组件依赖于`react-native-svg`，所以基本是`SVG`绘制语句的应用。目前测试情况来看，可能需要 RN \u003e= 0.50.0 😶😶~\n\n如果你想在项目中使用，Android 下可能需要修改项目的 support 包到 25 版本，如 `example` 中的 [gradle 文件](https://github.com/ljunb/react-native-instrument-board/blob/master/example/android/app/build.gradle) 所示。\n\n## 示例效果\n![demo](https://github.com/ljunb/screenshots/blob/master/instrument_board.jpeg)\n\n## 安装\n\n使用`npm`：\n```\nnpm install react-native-instrument-board --save\n```\n用`yarn`：\n```\nyarn add react-native-instrument-board \n```\n安装后，需要执行以下命令：\n```\nreact-native link react-native-svg\n```\n\n## 运行example\n进入项目根目录\n```\ncd example\nnpm install\nreact-native run-ios/run-android\n```\n\n## 参数\n\n名称              | 类型   |  默认值      | 参数描述\n----------------  | ------ | -------- | -----------  \npercentage             | number |  80  | 进度百分比，内圈红色部分，范围0-100\nradius             | number |  150  | 仪表盘半径，注意是外圈半径 \nstrokeWidth              | number |   8   | 仪表盘边框宽度\nstartAngle         | number |   36   | 仪表盘0°位置的角度，以经过仪表盘圆点的垂直线作为基准，顺时针方向的角度\ncontentStrokeColors        | array |   [颜色数组]    |  仪表盘每个区间的边框颜色，与区间个数对应，数组格式\ndegreeTexts     | array | ['0', '1.0', '2.0', '3.0', '4.0'] | 仪表盘刻度值数组\ndegreeTextRadius | number | 118 | 仪表盘刻度值的半径，决定了刻度值的显示位置\ndegreeTextStartOffset | array | ['4%', '0', '0', '0'] | 用于调整仪表盘刻度值偏移量的数组\ndegreeTextColor      | string | '#999' | 刻度值文本颜色\ncontentTexts | array | ['精打细算', '理想消费', '不差钱', '有的是钱'] | 仪表盘分段内容的数组\ncontentTextRadius   | number | 120 | 类似于`degreeTextRadius`仪表盘分段内容的半径，决定了内容区的显示位置\ncontentTextStartOffset   | array | ['28%', '28%', '35%', '28%'] | 类似于`degreeTextStartOffset`，用于调整内容区文本的偏移量\ncontentTextColor  | string | '#999' | 仪表盘分段内容的文本颜色\nprogressRadius    | number | 110  | 进度条半径\nprogressBackgroundColor | string | '#ccc' | 进度条背景颜色\nprogressRadius    | string | 'rgb(234, 0, 22)' | 进度条指示颜色\nneedleRadius   | number  | 80  | 仪表盘指针半径，指圆心至针尖之间长度\nneedleAngle   | number  | 60  | 仪表盘指针角度，指针在中心圆边缘上所占的扇形角度\ncenterSpotRadius | number | 16 | 仪表盘中心圆半径\nanimated  | bool | true | 是否开启动画，暂时只有`Animated.spring`模式\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljunb%2Freact-native-instrument-board","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljunb%2Freact-native-instrument-board","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljunb%2Freact-native-instrument-board/lists"}