@catch-health/mobile-widget v1.0.1
Mobile Widget
Requirements
You need to have react
, react-native
and react-native-webview (version 11) installed in your project.
Installation
npm install @catch-health/mobile-widget
Usage
import { CatchWidget } from '@catch-health/mobile-widget';
// ...
<CatchWidget userId="<userId>" loginToken="<loginToken>" widgetId="<widgetId>" />
Properties
widgetId (required)
This is the ID provided by Catch Health, it represents the widget to be displayed.
userId and loginToken
These properties are used to start the widget with a logged in user.
route
This property is used to pass an extended route to the internal widget.
environment (default: 'production'
)
The environment the widget is going to run on. The options are: 'production'
and 'staging'
.
onClose
This event is called when the user hits the "Exit" button from within the widget. It can be used to customize the closing behavior on your app.
onLoadStart
This event is called when the widget starts loading.
onLoadEnd
This event is called when the widget finishes loading.
noCache (default: false
)
This property is used to force clearing the cache inside the WebView, where Catch's widget runs.
Cleaning cache
The login information is stored in the widget. It can be cleared by calling the cleanCache
function:
import { cleanCache } from '@catch-health/mobile-widget';
// ...
const handleLogout = () => {
cleanCache();
};