Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

marcesengel
Copy link
Contributor

@marcesengel marcesengel commented Jan 10, 2022

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
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
Copy link

github-actions bot commented Aug 6, 2022

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
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