react-native-mendix-receiver
Version:
Receiver bridge for Mendix Native Widgets using React Native
55 lines (47 loc) • 1.23 kB
Markdown
## Getting started
`$ npm install react-native-mendix-receiver --save`
#### Android
For android Only
#### Mendix
import "mx-global";
import { Big } from "big.js";
import { ZebraBarcode } from 'react-native-mendix-broadcastreceiver';
// BEGIN EXTRA CODE
export const barcode = new ZebraBarcode();
this.barcode = barcode;
// END EXTRA CODE
/**
* @returns {Promise.<void>}
*/
export async function react_zebra() {
// BEGIN USER CODE
this.barcode.listenerBarcode("com.dwbasicintent1.ACTION", (strBarcode) => {
mx.data.create({
entity: "NativeModule.ExampleBarcode",
callback: function(mxObject) {
mxObject.set("Barcode", strBarcode);
mx.data.commit({
mxobj: mxObject,
callback: function() {
mx.data.update({
entity: "NativeModule.ExampleBarcode",
});
},
error: function(e) {
console.log("Error occurred attempting to commit: " + e);
}
});
},
error: function(e) {
reject("Could not create object:" + error.message);
}
});
});
// END USER CODE
}
#### Android Studio
Path : android\app\src\main
<intent-filter>
<action android:name="com.dwbasicintent1.ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>