[英]Invariant Violation: requireNativeComponent: “FastImageView” was not found in the UIManager in react native
When I'm writting this code error is showing please let me know, Where i'm worng?当我写这个代码错误显示请告诉我,我穿在哪里?
import React, { Component } from 'react';从'react'导入反应,{组件}; import { StyleSheet, Text, View, TouchableOpacity, FlatList, Modal, } from 'react-native';
导入 { StyleSheet, Text, View, TouchableOpacity, FlatList, Modal, } from 'react-native';
import FastImage from 'react-native-fast-image'
const Imagegallery = () => (
<FastImage
style={{ width: 200, height: 200 }}
source={{
uri: 'https://unsplash.it/400/400?image=1',
priority: FastImage.priority.normal,
}}
resizeMode={FastImage.resizeMode.contain}
/>
)
export default Imagegallery
After installing react-native-fast-image
you have to run pod command in you ios directory.安装
react-native-fast-image
后,您必须在 ios 目录中运行 pod 命令。
So run this command:所以运行这个命令:
cd ios
cd ios
pod install吊舱安装
Then run your project.然后运行你的项目。
It's late but for those who got this error, I think It's better to use RN 60.0 because of the auto-linking feature since they didn't provide manual installation for RN < 60.0.已经很晚了,但是对于那些遇到此错误的人,我认为最好使用 RN 60.0,因为自动链接功能因为他们没有为 RN < 60.0 提供手动安装。
if you're using RN > 60.0 just paste this to your terminal如果您使用的是 RN > 60.0,只需将其粘贴到您的终端
yarn add react-native-fast-image
and then rebuild the app然后重建应用程序
react-native run-android
It should now work.它现在应该可以工作了。
I am using react-native 0.59.9, which works properly on android with react-native-fast-image 7.0.0.我正在使用 react-native 0.59.9,它可以在带有 react-native-fast-image 7.0.0 的 android 上正常工作。
On iOS you need react-native-fast-image 6.1.1, and in order to prevent the error described in the question, I had to do manual installation ( https://github.com/DylanVann/react-native-fast-image/blob/4fa62bb09f65d967977f25ef87eda5f8b7c18cd6/docs/installation-manual.md#ios )在 iOS 上,您需要 react-native-fast-image 6.1.1,为了防止问题中描述的错误,我必须手动安装( https://github.com/DylanVann/react-native-fast-图片/blob/4fa62bb09f65d967977f25ef87eda5f8b7c18cd6/docs/installation-manual.md#ios )
You can try either你可以试试
node_modules
node_modules
npm install
npm install
OR或者
Add these lines and manually link the library添加这些行并手动链接库
Settings.gradle设置.gradle
include ':react-native-fast-image'
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android')
MainApplication.java主要应用.java
import com.dylanvann.fastimage.FastImageViewPackage;
Podfile播客文件
pod 'RNFastImage', :path => '../node_modules/react-native-fast-image'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.