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

react-native-instrument-board

v0.0.4

Published

[![npm](https://img.shields.io/npm/v/react-native-instrument-board.svg)](https://www.npmjs.com/package/react-native-instrument-board) [![npm](https://img.shields.io/npm/dt/react-native-instrument-board.svg)](https://www.npmjs.com/package/react-native-inst

Downloads

58

Readme

react-native-instrument-board

npm npm npm

该组件源于公司项目,当前业务主要用于反馈买车用户的一个消费态度,工作之余就将其抽取出来了。主要还是当做一个记录,如果后续时间允许,会考虑写一篇关于做这个组件的文章,写写当时遇到的问题和一些技术点。组件依赖于react-native-svg,所以基本是SVG绘制语句的应用。目前测试情况来看,可能需要 RN >= 0.50.0 😶😶~

如果你想在项目中使用,Android 下可能需要修改项目的 support 包到 25 版本,如 example 中的 gradle 文件 所示。

示例效果

demo

安装

使用npm

npm install react-native-instrument-board --save

yarn

yarn add react-native-instrument-board 

安装后,需要执行以下命令:

react-native link react-native-svg

运行example

进入项目根目录

cd example
npm install
react-native run-ios/run-android

参数

名称 | 类型 | 默认值 | 参数描述 ---------------- | ------ | -------- | -----------
percentage | number | 80 | 进度百分比,内圈红色部分,范围0-100 radius | number | 150 | 仪表盘半径,注意是外圈半径 strokeWidth | number | 8 | 仪表盘边框宽度 startAngle | number | 36 | 仪表盘0°位置的角度,以经过仪表盘圆点的垂直线作为基准,顺时针方向的角度 contentStrokeColors | array | [颜色数组] | 仪表盘每个区间的边框颜色,与区间个数对应,数组格式 degreeTexts | array | ['0', '1.0', '2.0', '3.0', '4.0'] | 仪表盘刻度值数组 degreeTextRadius | number | 118 | 仪表盘刻度值的半径,决定了刻度值的显示位置 degreeTextStartOffset | array | ['4%', '0', '0', '0'] | 用于调整仪表盘刻度值偏移量的数组 degreeTextColor | string | '#999' | 刻度值文本颜色 contentTexts | array | ['精打细算', '理想消费', '不差钱', '有的是钱'] | 仪表盘分段内容的数组 contentTextRadius | number | 120 | 类似于degreeTextRadius仪表盘分段内容的半径,决定了内容区的显示位置 contentTextStartOffset | array | ['28%', '28%', '35%', '28%'] | 类似于degreeTextStartOffset,用于调整内容区文本的偏移量 contentTextColor | string | '#999' | 仪表盘分段内容的文本颜色 progressRadius | number | 110 | 进度条半径 progressBackgroundColor | string | '#ccc' | 进度条背景颜色 progressRadius | string | 'rgb(234, 0, 22)' | 进度条指示颜色 needleRadius | number | 80 | 仪表盘指针半径,指圆心至针尖之间长度 needleAngle | number | 60 | 仪表盘指针角度,指针在中心圆边缘上所占的扇形角度 centerSpotRadius | number | 16 | 仪表盘中心圆半径 animated | bool | true | 是否开启动画,暂时只有Animated.spring模式