react-native - 原生模块:{ Component } = NativeModules 和 requireNativeComponent('Component') 之间的区别
问题描述
我有点困惑。我刚刚完成了这两个教程,开始在 Swift 中编写我自己的原生模块:
https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03
第一个是无视图模块,导入如下:
const { Module } = NativeModules;
第二个是带有视图的原生组件,导入方式如下:
const ImageBlendView = requireNativeComponent('ImageBlendView')
这些在某种程度上是否可以互换,或者 UI 视图的存在或不存在是否会产生根本性的差异?
解决方案
推荐阅读
- android - 通过 Glide 将图像从画廊加载到 ImageView
- python - Python:多个文件中特定列的平均值和标准差,并用标准差条绘制平均值
- angular - 在角度组件内接收 POST 数据
- c++ - 构建器模式实现中的不完整类型错误
- php - 如何在 laravel 中以不同的样式显示帖子元素?
- java - lambda 表达式中的错误返回类型 String 无法转换为 Object
- python - 如何读取整数范围为 0-255(表示图像的灰度像素)的文本文件并转换为二维数组?
- java - 如何对 Set 进行分片?
- c - 是否可以通过 IPC 消息传递队列发送信号?
- java - NoSuchMethodError:org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass