8

When I'm writting this code error is showing please let me know, Where i'm worng?

import React, { Component } from 'react'; import { 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
Manoj
  • 113
  • 1
  • 1
  • 7

5 Answers5

14

After installing react-native-fast-image you have to run pod command in you ios directory.

So run this command :

cd ios
pod install

Then run your project.

Kishan Bharda
  • 5,446
  • 3
  • 30
  • 57
5

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.

if you're using RN > 60.0 just paste this to your terminal

yarn add react-native-fast-image

and then rebuild the app

react-native run-android

It should now work.

Moralde-Sama
  • 154
  • 10
2

You can try either

  • Delete node_modules
  • Run npm install

OR

Add these lines and manually link the library

Settings.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

import com.dylanvann.fastimage.FastImageViewPackage;

Podfile

pod 'RNFastImage', :path => '../node_modules/react-native-fast-image'
1

It happens on snack:

https://snack.expo.dev/@johndimm/react-native-fast-image-test

It also fails on my local machine with these dependencies:

    "expo": "~44.0.0",
    "expo-status-bar": "~1.2.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-fast-image": "^8.5.11",
    "react-native-web": "0.17.1"

Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.

John Dimm
  • 91
  • 2
  • 5
0

I am using react-native 0.59.9, which works properly on android with react-native-fast-image 7.0.0.

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)

Yossi
  • 5,577
  • 7
  • 41
  • 76