Skip to content

Latest commit

 

History

History
171 lines (149 loc) · 3.15 KB

README.md

File metadata and controls

171 lines (149 loc) · 3.15 KB

WhatsappShare

A WhatsappShare component will help you to open whatsapp directly and share the message. You can provide a pre-defined mobile number and share the details directly in a specific number as well.

Demo

A minimal Demo Link

Usage/Examples

Value Used as a Description
WhatsappShare ✅ Component Can be used as Component
whatsappShare ✅ Service Can be used as Service
1. Here's an example of basic usage with Multiple Import: with Default Import:
// Default import will return WhatsappShare Component
import WhatsappShare from 'fe-pilot/WhatsappShare';

<WhatsappShare /> // Used as a Component
2. Here's an example of basic usage with Multiple Import: with Multiple Import:
import { WhatsappShare, whatsappShare } from 'fe-pilot/WhatsappShare';

<WhatsappShare /> // Used as a Component

whatsappShare(); // Used as a Service
3. Here's an example of a advanced usage:
import { WhatsappShare } from 'fe-pilot/WhatsappShare';

const successCb = (response) => {
  console.log("success response:", response);
}

const failureCb = (response) => {
  console.log("failure response:", response);
}

return (
  <WhatsappShare
    successCb={successCb}
    failureCb={failureCb}
    mobile="7204535372"
    msg="Welcome to fe-pilot"
  >
    Pass clickable element (button, anchor etc)  here to bind onClick event
  </WhatsappShare>
);

Props

Props Type Description Response
successCb Function It will be called on success
{
    data: "Can be array/object/string/number",
    msgType: "SUCCESSFUL",
    msg: "A success msg",
    status: "SUCCESS"
}
      
loadingCb Function It will be called before success/failure.
{
  msgType: "LOADING",
  msg: "LOADING...",
  status: "LOADING"
}
failureCb Function It will be called on failure
{
  msgType: "ERROR",
  msg: "A failed msg",
  status: "FAILURE"
}
       
Props Type Description Default Values
showForever Boolean To hide/remove unsupported feature, make it false. Default value is true.
mobile number Provide a mobile number to open directly
---
msg String Provide a message to send to user
---