0.1.1 • Published 11 months ago

react-native-wisebacksdk-module v0.1.1

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

react-native-wisebacksdk-module

WisebackSDK for ReactNative

Installation

npm install react-native-wisebacksdk-module

Usage

import WiseView from 'react-native-wisebacksdk-module';

// ...

type WiseParamType = {
  eventName: string;
  params?: Record<string, string>
};

function App(): JSX.Element {
  const [appID] = useState("ENTER APP ID");
  const [hostname] = useState("ENTER HOST NAME");
  const [formID, setFormID] = useState("");
  const [eventParams, setEventParams] = useState<WiseParamType | null>(null);

  const showForm = (pFormID:string) => {
    setFormID(pFormID);
  }
  const clearFormID = () => {
    setFormID("");
  }
  const eventListener = (eventData: string) => {
    console.log("event triggered: ", eventData);
  }
  const callEvent = (pEventParams:WiseParamType) => {
    setEventParams(pEventParams);
  }

  return (
    <SafeAreaView style={{flex:1}}>
      <WiseView appID={appID} hostname={hostname} formID={formID} eventParams={eventParams} showLoader={true} closeButton={false} closeHandler={clearFormID} eventHandler={eventListener} />
      <Button title="Show Form" onPress={()=>showForm("ENTER FORM ID")} />
      <Button title="Call Event" onPress={()=>callEvent({eventName: "ENTER EVENT NAME", params: {ENTER CUSTOM PARAMETERS}})} />
    </SafeAreaView>
  );
  
}

Contributing

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

License

MIT