expo-dynamic-tray 是一个用于 React Native 的变形、感知键盘的底部托盘组件,具有自动适应内容尺寸、多视图历史导航和滑动关闭功能。

Stars

154

7 天增长

暂无数据

Fork 数

11

开放 Issue

0

开源协议

暂无数据

最近更新

2026-07-02

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

它结合了弹簧驱动的变形动画(translateY、背景透明度、缩放)、自动适应内容、真正的导航历史栈,并通过 react-native-keyboard-controller 跟随键盘,在单个组件中提供了类似原生应用的感觉。

适合谁使用

  • 正在构建自定义底部表单或模态框的 React Native 开发者
  • 寻求精致、键盘感知托盘的 Expo 用户
  • 需要在表单内部实现多视图导航且保留固定底部的团队
  • 偏好 TypeScript 优先、类型完备 API 的开发者

典型使用场景

  • 设置面板,变形打开并跟随键盘
  • 多步骤表单或向导,带返回导航的底部表单
  • 可滑动关闭、自动适应内容的操作列表
  • 需要固定底部(如主要操作按钮)的自定义模态框

项目优势

  • 弹簧动画使打开/关闭过程流畅且连贯
  • 自动适应内容尺寸,无需固定高度或手动计算
  • 多视图历史栈配合淡入淡出过渡,支持自然的层级导航
  • 键盘跟随功能让托盘无需额外工作即可保持在键盘上方

使用前须知

  • 需要多个对等依赖(reanimated、手势处理器、键盘控制器等),未内置
  • 专为 Expo SDK 56 和 React Native 0.85 构建,与旧版本兼容性有限
  • 相对较新的库,尚未经过大量社区测试,不如更成熟的底部表单方案稳定

README 快速开始

expo-dynamic-tray

A morphing, keyboard-aware bottom-sheet tray for React Native.

✨ Features

  • 🫧 Morphing presentation — a single spring drives translateY, backdrop opacity, and sheet scale together, so the tray grows into place instead of just sliding
  • 📐 Auto-sizing — the sheet springs to whatever its content measures; no fixed heights to maintain
  • 🧭 Multi-view navigation with a real history stack — setView("…") pushes, goBack() unwinds however deep you went
  • 🎞️ Crossfade + scale morph between views (incoming views scale/fade in, outgoing ones fade out) for a continuous, first-party feel
  • ⌨️ Keyboard-following via react-native-keyboard-controller — the tray lifts itself above the keyboard and stays glued to it
  • 👆 Swipe / flick to dismiss with both distance-threshold and velocity detection, plus a spring rubber-band return
  • 🧩 Persistent footer slot — pass footer per view; it never unmounts while switching views, so buttons don't pop or collide
  • 🪝 Imperative or declarative — open with `` or drive it from anywhere with useTray().open()
  • 🧠 TypeScript-first, fully typed surface

⚙️ Installation

git clone https://github.com/rit3zh/expo-dynamic-tray
cd expo-dynamic-tray
bun start -c

Peer dependencies (already wired up in this template):

bun add react-native-reanimated react-native-gesture-handler react-native-safe-area-context react-native-keyboard-controller @expo/ui expo-symbols

🚀 Usage

Wrap your app once with GestureHandlerRootView and KeyboardProvider, then compose a `` anywhere in the tree.

// app/_layout.tsx
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { KeyboardProvider } from "react-native-keyboard-controller";

export default function RootLayout() {
  return (
    
      
        
      
    
  );
}

The simplest possible tray — one trigger, one view:

import { Tray } from "@/components/tray";
import { Text, View } from "react-native";

export function Example() {
  return (
    
      
        Show Tray
      

      
        
          
            Dynamic Tray
            Springs to its content's size and follows the keyboard.
          
        
      
    
  );
}

Preview

https://github.com/user-attachments/assets/f4359500-fa88-464f-a4e9-894903401c1a

Opening imperati

项目描述

📚 A morphing, keyboard-aware bottom-sheet tray.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

TanStack
精选
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web 开发前端框架
14,861
vercel-labs
精选
vercel-labs GitHub avatar

scriptc

scriptc compiles ordinary TypeScript into small, fast native executables without needing Node.js, V8, or any JavaScript runtime in the binary.

开发者工具代码质量与构建
1,985
Jakubantalik
精选
Jakubantalik GitHub avatar

thinking-orbs

A React component library that renders six hand-tuned animated thought orb loading indicators on a plain 2D canvas, with two purpose-tuned sizes and automatic theme detection for AI and agent UIs.

AI 与机器学习AI 智能体
1,191