Commit 559656bb authored by Muhammad Handharbeni's avatar Muhammad Handharbeni

Initial Commit

parents
# OSX
#
.DS_Store
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
# BUCK
buck-out/
\.buckd/
*.keystore
\ No newline at end of file
# react-native-benibeacon
## Getting started
`$ npm install react-native-benibeacon --save`
### Mostly automatic installation
`$ react-native link react-native-benibeacon`
### Manual installation
#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.mhandharbeni.benibeacon.RNBenibeaconPackage;` to the imports at the top of the file
- Add `new RNBenibeaconPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-benibeacon'
project(':react-native-benibeacon').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-benibeacon/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-benibeacon')
```
## Usage
```javascript
import RNBenibeacon from 'react-native-benibeacon';
// TODO: What to do with the module?
RNBenibeacon;
```
\ No newline at end of file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.facebook.react:react-native:+'
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mhandharbeni.benibeacon">
</manifest>
\ No newline at end of file
package com.mhandharbeni.benibeacon;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
public class RNBenibeaconModule extends ReactContextBaseJavaModule {
private final ReactApplicationContext reactContext;
public RNBenibeaconModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}
@Override
public String getName() {
return "RNBenibeacon";
}
}
\ No newline at end of file
package com.mhandharbeni.benibeacon;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.bridge.JavaScriptModule;
public class RNBenibeaconPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.<NativeModule>asList(new RNBenibeaconModule(reactContext));
}
// Deprecated from RN 0.47
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
\ No newline at end of file
import { NativeModules } from 'react-native';
const { RNBenibeacon } = NativeModules;
export default RNBenibeacon;
{
"name": "react-native-benibeacon",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"react-native"
],
"author": "",
"license": "",
"peerDependencies": {
"react-native": "^0.41.2"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment