2015-04-08 04:26:09 +03:00
|
|
|
/**
|
2018-09-12 01:27:47 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-04-08 04:26:09 +03:00
|
|
|
*
|
2018-02-17 05:24:55 +03:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-04-08 04:26:09 +03:00
|
|
|
*
|
2020-08-28 01:18:22 +03:00
|
|
|
* @flow strict
|
2018-01-15 06:32:26 +03:00
|
|
|
* @format
|
2015-04-08 04:26:09 +03:00
|
|
|
*/
|
2019-10-16 20:03:47 +03:00
|
|
|
|
2015-04-08 04:26:09 +03:00
|
|
|
'use strict';
|
|
|
|
|
2020-08-28 01:18:22 +03:00
|
|
|
/**
|
|
|
|
* Keep this in sync with `DeprecatedImageSourcePropType.js`.
|
|
|
|
*
|
|
|
|
* This type is intentinoally inexact in order to permit call sites that supply
|
|
|
|
* extra properties.
|
|
|
|
*/
|
2018-09-25 06:39:33 +03:00
|
|
|
export type ImageURISource = $ReadOnly<{
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `uri` is a string representing the resource identifier for the image, which
|
|
|
|
* could be an http address, a local file path, or the name of a static image
|
|
|
|
* resource (which should be wrapped in the `require('./path/to/image.png')`
|
|
|
|
* function).
|
|
|
|
*/
|
2018-06-15 05:42:38 +03:00
|
|
|
uri?: ?string,
|
2020-08-28 01:18:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `bundle` is the iOS asset bundle which the image is included in. This
|
|
|
|
* will default to [NSBundle mainBundle] if not set.
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-06-15 05:42:38 +03:00
|
|
|
bundle?: ?string,
|
2020-08-28 01:18:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `method` is the HTTP Method to use. Defaults to GET if not specified.
|
|
|
|
*/
|
2018-06-15 05:42:38 +03:00
|
|
|
method?: ?string,
|
2020-08-28 01:18:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `headers` is an object representing the HTTP headers to send along with the
|
|
|
|
* request for a remote image.
|
|
|
|
*/
|
2020-08-28 01:18:22 +03:00
|
|
|
headers?: ?{[string]: string},
|
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `body` is the HTTP body to send with the request. This must be a valid
|
|
|
|
* UTF-8 string, and will be sent exactly as specified, with no
|
|
|
|
* additional encoding (e.g. URL-escaping or base64) applied.
|
|
|
|
*/
|
2018-06-15 05:42:38 +03:00
|
|
|
body?: ?string,
|
2020-08-28 01:18:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `cache` determines how the requests handles potentially cached
|
|
|
|
* responses.
|
|
|
|
*
|
|
|
|
* - `default`: Use the native platforms default strategy. `useProtocolCachePolicy` on iOS.
|
|
|
|
*
|
|
|
|
* - `reload`: The data for the URL will be loaded from the originating source.
|
|
|
|
* No existing cache data should be used to satisfy a URL load request.
|
|
|
|
*
|
|
|
|
* - `force-cache`: The existing cached data will be used to satisfy the request,
|
|
|
|
* regardless of its age or expiration date. If there is no existing data in the cache
|
|
|
|
* corresponding the request, the data is loaded from the originating source.
|
|
|
|
*
|
|
|
|
* - `only-if-cached`: The existing cache data will be used to satisfy a request, regardless of
|
|
|
|
* its age or expiration date. If there is no existing data in the cache corresponding
|
|
|
|
* to a URL load request, no attempt is made to load the data from the originating source,
|
|
|
|
* and the load is considered to have failed.
|
|
|
|
*
|
|
|
|
* @platform ios
|
|
|
|
*/
|
2018-06-15 05:42:38 +03:00
|
|
|
cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached'),
|
2020-08-28 01:18:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `width` and `height` can be specified if known at build time, in which case
|
|
|
|
* these will be used to set the default `<Image/>` component dimensions.
|
|
|
|
*/
|
2018-06-15 05:42:38 +03:00
|
|
|
width?: ?number,
|
|
|
|
height?: ?number,
|
2020-08-28 01:18:22 +03:00
|
|
|
|
2018-09-29 09:13:03 +03:00
|
|
|
/**
|
|
|
|
* `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if
|
|
|
|
* unspecified, meaning that one image pixel equates to one display point / DIP.
|
|
|
|
*/
|
2018-06-15 05:42:38 +03:00
|
|
|
scale?: ?number,
|
2020-08-28 01:18:22 +03:00
|
|
|
|
2019-11-21 20:38:13 +03:00
|
|
|
...
|
2018-06-20 07:28:04 +03:00
|
|
|
}>;
|
2017-02-17 02:01:56 +03:00
|
|
|
|
2020-08-28 01:18:22 +03:00
|
|
|
export type ImageSource =
|
|
|
|
| number
|
|
|
|
| ImageURISource
|
|
|
|
| $ReadOnlyArray<ImageURISource>;
|