mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 20:15:11 +00:00
ee742277af
Summary: Closes https://github.com/facebook/react-native/pull/8365 Differential Revision: D3477411 Pulled By: caabernathy fbshipit-source-id: 26214fcf13c9e1352e198f34fcd6f5e88f1fe2da
33 lines
915 B
Markdown
33 lines
915 B
Markdown
---
|
|
id: basics-component-image
|
|
title: Image
|
|
layout: docs
|
|
category: The Basics
|
|
permalink: docs/basics-component-image.html
|
|
next: basics-component-view
|
|
---
|
|
|
|
Another basic React Native component is the [`Image`](/react-native/docs/image.html#content) 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.
|
|
|
|
```ReactNativeWebPlayer
|
|
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);
|
|
```
|