mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
19 lines
431 B
TypeScript
19 lines
431 B
TypeScript
|
import { Size } from '@joplin/utils/types';
|
||
|
import { Image as NativeImage } from 'react-native';
|
||
|
|
||
|
const getImageDimensions = async (uri: string): Promise<Size> => {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
NativeImage.getSize(
|
||
|
uri,
|
||
|
(width: number, height: number) => {
|
||
|
resolve({ width: width, height: height });
|
||
|
},
|
||
|
(error: unknown) => {
|
||
|
reject(error);
|
||
|
},
|
||
|
);
|
||
|
});
|
||
|
};
|
||
|
|
||
|
export default getImageDimensions;
|