ts-react-native-sxp
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

ts-react-native-sxp

Use SXP in react native

Installation

npm install ts-react-native-sxp

Usage

Import the useSXPChat hook from ts-react-native-sxp

pass the parameters of SXP:

  • URL
  • Path
  • Token
  • pId
  • appId
  • version
  • A function to capture all events (Preferably a usecallback o)
    • Connecting
    • Connected
    • Join
    • Message
    • Disconnect
import { useCallback } from 'react';
import { useSXPChat } from 'ts-react-native-sxp';

// ...

  const sxpEvent = (type: string, data: any) => {
    // ...
  };

  const {quickBtnList, restart, sendMsg} = useSXPChat(
    url,
    path,
    token,
    pid,
    appId,
    version,
    sxpEvent
  );

Returns:

  • quickBtnList: list of quick buttons that should be available
  • restart: Function that sends a ::restart command
  • sendMsg: Accepts a string and sends the message via the socket

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

Package Sidebar

Install

npm i ts-react-native-sxp

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

21.3 kB

Total Files

10

Last publish

Collaborators

  • techsophydw