Skip to content

Instantly share code, notes, and snippets.

@thekevinscott
Created April 28, 2017 17:30
Show Gist options
  • Save thekevinscott/0381ad0ff8e2fe29c47f0e1ab71d5b74 to your computer and use it in GitHub Desktop.
Save thekevinscott/0381ad0ff8e2fe29c47f0e1ab71d5b74 to your computer and use it in GitHub Desktop.
A basic example of an absolutely positioned <Image /> in React Native
import React, { Component } from 'react';
import {
AppRegistry,
Image,
} from 'react-native';
const remote = 'https://s15.postimg.org/tw2qkvmcb/400px.png';
export default class BackgroundImage extends Component {
render() {
const resizeMode = 'center';
return (
<Image
style={{
flex: 1,
resizeMode,
}}
source={{ uri: remote }}
/>
);
}
}
AppRegistry.registerComponent('BackgroundImage', () => BackgroundImage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment