简体   繁体   English

不变违规:requireNativeComponent:在反应原生的 UIManager 中找不到“FastImageView”

[英]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你可以试试

  • Delete node_modules删除node_modules
  • Run 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.

相关问题 React-Native-SVG 错误:不变违规:requireNativeComponent:在 UIManager 中找不到“RNSVGGroup” - React-Native-SVG Error: Invariant Violation: requireNativeComponent: "RNSVGGroup" was not found in the UIManager “不变违规:requireNativeComponent:在 UIManager 中找不到“RNSScreen”。” 反应本机 cli 中的错误 - 'Invariant Violation: requireNativeComponent: "RNSScreen" was not found in the UIManager.' error in react native cli 不变违规:requireNativeComponent:在 UIManager 中找不到“RangeSlider” - Invariant Violation: requireNativeComponent: "RangeSlider" was not found in UIManager 错误:不变违规:requireNativeComponent:在 UIManager 中找不到“RNCPicker” - Error: Invariant Violation: requireNativeComponent: "RNCPicker" was not found in the UIManager 不变违规:requireNativeComponent:在 UIManager 中找不到“RNSVGCircle” - Invariant Violation: requireNativeComponent: "RNSVGCircle" was not found in the UIManager 不变违规:在 UIManager 中找不到 RNCSafeAreaProvider - Invariant Violation: RNCSafeAreaProvider was not found in the UIManager 不变违规:requireNativeComponent:在 UIMana 中找不到“RNCViewPager” - Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIMana requireNativeComponent:在 UIManager 中找不到“RNSScreenStackHeaderConfig” - requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager React Native中的不变违规 - Invariant Violation in React Native React Native Invariant Violation:未找到名称 img 的查看配置 - React Native Invariant Violation: View config not found for name img
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM