1.0.5 • Published 5 months ago

@yourgpt/chatbot-reactnative v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@yourgpt/chatbot-reactnative

Integrate YourGPT Chatbot seamlessly into your react-native application.

Installation

1. Add @yourgpt/chatbot-reactnative to your dependencies

$ npm i @yourgpt/chatbot-reactnative

2. Add react-native-webview to your dependencies

Refer react-native-webview docs

3. Link native dependencies

iOS & macOS:

If using CocoaPods, in the ios/ or macos/ directory run:

$ pod install
Android:

No aditional configuration required.

Usage

You can get your widget_id from https://yourgpt.ai/chatbot

// In app.tsx
import React from 'react';
import {SafeAreaView, View} from 'react-native';
import YourGPTProvider from '@yourgpt/chatbot-reactnative';

function App(): JSX.Element {
  return (
    <SafeAreaView style={{flex: 1}}>
      <YourGPTProvider widgetId="Your_Widget_Id">
          // YOUR CODE HERE
      </YourGPTProvider>
    </SafeAreaView>
  );
}

export default App;
// In components/OpenBot.tsx
import React from 'react';
import {Button} from 'react-native';
import {useYourGPT} from '@yourgpt/chatbot-reactnative';

export default function OpenBot() {
  const {open} = useYourGPT();

  return <Button onPress={open} title="Open Bot" />;
}

API

Props

Props which will be passed in <YourGPTProvider>

PropTypeRequiredDescription
widgetIdStringYesWidget id of yourGPT chatbot
headerColorStringNoCustom header color, by default transparent
childrenReactNodeYesReact native elements which will be wrapped inside YourGPTProvider

Methods

All the methods which you can get from useYourGPT hook.

MethodParameterDescription
openvoidOpen chatbot widget inside a webview
closevoidClose chatbot widget
1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago