1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9
10/*
11 * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSource.js
12 */
13export interface ImageURISource {
14  /**
15   * `uri` is a string representing the resource identifier for the image, which
16   * could be an http address, a local file path, or the name of a static image
17   * resource (which should be wrapped in the `require('./path/to/image.png')`
18   * function).
19   */
20  uri?: string | undefined;
21  /**
22   * `bundle` is the iOS asset bundle which the image is included in. This
23   * will default to [NSBundle mainBundle] if not set.
24   * @platform ios
25   */
26  bundle?: string | undefined;
27  /**
28   * `method` is the HTTP Method to use. Defaults to GET if not specified.
29   */
30  method?: string | undefined;
31  /**
32   * `headers` is an object representing the HTTP headers to send along with the
33   * request for a remote image.
34   */
35  headers?: {[key: string]: string} | undefined;
36  /**
37   * `cache` determines how the requests handles potentially cached
38   * responses.
39   *
40   * - `default`: Use the native platforms default strategy. `useProtocolCachePolicy` on iOS.
41   *
42   * - `reload`: The data for the URL will be loaded from the originating source.
43   * No existing cache data should be used to satisfy a URL load request.
44   *
45   * - `force-cache`: The existing cached data will be used to satisfy the request,
46   * regardless of its age or expiration date. If there is no existing data in the cache
47   * corresponding the request, the data is loaded from the originating source.
48   *
49   * - `only-if-cached`: The existing cache data will be used to satisfy a request, regardless of
50   * its age or expiration date. If there is no existing data in the cache corresponding
51   * to a URL load request, no attempt is made to load the data from the originating source,
52   * and the load is considered to have failed.
53   *
54   * @platform ios
55   */
56  cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined;
57  /**
58   * `body` is the HTTP body to send with the request. This must be a valid
59   * UTF-8 string, and will be sent exactly as specified, with no
60   * additional encoding (e.g. URL-escaping or base64) applied.
61   */
62  body?: string | undefined;
63  /**
64   * `width` and `height` can be specified if known at build time, in which case
65   * these will be used to set the default `<Image/>` component dimensions.
66   */
67  width?: number | undefined;
68  height?: number | undefined;
69  /**
70   * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if
71   * unspecified, meaning that one image pixel equates to one display point / DIP.
72   */
73  scale?: number | undefined;
74}
75
76export type ImageRequireSource = number;
77