Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/indec-it/react-native-spatialite
React Native Spatialite Plugin for Android
https://github.com/indec-it/react-native-spatialite
android react-native spatialite sqlite
Last synced: 2 months ago
JSON representation
React Native Spatialite Plugin for Android
- Host: GitHub
- URL: https://github.com/indec-it/react-native-spatialite
- Owner: indec-it
- License: mit
- Created: 2017-02-24T18:45:24.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-31T01:31:17.000Z (almost 6 years ago)
- Last Synced: 2024-09-24T06:25:59.307Z (4 months ago)
- Topics: android, react-native, spatialite, sqlite
- Language: Java
- Size: 117 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-spatialite
React Native Spatialite Plugin for Android
## Getting started
`$ npm install react-native-spatialite --save`
### Manual installation
#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import ar.gov.indec.react.spatialite.SpatialiteReactPackage;` to the imports at the top of the file
- Add `new SpatialiteReactPackage()` to the list returned by the `getPackages()` method2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-spatialite'project(':react-native-spatialite').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spatialite/android')
```3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-spatialite')
```4. Add JitPack in `android/build.gradle` as repository
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
...
}
}
```## Usage
```javascript
import db from 'react-native-spatialite';db.createConnection('test.db').then(connected => {
console.log('Database is connected', connected);
return db.getVersion();
}).then(
array => {
console.log({array});
return db.executeQuery('SELECT * FROM MyTable');
}
).then(
rows => {
console.log({rows});
}
).catch(
err => {
throw err;
}
);
```