Ben
Ben

Reputation: 125

How do you set an auth header on an image in react-native?

I have images in my react-native application that require authentication. I have a token that I add to all of my server calls but I don't know how to set it for an Image. Can I override the loading calling for an image? Do I have to preload the image using fetch and then provide the result to the Image component?

Upvotes: 1

Views: 1468

Answers (1)

Andreyco
Andreyco

Reputation: 22872

Yes, it is

<Image source={{ uri: 'http://...', headers: {} }} />

Upvotes: 4

Related Questions