react-native-beautiful-image

May 7, 2025 ยท View on GitHub

A beautiful image component for React Native with fade-in animation and placeholder support.

Installation

npm install react-native-beautiful-image
# or
yarn add react-native-beautiful-image

Usage

import Image from 'react-native-beautiful-image';

// Basic usage
<Image
  source={{ uri: 'https://example.com/image.jpg' }}
  style={{ width: 200, height: 200 }}
/>

// With placeholder
<Image
  source={{ uri: 'https://example.com/image.jpg' }}
  placeholderSource={require('./assets/placeholder.jpg')}
  style={{ width: 200, height: 200 }}
/>

// With callbacks
<Image
  source={{ uri: 'https://example.com/image.jpg' }}
  onLoad={() => console.log('Image loaded')}
  onError={() => console.log('Image failed to load')}
  style={{ width: 200, height: 200 }}
/>

Props

PropTypeRequiredDescription
sourceImageSourcePropTypeYesThe source of the image
styleStylePropNoStyle for the image
onLoad() => voidNoCallback when image loads successfully
onError() => voidNoCallback when image fails to load
placeholderSourceImageSourcePropTypeNoImage to show while loading or on error

TypeScript Support

This library is written in TypeScript and includes type definitions. The main component is exported as:

import Image, { ImageExtProps } from 'react-native-beautiful-image';

License

MIT