Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为 android 和 iOS 创建第一个 react-native 依赖项。我已经完成了 android 的编码部分,但现在我被困在了 iOS 中。在哪里为我的库编写代码以及如何测试。
React Native 使用 CocoaPods 来管理 iOS 项目依赖项,并且大多数 React Native 库都遵循相同的约定。
在我们的 ios 目录中运行 pod install 以将其链接到我们的原生 iOS 项目。在不切换到 ios 目录的情况下执行此操作的捷径是运行 npx pod-install。完成后,重新构建应用程序二进制文件以开始使用您的新库:npx react-native run-ios。
要测试代码,您可以使用 Jest 测试框架。转到 ReactNative 以获得更多指导。