Fluent UI React Native 项目教程

Fluent UI React Native 项目教程

fluentui-react-native A react-native component library that implements the Fluent Design System. fluentui-react-native 项目地址: https://gitcode.com/gh_mirrors/fl/fluentui-react-native

1. 项目的目录结构及介绍

fluentui-react-native/
├── apps/
│   ├── FluentTester/
│   ├── RNTester/
│   └── ...
├── packages/
│   ├── @fluentui-react-native/button/
│   ├── @fluentui-react-native/experimental-text/
│   └── ...
├── scripts/
│   ├── build.js
│   ├── clean.js
│   └── ...
├── .gitignore
├── .prettierrc
├── package.json
└── README.md
  • apps/: 包含示例应用程序,如 FluentTesterRNTester,用于测试和展示 Fluent UI 组件。
  • packages/: 包含 Fluent UI React Native 的核心组件库,每个组件都有独立的目录。
  • scripts/: 包含项目的构建和清理脚本。
  • .gitignore: 指定 Git 忽略的文件和目录。
  • .prettierrc: 配置代码格式化工具 Prettier。
  • package.json: 项目的依赖和脚本配置文件。
  • README.md: 项目的介绍和使用说明。

2. 项目的启动文件介绍

项目的启动文件通常位于 apps/ 目录下的某个示例应用程序中。以 FluentTester 为例,启动文件为 apps/FluentTester/index.js

import { AppRegistry } from 'react-native';
import App from './src/FluentTester/App';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);
  • AppRegistry.registerComponent: 注册应用程序的根组件。
  • App: 应用程序的根组件,通常位于 src/FluentTester/App.js

3. 项目的配置文件介绍

package.json

package.json 文件包含了项目的依赖、脚本和其他元数据。

{
  "name": "fluentui-react-native",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "build": "node scripts/build.js",
    "clean": "node scripts/clean.js",
    "start": "node scripts/start.js"
  },
  "dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.4",
    "@fluentui-react-native/button": "^0.1.0"
  },
  "devDependencies": {
    "eslint": "^7.12.1",
    "prettier": "^2.1.2"
  }
}
  • scripts: 定义了项目的构建、清理和启动脚本。
  • dependencies: 列出了项目运行所需的依赖包。
  • devDependencies: 列出了开发环境所需的依赖包。

.prettierrc

.prettierrc 文件配置了代码格式化工具 Prettier。

{
  "singleQuote": true,
  "trailingComma": "all",
  "printWidth": 80
}
  • singleQuote: 使用单引号。
  • trailingComma: 在多行对象和数组中添加尾随逗号。
  • printWidth: 每行代码的最大宽度为 80 个字符。

通过以上介绍,您可以更好地理解和使用 Fluent UI React Native 项目。

fluentui-react-native A react-native component library that implements the Fluent Design System. fluentui-react-native 项目地址: https://gitcode.com/gh_mirrors/fl/fluentui-react-native

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

柏克栋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值