6
votes

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
4

4 Answers

13
votes

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.

2
votes

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.

0
votes

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)

0
votes

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'