Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

1k-ui-recipes1k 用户界面食谱

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

1,212

周安装

50

GitHub Stars

2,377

下载量

396
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:1k-ui-recipes(1k 用户界面食谱)
来源仓库:https://github.com/onekeyhq/app-monorepo
仓库路径:skills/1k-ui-recipes
安装命令:
npx skills add https://github.com/onekeyhq/app-monorepo --skill 1k-ui-recipes
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/onekeyhq/app-monorepo --skill 1k-ui-recipes

简介

适用于解决 iOS 标签页滚动偏移、复杂状态切换动画及响应式布局适配等具体交互问题。

  • 核心能力包括提供 useScrollContentTabBarOffset 等即用型代码片段, 优化触摸手势识别与键盘遮挡输入框等实现方案。
  • 使用方式是通过引入对应模块并调用相关函数集成到现有项目中。
  • 安装需通过 npx skills add 命令从 GitHub 仓库获取,注意部分功能仅限 Codex、Cursor 等宿主环境支持。

SKILL.md

OneKey UI Recipes

Bite-sized solutions for common UI issues.

Quick Reference

RecipeGuideKey Points
iOS Tab Bar Scroll Offsetios-tab-bar-scroll-offset.mdUse useScrollContentTabBarOffset for paddingBottom on iOS tab pages
Smooth State Transitionsstart-view-transition.mdWrap heavy state updates in startViewTransition for fade on web
Horizontal Scroll in Collapsible Tab Headerscollapsible-tab-horizontal-scroll.mdBidirectional Gesture.Pan() + programmatic scrollTo via CollapsibleTabContext
Android Bottom Tab Touch Interceptionandroid-bottom-tab-touch-intercept.mdTemporaryGestureDetector + Gesture.Tap() in .android.tsx to bypass native tab bar touch stealing
Keyboard Avoidance for Input Fieldskeyboard-avoidance.mdKeyboardAwareScrollView auto-scroll, Footer animated padding, useKeyboardHeight / useKeyboardEvent hooks
iOS Overlay Navigation Freezeios-overlay-navigation-freeze.mdUse resetAboveMainRoute() instead of sequential goBack() to close overlays before navigating
Web keyboardDismissMode Cross-Tab BlurNever use on-drag on web; it globally blurs inputs via TextInputState

Critical Rules Summary

1. iOS Tab Bar Scroll Content Offset

Use useScrollContentTabBarOffset to add dynamic paddingBottom to scroll containers inside tab pages. Returns tab bar height on iOS, undefined on other platforms.

import { useScrollContentTabBarOffset } from '@onekeyhq/components';

const tabBarHeight = useScrollContentTabBarOffset();
<ScrollView contentContainerStyle={{ paddingBottom: tabBarHeight }} />

2. Smooth State Transitions with startViewTransition

Wrap heavy state updates in startViewTransition — fade on web/desktop via View Transition API, setTimeout fallback on native.

import { startViewTransition } from '@onekeyhq/components';

startViewTransition(() => {
  setIsReady(true);
});

3. Horizontal Scroll in Collapsible Tab Headers (Native)

When placing a horizontal scroller inside renderHeader of collapsible tabs, use Gesture.Pan() that handles both directions — horizontal drives translateX, vertical calls scrollTo on the focused tab's ScrollView via CollapsibleTabContext.

import { CollapsibleTabContext } from '@onekeyhq/components';
Do NOT import directly from react-native-collapsible-tab-view/src/Context. Always use the @onekeyhq/components re-export.

4. Android Bottom Tab Touch Interception (Temporary Workaround)

Temporary fix — the root cause is react-native-bottom-tabs intercepting touches even when hidden. This workaround should be removed once the upstream issue is fixed.

On Android, react-native-bottom-tabs intercepts touches in the tab bar region even when the tab bar is GONE. Buttons near the bottom of the screen become unclickable. Fix by creating a .android.tsx variant that wraps buttons with GestureDetector + Gesture.Tap():

import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import { runOnJS } from 'react-native-reanimated';

const tapGesture = useMemo(
  () => Gesture.Tap().onEnd(() => { 'worklet'; runOnJS(onPress)(); }),
  [onPress],
);

<GestureDetector gesture={tapGesture}>
  <View>
    <Button>Label</Button>
  </View>
</GestureDetector>
Use .android.tsx file extension so other platforms are unaffected.

5. Keyboard Avoidance for Input Fields

Standard Page and Dialog components handle keyboard avoidance automatically. Only add manual handling for custom layouts.

  • Page inputs: Automatic — PageContainer wraps with KeyboardAwareScrollView (90px bottomOffset)
  • Page Footer: Automatic — animates paddingBottom via useReanimatedKeyboardAnimation
  • Dialog: Automatic — keyboard avoidance is handled at the Dialog level for all dialogs (including showFooter: false)
  • Custom layout: Use Keyboard.AwareScrollView with custom bottomOffset
import { Keyboard } from '@onekeyhq/components';

// Custom scrollable area with keyboard avoidance
<Keyboard.AwareScrollView bottomOffset={150}>
  {/* inputs */}
</Keyboard.AwareScrollView>

// Dismiss keyboard before navigation
await Keyboard.dismissWithDelay();

Hooks for custom behavior:

import { useKeyboardHeight, useKeyboardEvent } from '@onekeyhq/components';

const height = useKeyboardHeight(); // 0 when hidden

useKeyboardEvent({
  keyboardWillShow: (e) => { /* e.endCoordinates.height */ },
  keyboardWillHide: () => { /* ... */ },
});
Use useKeyboardEventWithoutNavigation for components outside NavigationContainer (Dialog, Modal).

6. iOS Overlay Navigation Freeze (resetAboveMainRoute)

On iOS with native UITabBarController, closing overlay routes (Modal, FullScreenPush) via sequential goBack() calls triggers an RNSScreenStack window-nil race condition. Popped pages' screen stacks lose their iOS window reference and enter a retry storm (50 retries × ~100ms), freezing navigation for ~5 seconds.

Symptom: After closing a modal, the app appears stuck on the home page. A touch on the screen "unsticks" navigation.

Root cause: goBack() triggers animated modal dismiss. Screen stacks inside detached tab views get window=NIL and retry indefinitely until the retry limit (50) is exhausted.

Fix: Use resetAboveMainRoute() to atomically remove all overlay routes via CommonActions.reset instead of sequential goBack() calls.

import { resetAboveMainRoute, rootNavigationRef } from '@onekeyhq/components';

// ❌ WRONG: Sequential goBack() causes iOS window-nil freeze
const closeModalPages = async () => {
  rootNavigationRef.current?.goBack();
  await timerUtils.wait(150);
  await closeModalPages(); // recursive — each call triggers native animation
};
await closeModalPages();
await timerUtils.wait(250);
rootNavigationRef.current?.navigate(targetRoute);

// ✅ CORRECT: Atomic reset, no orphaned screen stacks
resetAboveMainRoute();
await timerUtils.wait(100);
rootNavigationRef.current?.navigate(targetRoute);
Key file: packages/components/src/layouts/Navigation/Navigator/NavigationContainer.tsx Reference: commit 2cabd040 (OK-50182) — same fix applied to scan QR code navigation.

7. Web: ScrollView keyboardDismissMode="on-drag" Causes Cross-Tab Input Blur

On web, react-native-web's keyboardDismissMode="on-drag" calls dismissKeyboard() on every scroll event. dismissKeyboard() uses TextInputState — a global singleton that tracks the currently focused input across the entire app, not scoped to individual tabs. This means a ScrollView scrolling on a background tab (e.g. Home) will blur an input on the active tab (e.g. Perps).

Symptom: Input fields lose focus periodically (~every 5 seconds) without user interaction.

Root cause chain:

  1. Carousel on Home tab has autoPlayInterval={5000} → triggers scroll every 5s
  2. Web PagerView uses <ScrollView keyboardDismissMode="on-drag">dismissKeyboard() on scroll
  3. dismissKeyboard()TextInputState.blurTextInput(currentlyFocusedField()) → blurs Perps input

Fix (two layers):

  • Carousel/pager.tsx (web-only): Force keyboardDismissMode="none" — web has no virtual keyboard, so dismiss is pure side-effect
  • Carousel/index.tsx: Pause auto-play via IntersectionObserver when the Carousel is not visible in viewport

Rules:

  • NEVER use keyboardDismissMode="on-drag" on web ScrollViews that may run in background tabs. On web, it globally blurs the focused input via TextInputState.
  • For Carousel/PagerView, the web pager.tsx already forces "none". For standalone ScrollViews, wrap with platformEnv.isNative if on-drag is needed only on mobile.
  • Background Carousel auto-play should be paused when not visible (IntersectionObserver).
// ❌ WRONG: Will blur inputs on other tabs when this ScrollView scrolls
<ScrollView keyboardDismissMode="on-drag" />

// ✅ CORRECT: Only use on-drag on native
<ScrollView keyboardDismissMode={platformEnv.isNative ? 'on-drag' : 'none'} />
Key files: packages/components/src/composite/Carousel/pager.tsx, packages/components/src/composite/Carousel/index.tsx

Related Skills

  • /1k-cross-platform - Platform-specific development
  • /1k-performance - Performance optimization
  • /1k-coding-patterns - General coding patterns

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.6%
按下载量换算137

Claude

31.21%
按下载量换算124

Cursor

18.6%
按下载量换算74

Gemini CLI

9.22%
按下载量换算37

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills