@tickid/tickid-rada
v2.2.6
Published
Module React Native cho Rada
Downloads
29
Keywords
Readme
tickid-rada
Module React Native for Rada
Demo
Installation
Yarn:
$ npm i @tickid/tickid-rada --save
or NPM:
$ yarn add @tickid/tickid-rada
Usage
Sample code to use this simple library:
import React, { Component } from 'react';
import {
Router,
Stack,
Scene,
} from 'react-native-router-flux';
import TickIDRada from '@tickid/tickid-rada';
export default class RadaExample extends Component {
constructor(properties) {
super(properties);
let config = {
partnerAuthorization: 'partnerAuthorization',
webhookUrl: 'webhookUrl',
defaultLocation: 'defaultLocation'
};
TickIDRada.init(config);
}
render() {
return (
<Router
store={store}
backAndroidHandler={this.backAndroidHandler.bind(this)}
onStateChange={(prevState, newState, action) => {
handleStatusBarStyle(prevState, newState, action);
}}
>
<Stack key="tickidRada">
<Scene
key="tickidRada1"
component={TickIDRada.Category}
{...navBarConfig}
back
/>
</Stack>
<Stack key="tickidRadaListService">
<Scene
key="tickidRadaListService1"
component={TickIDRada.ListService}
{...navBarConfig}
back
/>
</Stack>
<Stack key="tickidRadaServiceDetail">
<Scene
key="tickidRadaServiceDetail1"
component={TickIDRada.ServiceDetail}
{...navBarConfig}
back
/>
</Stack>
<Stack key="tickidRadaBooking">
<Scene
key="tickidRadaBooking1"
component={TickIDRada.Booking}
{...navBarConfig}
back
/>
</Stack>
</Router>
);
}
}
Props:
init
| Property | Type | Default | Description |
|-------------|----------|--------------|----------------------------------------------------------------|
| partnerAuthorization
| String
| null | The id of customer (rada provided). (required)|
| defaultLocation
| String
| null | Default customer's location in latitude, longitude (e.g. '21.034519,105.365196'). (required)|
| webhookUrl
| String
| null | The customer's webhook - units that integrate this package, to record successful booking information. (optional)|
<Category>
| Property | Type | Default | Description |
|-------------|----------|--------------|----------------------------------------------------------------|
| onPressItem
| Function
| () => {}
| Called when caterogy item onpress. (optional)|
<ListService>
| Property | Type | Default | Description |
|-------------|----------|--------------|----------------------------------------------------------------|
| keyword
| String
| ""
| The keyword of service for search. (optional)|
| page
| Style
| 0
| Default page number of service list. (optional)|
| limit
| number
| 20
| Number of services per page, maximum 40. (optional)|
| onPressItem
| Function
| () => {}
| Called when service item onpress. (optional)|
| onPressCartImage
| Function
| () => {}
| Called when cart button press. (optional)|
<ServiceDetail>
| Property | Type | Default | Description |
|-------------|----------|--------------|----------------------------------------------------------------|
| onPressOrder
| Function
| () => {}
| Called when order button onpress. (optional)|
| onPressLink
| Function
| () => {}
| Called when onpress link in html content. (optional)|
<Booking>
| Property | Type | Default | Description |
|-------------|----------|--------------|----------------------------------------------------------------|
| customerName
| String
| ""
| Name of customer. (optional)|
| phone
| String
| ""
| Phone number of customer. (optional)|
| address
| String
| ""
| Address of customer. (optional)|
| onBookingSuccess
| Function
| () => {}
| Called when booking success. (optional)|
| onBookingFail
| Function
| () => {}
| Called when booking fail. (optional)|
| onCallWebHookSuccess
| Function
| () => {}
| Called when call webhook success. (optional)|
| onCallWebHookFail
| Function
| () => {}
| Called when call webhook fail. (optional)|