ios - 如果使用 npm 安装,则在 NativeModules 中找不到 React native 模块
<p><p>我有一个私有(private)的 Swift 项目框架,我想围绕它创建一个 React Native 包装器并使其在 npm 上可用。
因此,当我使用 react-native init MyApp 创建一个 react native 应用程序并在 iOS 部分周围编写包装器时。我能够访问暴露的模块和暴露的方法。
但是一旦我将这个项目发布为一个 npm 包并尝试在一个新项目中使用它作为依赖项并记录 NativeModules,我不再在那里看到我的模块。
我使用 <code>npm install {my-npm-package} --save</code>
并使用 <code>react-native link</code> 链接它。</p>
<p>谁能帮我解释一下这是怎么发生的?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>所以为了回答我自己的问题,我找到了一种创建桥梁的方法,这对我来说是可能的,方法是在 iOS 中创建一个静态库项目并在其中使用我的库并导出我需要的方法。</p></p>
<p style="font-size: 20px;">关于ios - 如果使用 npm 安装,则在 NativeModules 中找不到 Reactnative 模块,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/48345429/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/48345429/
</a>
</p>
页:
[1]