0.1.2 • Published 1 year ago

ts-react-native-sxp v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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