react-native-bpg
v0.0.15
Published
React native module for reading and decoding BPG-encoded images
Downloads
17
Maintainers
Readme
react-native-bpg
Getting started
$ npm install react-native-bpg --save
Mostly automatic installation
$ react-native link react-native-bpg
Manual installation
NDK should be installed. This can be done with SDK manager.
Project should contain ./android/local.properties
with correct paths to SDK/NDK (it is possible to set up environment variables).
Windows example:
sdk.dir=D\:\\Development\\_SDK\\AndroidSDK\\AndroidSDK
ndk.dir=D\:\\Development\\_SDK\\AndroidSDK\\ndk-bundle
There will be the warnings during the native libraries build phase.
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.kornell.bpg.RNReactNativeBpgPackage;
to the imports at the top of the file - Add
new RNReactNativeBpgPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-bpg' project(':react-native-bpg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bpg/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-bpg')
iOS
Not implemented for iOS
Windows
Not implemented for Windows
Usage
Example project can be found in links section
Links
Thank to the author of this article
ToDo list
filter getList with .bpg$ pattern
add png support
add gif support
add download from web (check with self-signed ssl and provide option to enable skip-checking)
add methods for
*AsPromise
rename current methods to
*AsCallback
Troubleshooting
If native libs are not building, try several techniques to clean cache:
npm start -- --reset-cache
remove node_modules and install dependencies again with npm i
On Windows
remove %USER_HOME%.gradle\caches\
On Mac or Linux: > rm -rf $HOME/.gradle/caches/
On Both
> cd android
> gradlew cleanBuildCache
then rebuild an application.