Skip to content

[Android] Add headers support when passing source array#32863

Open
marcesengel wants to merge 8 commits into
react:mainfrom
marcesengel:android-image-view-source-array-headers
Open

[Android] Add headers support when passing source array#32863
marcesengel wants to merge 8 commits into
react:mainfrom
marcesengel:android-image-view-source-array-headers

Conversation

@marcesengel

@marcesengel marcesengel commented Jan 10, 2022

Copy link
Copy Markdown
Contributor

Summary

Currently passing headers in the source array of an <ImageView /> is not supported on android because

  • headers are passed to native via one ReadableMap prop, passed as-is to the ReactNetworkImageRequest.fromBuilderWithHeaders. This means different headers per array entry are simply not possible
  • currently those headers are passed to native via source?.headers which clearly will not work when putting the headers into the source array (e.g. [ { headers: { Test: '123' }, uri: '...' } ] - this also showcases a workaround, just set the headers property on your source array and you are good to go as long as you always need the same headers)

Changelog

  • Simplified android <Image /> code flow
  • Moved android native image view headers property into the src property
  • Added headers property to ImageSource class

[Android] [Fix] - Support headers when passing an array for the <Image /> source property

Test Plan

CI tests should cover these changes.

Edit: Also confirmed working in a test project.

Simplified code flow
Removed native headers prop in favour of passing them in the src array
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jan 10, 2022
@mikehardy

Copy link
Copy Markdown
Contributor

Hopefully this is not irritating for them - but I requested review from @mdvacca and @yungsters - they appear to be the most recent editors in this area? Apologies in advance if that's a courtesy breach. Cheers all

@github-actions

github-actions Bot commented Aug 6, 2022

Copy link
Copy Markdown

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 6, 2022
@marcesengel

Copy link
Copy Markdown
Contributor Author

Not stale 😖

@yungsters yungsters removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 15, 2022
@cortinico cortinico added the Never gets stale Prevent those issues and PRs from getting stale label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Never gets stale Prevent those issues and PRs from getting stale Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants