Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问许可证需确认审计通过

ionic-reactionic React 前端

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

1,435

周安装

61

GitHub Stars

19

下载量

503
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:ionic-react(ionic React 前端)
来源仓库:https://github.com/capawesome-team/skills
仓库路径:skills/ionic-react
安装命令:
npx skills add https://github.com/capawesome-team/skills --skill ionic-react
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/capawesome-team/skills --skill ionic-react

简介

ionic-react 用于辅助前端页面和组件的开发,适合生成或审查 React 相关代码。

  • 适用于组件结构整理、样式开发和布局问题排查等前端任务。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需结合项目设计系统使用。
  • 涉及页面改动时应配合本地预览确认视觉效果和兼容性。
  • 避免生成孤立代码片段,需考虑路由和构建方式的整体适配。

SKILL.md

Ionic React

Develop Ionic Framework apps with React — project structure, IonReactRouter, React-specific components, lifecycle hooks, state management, and best practices.

Prerequisites

  1. Ionic Framework 7 or 8 with @ionic/react.
  2. React 18 or later.
  3. Node.js and npm installed.
  4. For iOS: Xcode installed.
  5. For Android: Android Studio installed.

Agent Behavior

  • Auto-detect before asking. Check the project for package.json dependencies (@ionic/react, @ionic/react-router, react, @capacitor/core), platforms (android/, ios/), build tools, and TypeScript usage. Only ask the user when something cannot be detected.
  • Guide step-by-step. Walk the user through the process one step at a time. Never present multiple unrelated questions at once.
  • Adapt to the project. Detect the existing code style (TypeScript vs. JavaScript, state management library, routing setup) and generate code that matches.

Procedures

Step 1: Analyze the Project

Auto-detect the following by reading project files:

  1. Ionic version: Read @ionic/react version from package.json.
  2. React version: Read react version from package.json.
  3. Capacitor version: Read @capacitor/core version from package.json (if present).
  4. TypeScript: Check if tsconfig.json exists and if .tsx files are used.
  5. Router: Check if @ionic/react-router and react-router-dom are in package.json.
  6. State management: Check package.json for redux, @reduxjs/toolkit, zustand, jotai, @tanstack/react-query, or similar.
  7. Platforms: Check which directories exist (android/, ios/).
  8. Build tool: Check for vite.config.ts, angular.json, webpack.config.js, etc.

Step 2: Project Structure

A standard Ionic React project follows this structure:

project-root/
├── android/                  # Android native project (Capacitor)
├── ios/                      # iOS native project (Capacitor)
├── public/
├── src/
│   ├── components/           # Reusable UI components
│   ├── hooks/                # Custom React hooks
│   ├── pages/                # Page components (one per route)
│   ├── services/             # Service modules for API and native calls
│   ├── context/              # React context providers
│   ├── theme/
│   │   └── variables.css     # Ionic CSS custom properties
│   ├── App.tsx               # Root component with IonReactRouter
│   └── main.tsx              # Entry point with setupIonicReact()
├── capacitor.config.ts       # Capacitor configuration
├── ionic.config.json         # Ionic CLI configuration
├── package.json
├── tsconfig.json
└── vite.config.ts            # Or other bundler config

If the project does not follow this structure, adapt all guidance to the project's actual directory layout. Do not restructure the project unless the user explicitly asks.

Step 3: App Initialization

The entry point must call setupIonicReact() before rendering the app. This function initializes the Ionic Framework for React.

Verify that src/main.tsx (or src/index.tsx) contains:

import { setupIonicReact } from '@ionic/react';

setupIonicReact();

setupIonicReact() accepts an optional configuration object for global settings:

setupIonicReact({
  mode: 'ios',          // Force iOS mode on all platforms ('ios' | 'md')
  rippleEffect: false,  // Disable Material Design ripple effect
  animated: true,       // Enable/disable all animations
});

If setupIonicReact() is missing or called after rendering, Ionic components will not function correctly.

Step 4: Routing and Navigation

Read references/routing.md for complete routing patterns including:

  • IonReactRouter setup
  • IonRouterOutlet page management
  • Tab-based navigation with IonTabs
  • Side menu navigation with IonMenu
  • Programmatic navigation with useIonRouter
  • Route guards and route parameters

Key principles:

  1. Use IonReactRouter instead of React Router's BrowserRouter. It is required for Ionic page transitions.
  2. Use IonRouterOutlet to contain routes. It manages the page stack and transition animations.
  3. Pass component prop to Route — do not use render or children inside IonRouterOutlet.
  4. Use useIonRouter for programmatic navigation — it provides Ionic-aware navigation with transition animations.

Step 5: Ionic Lifecycle Hooks

Read references/lifecycle.md for detailed lifecycle hook usage.

Ionic React pages stay mounted in the DOM after navigation. Standard React useEffect only fires on initial mount, not on every page visit. Use Ionic lifecycle hooks for per-visit logic:

HookUse for
useIonViewWillEnterRefresh data before the page becomes visible
useIonViewDidEnterStart animations or focus inputs after page is visible
useIonViewWillLeavePause media, save draft state
useIonViewDidLeaveCleanup after page is fully hidden

These hooks only work in components that:

  • Are rendered as the component of a Route inside IonRouterOutlet.
  • Render IonPage as their root element.

Step 6: React-Specific Ionic Hooks

Read references/hooks.md for all available hooks and usage examples.

Ionic React provides hooks for presenting overlays and controlling navigation without managing state manually:

HookPurpose
useIonAlertPresent alert dialogs
useIonToastShow toast notifications
useIonActionSheetPresent action sheets
useIonLoadingShow/dismiss loading indicators
useIonModalPresent modals programmatically
useIonPopoverPresent popovers programmatically
useIonPickerPresent picker dialogs
useIonRouterNavigate with Ionic animations

Step 7: React-Specific Component Patterns

Read references/components.md for detailed component patterns including:

  • Page structure with IonPage
  • Inline overlays (modals, popovers) with isOpen binding
  • Pull-to-refresh with IonRefresher
  • Infinite scroll with IonInfiniteScroll
  • Forms with Ionic input components

Key principles:

  1. Every page must render IonPage as root. This is required for transitions and lifecycle hooks.
  2. Use onIonInput for text inputs and onIonChange for select, toggle, checkbox, and range components.
  3. Access values via e.detail.value (or e.detail.checked for toggles/checkboxes).
  4. Use inline overlays with isOpen for simpler state management, or use overlay hooks (useIonModal, useIonAlert, etc.) for imperative usage.

Step 8: State Management

Read references/state-management.md for patterns with React Context, Redux Toolkit, Zustand, and TanStack Query.

Key principles:

  1. Page caching affects state. Since Ionic keeps pages mounted, state persists across navigations. Use useIonViewWillEnter to refresh stale data.
  2. Place providers outside IonReactRouter. Context providers, Redux Provider, and QueryClientProvider should wrap the router so all pages have access.
  3. Do not add a state library unless needed. For simple apps, React Context and useState/useReducer are sufficient.

Step 9: Build and Run

After implementing changes:

npm run build
npx cap sync
npx cap run android
npx cap run ios

For development with live reload:

ionic serve

For native development with live reload:

ionic cap run android --livereload --external
ionic cap run ios --livereload --external

Error Handling

  • Ionic lifecycle hooks not firing: Verify that the component renders IonPage as its root element and is the component of a Route inside IonRouterOutlet. Lifecycle hooks do not fire in child components or components rendered via render/children props.
  • Page transitions not animating: Ensure IonReactRouter is used instead of BrowserRouter. Ensure routes use the component prop, not render or children. Verify IonRouterOutlet is a direct child of IonReactRouter or IonTabs.
  • Stale data after navigating back: Ionic keeps pages mounted in the DOM. Use useIonViewWillEnter to refresh data on every page visit instead of useEffect with [].
  • Tab bar disappears on sub-page: All routes (including detail routes) must be inside the IonRouterOutlet within IonTabs. Do not nest a separate IonRouterOutlet inside a tab page.
  • setupIonicReact errors or components not rendering: Ensure setupIonicReact() is called before ReactDOM.createRoot() or ReactDOM.render() in the entry file. Ensure all Ionic CSS files are imported (see Ionic CSS imports in src/App.tsx or src/main.tsx).
  • IonBackButton not appearing: IonBackButton only renders when there is navigation history. Set the defaultHref prop to provide a fallback route when the page is accessed directly.
  • Form input values not updating: Use onIonInput for IonInput/IonTextarea (not onChange). Use onIonChange for IonSelect, IonToggle, IonCheckbox, IonRange. Access values via e.detail.value.
  • Modal or popover content not styled: Ensure the overlay content is wrapped in IonContent. For modals, include IonHeader with IonToolbar if a toolbar is needed.
  • React strict mode double-mounting: In development, React 18 strict mode mounts components twice. This can cause duplicate Ionic event listeners. Ensure cleanup functions properly remove listeners.
  • useIonRouter returns undefined: The hook must be used inside a component that is a descendant of IonReactRouter. Verify the component tree includes IonReactRouter as an ancestor.
  • CSS custom properties not applying: Ensure Ionic CSS files are imported in the correct order in src/App.tsx or src/main.tsx. The theme variables.css file must be imported after the core Ionic CSS.

Related Skills

  • ionic-app-development — General Ionic development covering components, theming, and CLI usage.
  • ionic-app-creation — Create a new Ionic app from scratch.
  • capacitor-react — Capacitor-specific React patterns for accessing native device features (without Ionic Framework).
  • ionic-app-upgrades — Upgrade Ionic Framework to a newer version.
  • capacitor-plugins — Install, configure, and use Capacitor plugins from official and community sources.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.98%
按下载量换算186

Claude

32.64%
按下载量换算164

Cursor

18.55%
按下载量换算93

Gemini CLI

9.75%
按下载量换算49

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

来源信息

继续浏览同类 Skills