Skip to content

Commit bb25c15

Browse files
committed
Image - clean up comments
1 parent 7353183 commit bb25c15

File tree

1 file changed

+5
-2
lines changed
  • packages/react-native-web/src/exports/Image

1 file changed

+5
-2
lines changed

packages/react-native-web/src/exports/Image/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ BaseImage.displayName = 'Image';
350350
* default source is never loaded using headers
351351
*/
352352
const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
353-
// $FlowIgnore
353+
// $FlowIgnore: This component would only be rendered when `source` matches `ImageSource`
354354
const nextSource: ImageSource = props.source;
355355
const [blobUri, setBlobUri] = React.useState('');
356356
const request = React.useRef<LoadRequest>({
@@ -373,6 +373,8 @@ const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
373373
onLoadStart();
374374
}
375375

376+
// Store a ref for the current request so when know what's the last loaded source,
377+
// and so we can cancel it if a different source is passed through props
376378
request.current = ImageLoader.loadWithHeaders(nextSource);
377379

378380
request.current.promise
@@ -388,7 +390,8 @@ const ImageWithHeaders: ImageComponent = React.forwardRef((props, ref) => {
388390
const propsToPass = {
389391
...props,
390392

391-
// Omit `onLoadStart` because we trigger it in the current scope
393+
// `onLoadStart` is called from the current component
394+
// We skip passing it down to prevent BaseImage raising it a 2nd time
392395
onLoadStart: undefined,
393396

394397
// Until the current component resolves the request (using headers)

0 commit comments

Comments
 (0)