react-native/docs/Basics-Component-Image.md

915 B

id title layout category permalink next
basics-component-image Image docs The Basics docs/basics-component-image.html basics-component-view

Another basic React Native component is the Image component. Like Text, the Image component simply renders an image.

An Image is analogous to the <img> HTML tag when building websites.

The simplest way to render an image is to provide a source file to that image via the source attribute.

This example displays a checkbox Image on the device.

import React, { Component } from 'react';
import { AppRegistry, Image } from 'react-native';

class ImageBasics extends Component {
  render() {
    return (
      <Image source={require('./img/favicon.png')} />
    );
  }
}

// App registration and rendering
AppRegistry.registerComponent('AwesomeProject', () => ImageBasics);