The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

React Native: Using the Image component and reusable styles

React Native: Using the Image component and reusable styles

7:03
Let's take a look at the basics of using React Native's Image component, as well as adding some reusable styling to our Dashboard component buttons.
Watch this lesson now
Avatar
egghead.io

Let's take a look at the basics of using React Native's Image component, as well as adding some reusable styling to our Dashboard component buttons.

Avatar
jack

Hi,

I like to use the Image component for images stored locally in my app. I don't what the path of the images should be and where to put the images in my project folders.

Thanks,
Jack

Avatar
Dmitrii

Hi! Try this source: source={require('image!myIcon')}
And you should put your images into Images.xcassets folder in Xcode.

In reply to jack
Avatar
Timothy

Hello,
Just a FYI for all future course-takers that the current React version does not support Objects being rendered. Was pretty simply solved by installed the React.addons create fragment library and implementing it in the render function for Dashboard.

In reply to egghead.io
Avatar
Laurie

I believe there is a change to the github api in that your images will not be displaying if you try and find the 'avatar_url' key inside the userInfo object.

I had to write this.props.userInfo[0].owner.avatar_url to access the correct information to get the profile image to display.

Hope that helps!

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?