Skip to content

robinpowered/react-native-android-image-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

An Image component to polyfill Android's onError callback.

There are some blocking challenges with the Fresco library used for Android's images. This acts as a solution by using Image.prefetch, which will indicate if an image fails to resolve. Further discussion can be found in facebook/react-native#7440 (comment).

Installation

npm install react-native-android-image-polyfill --save

Usage

import Image from 'react-native-android-image-polyfill';

// Use it like a normal image

class YourComponent extends React.Component {
  render () {
    return (
      <Image
        source={{uri: 'some image'}}
        onError={() => alert('Failed!')}
      />
    );
  }
}