forked from necolas/react-native-web
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Image: support ImageSource with headers #8
Closed
kidroca
wants to merge
14
commits into
Expensify:master
from
kidroca:kidroca/feat/image-loader-headers
Closed
Image: support ImageSource with headers #8
kidroca
wants to merge
14
commits into
Expensify:master
from
kidroca:kidroca/feat/image-loader-headers
Commits on Dec 21, 2022
-
[add] load images with http headers
- extend ImageLoader.load params - Removed the old `image.decode` change as it's covered by the minimal browser versions supported here - add examples for Images with headers - Image - remove requestRef - no longer needed - rename `ImageLoader.abort` to `.release` The method is mostly used as cleanup (e.g. useEffect cleanup, or releasing resources when component unmounts) - Image - extract `useSource` hook Move the image loading effect here Changed the original logic slightly for less nesting Changed to cover cases where passing the same headers object was starting new loads, as it was treated as a different value due to referential equality - Image - add tests covering added/changed functionality around source - Image - handle cases where the source object only changes by reference When the source object changed by reference, but stays structurally the same, we should do nothing and not trigger the loading effect again - Image - extract ImageLoadingProps Update types to match RN and actual code - we don't call `onLoadStart` and `onLoadEnd` with any arguments - ImageLoader extract types.js - Image - resolve `onLoad` with `source` Use the same `nativeEvent` structure as in RN for the onLoad event - Rework Image loading and source management logic Since introducing the change to support headers changes to the original changes are needed: - support loading a default source with headers - handle source object changes - update uri resolving logic to handle blob URLs create by `URL.createObjectURL` - move the URI/source resolving logic to the `ImageLoader` BREAKING CHANGE `onLoad` was previously called with `nativeEvent` that was the browser Event object from the image.onload handler Since we can't spread or mutate the Event object to add `source` we have to either add it under a new key or remove it The browser Event does not expose very useful information, (no target, or size info), so it seems best to replace `nativeEvent` with the same structure used in `react-native`
Configuration menu - View commit details
-
Copy full SHA for 32f1137 - Browse repository at this point
Copy the full SHA 32f1137View commit details -
[fix] ImageLoader images are not added to
ImageUriCache
Previously loaded images used to be added to ImageUriCache It seems the logic was accidentally removed here: necolas@f4e8b6b#diff-7cb74a3a32d73857be80350ecd1ea131d256bd5af11d2000e4fc2d03c2230584L361 And now the `ImageUriCache` is only updated by preload/getSize
Configuration menu - View commit details
-
Copy full SHA for e2248d6 - Browse repository at this point
Copy the full SHA e2248d6View commit details
Commits on Jan 4, 2023
-
Apply suggested typo fixes and clarifications
Co-authored-by: Alex Beaman <dabeamanator@gmail.com> Co-authored-by: Marc Glasser <marc.aaron.glasser@gmail.com> Co-authored-by: Tim Golen <tgolen@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 6429c1e - Browse repository at this point
Copy the full SHA 6429c1eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9ef7d28 - Browse repository at this point
Copy the full SHA 9ef7d28View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7b9f633 - Browse repository at this point
Copy the full SHA 7b9f633View commit details -
Configuration menu - View commit details
-
Copy full SHA for d90e85c - Browse repository at this point
Copy the full SHA d90e85cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 26c1ae9 - Browse repository at this point
Copy the full SHA 26c1ae9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7c6f58e - Browse repository at this point
Copy the full SHA 7c6f58eView commit details
Commits on Jan 5, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 33cb405 - Browse repository at this point
Copy the full SHA 33cb405View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9edf19b - Browse repository at this point
Copy the full SHA 9edf19bView commit details
Commits on Jan 6, 2023
-
Co-authored-by: Marc Glasser <marc.aaron.glasser@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 4227410 - Browse repository at this point
Copy the full SHA 4227410View commit details -
Configuration menu - View commit details
-
Copy full SHA for 10df92e - Browse repository at this point
Copy the full SHA 10df92eView commit details -
Extract callbacks from ref before usage - not when loading starts
Configuration menu - View commit details
-
Copy full SHA for 9d6cbe7 - Browse repository at this point
Copy the full SHA 9d6cbe7View commit details
Commits on Jan 9, 2023
-
We append `source` to the `nativeEvent` raised by the Image.onload event in order to preserve existing functionality but mach the `source` object available in react-native's image load event
Configuration menu - View commit details
-
Copy full SHA for 42ef468 - Browse repository at this point
Copy the full SHA 42ef468View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.