Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Last active November 10, 2019 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topherPedersen/3b94a104438051309528e851440aefdd to your computer and use it in GitHub Desktop.
Save topherPedersen/3b94a104438051309528e851440aefdd to your computer and use it in GitHub Desktop.
How to Load an <Image/> in React Native
// NOTE: In the same directory as your App.js file,
// create a new folder called "assets", and place
// your image file (.jpg) in that directory.
import React, { Component } from 'react';
import { Text, View, Image } from 'react-native';
class App extends Component {
constructor(props) {
super(props);
}
render() {
return (
<View>
<Text>RENDER AN IMAGE...</Text>
<Image source={ require('./assets/supersweetimage.jpg') } />
</View>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment