react-native-image-resizer/index.ios.js

22 lines
521 B
JavaScript

import {
NativeModules,
} from 'react-native';
export default {
createResizedImage: (path, width, height, format, quality) => {
if (format !== 'JPEG') {
throw new Error('Only JPEG format is supported by createResizedImage');
}
return new Promise((resolve, reject) => {
NativeModules.ImageResizerModule.createResizedImage(path, width, height, quality, (err, resizedPath) => {
if (err) {
return reject(err);
}
resolve(resizedPath);
});
});
},
};