-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the old school index.ios.js and index.android.js which could lead to some bad Developer Experience
- Loading branch information
1 parent
363fdcc
commit 54dce2a
Showing
5 changed files
with
70 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { NativeModules, Platform } from 'react-native'; | ||
|
||
const ImageResizerAndroid = NativeModules.ImageResizerAndroid; | ||
|
||
let exportObject = {}; | ||
|
||
if (Platform.OS === 'android') { | ||
exportObject = { | ||
createResizedImage: ( | ||
imagePath, | ||
newWidth, | ||
newHeight, | ||
compressFormat, | ||
quality, | ||
rotation = 0, | ||
outputPath, | ||
keepMeta = false | ||
) => { | ||
return new Promise((resolve, reject) => { | ||
ImageResizerAndroid.createResizedImage( | ||
imagePath, | ||
newWidth, | ||
newHeight, | ||
compressFormat, | ||
quality, | ||
rotation, | ||
outputPath, | ||
keepMeta, | ||
resolve, | ||
reject | ||
); | ||
}); | ||
}, | ||
}; | ||
} else { | ||
exportObject = { | ||
createResizedImage: (path, width, height, format, quality, rotation = 0, outputPath, keepMeta = false) => { | ||
if (format !== 'JPEG' && format !== 'PNG') { | ||
throw new Error('Only JPEG and PNG format are supported by createResizedImage'); | ||
} | ||
|
||
return new Promise((resolve, reject) => { | ||
NativeModules.ImageResizer.createResizedImage( | ||
path, | ||
width, | ||
height, | ||
format, | ||
quality, | ||
rotation, | ||
outputPath, | ||
keepMeta, | ||
(err, response) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
|
||
resolve(response); | ||
} | ||
); | ||
}); | ||
}, | ||
}; | ||
} | ||
|
||
export default exportObject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters