Skip to content

Image headers unsupported when an array of sources is provided #13697

@npomfret

Description

@npomfret

I'm trying to use the new headers prop on images in Android. I've managed to get it working on Android but it didn't behave as expected (and I believe its undocumented so was guessing on how to use it).

For a simple image source it works fine, something like this:

<Image source={uri: foo, headers: {Authorization: bar}} ...

But in my case I want to pass an array of different sized images. I assumed this would be the correct approach:

<Image source={[
    {uri: foo, headers: {Authorization: fooHeader}, 
    {uri: bar, headers: {Authorization: barHeader} ...

But that doesn't work (and the error message that comes back when my auth fails does seem to have any information in it). Looking at this code, I noticed that it always expects the headers prop to be at the top level, so one headers prop for all images (unlike the cache prop which is one per uri). As the source object is an array, so I ended up with something like this:

const sourceArray = [[uri: foo], [uri: bar]];
sourceArray.headers = headers;

Is this by design? It doesn't feel quite right to me - I was expecting the headers prop to be treated more the the cache prop. Having said that, I can't see any evidence of the cache header being implemented in android.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions