@department-of-veterans-affairs/mobile-component-library

中文文档
0.37.0发布于 2026/09/30ISCCommonJS近 30 天下载 4612

VA Design System Mobile Component Library

原始使用文档
文档目录5 节
  1. For Consumers
  2. For Contributors
  3. Prerequisites
  4. Installation
  5. Yarn Commands

VA Mobile Design System - Components Package

The Components package is the core of the VA Mobile Design System containing the components themselves.

For Consumers

The components package assumes you already have a functioning React Native app, whether using Expo or React Native CLI; see the React Native documentation if you do not.

Once you have a running app:

  1. Add @department-of-veterans-affairs/mobile-component-library as a dependency with your package manager (e.g. yarn)
  2. Add @department-of-veterans-affairs/mobile-assets as a dependency
    • Note: beyond the assets package, react, react-native, and react-native-gesture-handler are also expected dependencies to run the components package
  3. Hook up the custom fonts in the assets package to your app
  4. Import components from @department-of-veterans-affairs/mobile-component-library within .jsx/.tsx files and incorporate into the display logic similarly to how you would the built-in React Native components

Note: The linting package is highly recommended so you'll automatically receive linting warnings for deprecation as the components package evolves; it should be set to the same version as the components package.

Documentation about components available can be found via the documentation site as well as our Storybook. Questions and issues can be directed to our DSVA Slack channel.

For Contributors

Prerequisites

  1. Install Node.js
  2. Install NVM
  3. Install yarn 4.0.2

Installation

  1. Clone the repo
git clone [email protected]:department-of-veterans-affairs/va-mobile-library.git
  1. From the root directory (va-mobile-library) run nvm use. If you do not have the active Node version installed (you will see an error) run nvm install v20.19.2 (replacing v.20.19.2 with the version listed in our root-level .nvmrc file), then run nvm use to activate it.

  2. Navigate to the components package

cd va-mobile-library/packages/components
  1. Install dependencies
yarn

then

yarn tokens:build
  1. Launch the app
  • Physical Device
    1. Install the Expo Go app from the App Store or Play Store
      • Note: It is highly recommended to turn off automatic updates for Expo Go as it is only compatible with the latest Expo SDK and will stop working upon update until the project SDK is upgraded which can include complicated dependency updates. Android allows downloading an old version APK as a workaround, but iOS is impossible to downgrade.
    2. Run yarn start
    3. Using your devices camera, scan the QR code that pops up in your console
  • Simulator
    1. Run yarn start
    2. Press i to run on an iOS simulator or a to run on an Android Emulator (you may have to set up an emulator in Android Studio in order for this to work)
  • Web Browser
    1. Run yarn storybook:web

Yarn Commands

CommandDescription
startStarts Metro Bundler with options to run app on different platforms. Note: To run on web, use yarn storybook:web command below
android Run app on last used Android emulator/device
buildIcons Run script to build icons from assets package
iosRun app on last used iOS simulator/device
storybook:buildGenerates static version of Storybook for deployment
storybook:deployDeploys Storybook to homepage in package.json
storybook:generateGenerates .rnstorybook/storybook.requires.js which tells React Native where to find stores since it doesn't support dynamic imports
storybook:watchWatches for newly created stories and regenerates storybook.requires.js
storybook:webBuilds and launches development server for web
testRuns unit tests

版本与发布记录

@department-of-veterans-affairs/mobile-component-library 共发布 300 个版本,首次发布于 2023/08/16;过去 12 个月发布了 19 个版本。

版本发布日期距今
0.37.0latest2026/09/301 个月前
0.36.42026/09/301 个月前
0.36.4-alpha.2alpha2026/09/251 个月前
0.36.4-alpha.12026/09/241 个月前
0.36.4-alpha.02026/09/221 个月前
0.36.4-beta.0beta2026/09/151 个月前

关于 @department-of-veterans-affairs/mobile-component-library 的常见问题

@department-of-veterans-affairs/mobile-component-library 是什么?

VA Design System Mobile Component Library

如何安装 @department-of-veterans-affairs/mobile-component-library?

在项目目录运行 npm install @department-of-veterans-affairs/mobile-component-library,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.0.0)、react-native(>=0.71.7)、react-native-gesture-handler(^2.12.0)、react-native-safe-area-context(^4.10.5)、@department-of-veterans-affairs/mobile-assets(^0.15.1)、@department-of-veterans-affairs/mobile-tokens(^0.24.0)、@department-of-veterans-affairs/va-design-system-assets(^0.3.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@department-of-veterans-affairs/mobile-component-library 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/department-of-veterans-affairs__mobile-component-library 是否存在。

@department-of-veterans-affairs/mobile-component-library 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@department-of-veterans-affairs/mobile-component-library 可以商用吗?

@department-of-veterans-affairs/mobile-component-library 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@department-of-veterans-affairs/mobile-component-library 的下载量有多少?

根据 npm 官方下载统计,@department-of-veterans-affairs/mobile-component-library 在 2026/10/12 – 2026/11/10 这 30 天内被下载 4,612 次,日均约 154 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@department-of-veterans-affairs/mobile-component-library 还在维护吗?

最新版本 0.37.0 发布于 2026/09/30(1 个月前);至今共发布 300 个版本,其中过去 12 个月发布了 19 个;首次发布于 2023/08/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。