File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,16 @@ export interface URISource {
5
5
uri : string
6
6
}
7
7
8
- export type Source = ImageRequireSource | URISource
8
+ export type ImageDimensionsSource = ImageRequireSource | URISource
9
9
10
10
export interface ImageDimensions {
11
- dimensions ?: { width : number ; height : number ; aspectRatio : number }
11
+ width : number
12
+ height : number
13
+ aspectRatio : number
14
+ }
15
+
16
+ export interface ImageDimensionsResult {
17
+ dimensions ?: ImageDimensions
12
18
error ?: Error
13
19
loading : boolean
14
20
}
@@ -17,8 +23,10 @@ export interface ImageDimensions {
17
23
* @param source either a remote URL or a local file resource.
18
24
* @returns original image dimensions (width, height and aspect ratio).
19
25
*/
20
- export function useImageDimensions ( source : Source ) : ImageDimensions {
21
- const [ result , setResult ] = useState < ImageDimensions > ( { loading : true } )
26
+ export function useImageDimensions (
27
+ source : ImageDimensionsSource ,
28
+ ) : ImageDimensionsResult {
29
+ const [ result , setResult ] = useState < ImageDimensionsResult > ( { loading : true } )
22
30
23
31
useEffect ( ( ) => {
24
32
try {
You can’t perform that action at this time.
0 commit comments