-
Notifications
You must be signed in to change notification settings - Fork 24k
/
DeprecatedImagePropType.android.js
131 lines (127 loc) · 3.4 KB
/
DeprecatedImagePropType.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
const DeprecatedImageStylePropTypes = require('./DeprecatedImageStylePropTypes');
const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType');
const DeprecatedViewPropTypes = require('./DeprecatedViewPropTypes');
const PropTypes = require('prop-types');
const DeprecatedImagePropType = {
...DeprecatedViewPropTypes,
style: (DeprecatedStyleSheetPropType(
DeprecatedImageStylePropTypes,
): ReactPropsCheckType),
/**
* See https://reactnative.dev/docs/image.html#source
*/
source: (PropTypes.oneOfType([
PropTypes.shape({
uri: PropTypes.string,
headers: PropTypes.objectOf(PropTypes.string),
}),
// Opaque type returned by require('./image.jpg')
PropTypes.number,
// Multiple sources
PropTypes.arrayOf(
PropTypes.shape({
uri: PropTypes.string,
width: PropTypes.number,
height: PropTypes.number,
headers: PropTypes.objectOf(PropTypes.string),
}),
),
]): React$PropType$Primitive<
| {
headers?: {[string]: string, ...},
uri?: string,
...
}
| number
| Array<{
headers?: {[string]: string, ...},
height?: number,
uri?: string,
width?: number,
...
}>,
>),
/**
* blurRadius: the blur radius of the blur filter added to the image
*
* See https://reactnative.dev/docs/image.html#blurradius
*/
blurRadius: PropTypes.number,
/**
* See https://reactnative.dev/docs/image.html#defaultsource
*/
defaultSource: PropTypes.number,
/**
* See https://reactnative.dev/docs/image.html#loadingindicatorsource
*/
loadingIndicatorSource: (PropTypes.oneOfType([
PropTypes.shape({
uri: PropTypes.string,
}),
// Opaque type returned by require('./image.jpg')
PropTypes.number,
]): React$PropType$Primitive<{uri?: string, ...} | number>),
progressiveRenderingEnabled: PropTypes.bool,
fadeDuration: PropTypes.number,
/**
* Analytics Tag used by this Image
*/
internal_analyticTag: PropTypes.string,
/**
* Invoked on load start
*/
onLoadStart: PropTypes.func,
/**
* Invoked on load error
*/
onError: PropTypes.func,
/**
* Invoked when load completes successfully
*/
onLoad: PropTypes.func,
/**
* Invoked when load either succeeds or fails
*/
onLoadEnd: PropTypes.func,
/**
* Used to locate this view in end-to-end tests.
*/
testID: PropTypes.string,
/**
* The mechanism that should be used to resize the image when the image's dimensions
* differ from the image view's dimensions. Defaults to `auto`.
*
* See https://reactnative.dev/docs/image.html#resizemethod
*/
resizeMethod: (PropTypes.oneOf([
'auto',
'resize',
'scale',
]): React$PropType$Primitive<'auto' | 'resize' | 'scale'>),
/**
* Determines how to resize the image when the frame doesn't match the raw
* image dimensions.
*
* See https://reactnative.dev/docs/image.html#resizemode
*/
resizeMode: (PropTypes.oneOf([
'cover',
'contain',
'stretch',
'repeat',
'center',
]): React$PropType$Primitive<
'cover' | 'contain' | 'stretch' | 'repeat' | 'center',
>),
};
module.exports = DeprecatedImagePropType;