mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-12 08:54:00 +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;
|