创建 React Native 第三方库
官方脚手架文档
初始化工程
1. 创建独立发布的第三方库
npx create-react-native-library@latest awesome-library
2. 在现有项目中创建本地模块库
npx create-react-native-library@latest awesome-library --local
本地联调方案
参考:How to test the library in an app locally
- 使用
npm pack打出.tgz包后在宿主项目中本地安装测试。 - 使用轻量私有 npm 仓库 Verdaccio 在本机模拟完整发包与安装流程。