The current typings do not work at all as they do not expect the function to be under 'default' and this means that either ts fails or your code does not work. My proposal here works but it suggests that a class exists even though it doens't but I am not sure how to do it in another way. Even though this is technically wrong it is better than what is now used.
Looks like `RCTBridge.h` got deprecated and official docs use `#import <React/RCTBridge.h>` form anyway. This also makes this lib usable under (at least) RN 0.48
The actual JS module only has a default export of an object with `createResizedImage` function.
This PR update the Flow definition to match the usage of the module. This fixes the following flow error:
```
18: import ImageResizer from 'react-native-image-resizer';
^^^^^^^^^^^^ Default import from `react-native-image-resizer`. This module has no default export.
```
* `saveFile` used to return always `YES`, now it returns whether or not the save has been saved.
* `generateFilePath` didn’t do any check about the path. Now it creates the in the app directory. If for some reason it fails, it throws an Exception.
* `saveFile` can handle png extension and path issues. A bug on a `nil` fileSize has been fixed.
previously Android implementation worked differently and to the returned
absolute path a 'file:' is prepended.
This different behaviour may causes issues/bugs when handling the response from an
unified code base point of view and also the returned uri on the Android native code
is not generated properly using native functions to do so.
This patch fixes this incoherence, but also extends the returned value to add:
absolute path, file name, file size and the uri.
Refactored Android code to make it easier to read and more robust to
case sensitive file names.
- Throw exception instead of returning null sourceImage, which avoids
returning pseudo-empty "file:" string to Javascript on failure
- Use constant strings for checking path prefixes
- Cleanup of conditional statements for checking path prefixes
- Additional try-catch statements, contributing more-fine-grained
error messages
Other
- Updated .gitignore to latest React Native template
- Updated Android gradle scripts
- Updated package.json's in root and in example to point to
correct react/react-native versions, and to use local code
for this library directly in the example app