- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图了解 React Native 0.60+ 中存在的自动链接与我们在之前的 React Native 版本中的自动/手动链接之间的区别。
当我添加 react-native-gesture-handler与 npm i react-native-gesture-handler
,我的 Podfile 中没有添加任何行。所以当我做 pod install
,我假设手势处理程序模块未链接。但是,如果我像以前的 React Native 版本一样手动链接它,通过拖动 .xcodeproj
文件到库等中,它会引发错误并告诉我取消链接。
我想知道的:
我对吗,自动链接的作用是将给定模块的一行添加到您的 Podfile 中,然后当您 pod install
时链接它?如果是这样,为什么当我做 npm i react-native-gesture-handler
时会这样?我的 Podfile 中没有添加任何内容?并且鉴于没有添加任何内容并且手动链接模块会引发错误,我应该如何链接模块?
最佳答案
当您创建一个新项目并且 react-native 版本 >=60 时,此行会自动添加到 pod 文件中( official site )
# example/ios/Podfile
require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules'
This means that all libraries need to ship a Podspec either in the root of their folder or where the Xcode project is. Podspec references the native code that your library depends on.
The implementation ensures that a library is imported only once. If you need to have a custom pod directive then include it above the use_native_modules! function.
关于ios - 如何在 React Native 0.60+ 中添加原生模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58034600/
我是一名优秀的程序员,十分优秀!