-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.ios.js
32 lines (28 loc) · 904 Bytes
/
index.ios.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
import {
NativeModules,
} from 'react-native';
export default {
createBinaryImage: (path, type, threshold, format, quality, bOutputBase64, frontColorString="000000ff", backColorString="ffffffff") => {
if (format !== 'JPEG' && format !== 'PNG') {
throw new Error('Only JPEG and PNG format are supported!');
}
return new Promise((resolve, reject) => {
NativeModules.ImageTools.createBinaryImage(path, type, threshold, format, quality, bOutputBase64, frontColorString, backColorString, (err, response) => {
if (err) {
return reject(err);
}
resolve(response);
});
});
},
GetImageRGBAs: (path) => {
return new Promise((resolve, reject) => {
NativeModules.ImageTools.GetImageRGBAs(path, (err, response) => {
if (err) {
return reject(err);
}
resolve(response);
});
});
},
};