头像选择底部弹层
在设置界面点按头像,会滑出一个内嵌式弹层,展示十二张矢量头像,背景随之变暗。选中后加上绿色对勾徽标,个人头像交叉淡化为新头像。用 react-native-svg 绘制,共用 core。
灵感来自 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 "avatar-picker-bottom-sheet" to this project. The full source is attached at the end of this prompt. Put the files under components/avatar-picker-bottom-sheet/, 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 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个设置风格的页面,包含个人资料卡片和菜单列表。点按头像会打开一个底部面板,它在屏幕内向上滑出,左右两侧略有内缩,圆角与屏幕圆角保持一致,同时背后的页面变暗。面板中是三列排列的十二个手绘头像网格。选中某个头像后会出现绿色对勾,个人资料头像通过短暂的交叉淡化替换,新头像从较小尺寸放大出现。点按变暗区域或再次点按头像,面板会以短暂的缓入滑动关闭,变暗层则以更慢的速度淡出。没有输入时,它会循环播放演示。
实现方式
头像和菜单图标是 react-native-svg 绘制的矢量图,由共享 JavaScript 核心中的元素列表生成,因此没有位图。同一个核心保存几何数据,以及一个接收时间和打开、关闭、选择事件列表的时间线函数,演示和交互模式因此共享代码。面板的进入和变暗层使用从参考稿拟合的曲线,点击区域由 Pressable 处理。requestAnimationFrame 循环推进每一帧。
适用场景
- 设置流程中的头像或个人照片选择器
- 任何即时预览并应用所选项的底部面板
- 选项为小型插图的主题化选择器
依赖
react-native-svgreact-native标签
头像底部弹层卡片交叉淡化展开收起浅色列表极简个人主页设置页社交弹簧状态切换