带环形进度的努力程度滑动弹层
弹层在变暗的页面上升起,用于给努力打 1 到 10 分。点按十根柱条之一或拖动滑块,圆环每级增长 36 度,柱条按区间换色,区间标题随之切换;点 Save 更新页面。核心 Animated 与 react-native-svg。
灵感来自 X 上的一条帖子由 Now In Code 从零重建
import { Piece } from "./components";
export function Example() {
const progress = useSharedValue(0);
…
export function Example() {
const progress = useSharedValue(0);
…
Agent 提示词
Add the Now In Code component "effort-level-slider-sheet-with-ring" to this project. The full source is attached at the end of this prompt. Put the files under components/effort-level-slider-sheet-with-ring/, install the listed dependencies with `npx expo install`, and render it on a route I can open. Keep the timing and easing values documented in the source comments. Replace the sample copy and artwork with content from my app, or leave placeholders and list what I still need to supply. === Source files are attached here for paid plans ===
Pro 作品。提示词包含完整源码。开始使用
详情
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个底部弹出面板,用于选择 1 到 10 的强度等级。十根竖条从左到右逐渐变高变宽,拖动手指划过轨道即可设定等级。读数旁边的圆环随数值增加分步填充,颜色和名称在四个区间之间变化:轻松、适中、困难和最大,每个区间都有一行说明,例如说话是否轻松。面板会在变暗的背景上滑入,关闭时滑回;面板上有确认选择的按钮,并提供返回所选值的回调。
实现方式
全部由普通 React Native 加 react-native-svg 实现。滑块是类似 Pressable 的响应区域,在按下和移动时把触摸的 x 位置换算为 1 到 10 的整数。圆环是 SVG 弧线,每一步扫过 36 度,区间颜色随数值变化在相邻区间颜色之间混合。面板进入和退出使用内置 Animated 的 timing,配合近似 iOS 的缓动曲线和原生驱动,涵盖位移、透明度和遮罩层。没有手势库,也没有 Reanimated。
适用场景
- 健身应用中的训练强度或主观用力程度评分
- 1 到 10 的评分,带有标签区间帮助用户选择
- 通过回调返回单一值的紧凑面板选择器
依赖
react-native-svgreact-native标签
数据分析按钮图表拖拽渐变健康健身浅色弹窗彩色活泼进度条滑杆弹簧滑动手势