0.2.1 • Published 2 months ago
react-native-zonka_sdk v0.2.1
react-native-zonka_sdk
React native sdk for feekback survey
Installation
npm install react-native-zonka_sdk
Usage
Wrap the portion of your app that you want to use HomeScreen with inside <ZonkaProvider>:
import { ZonkaProvider } from "react-native-zonka_sdk";
Pass token and region in application from ZonkaProvider
const AppWithZonkaProvider = () => {
return (
<ZonkaProvider value={{token:"",region:""}}>
<HomeScreen />
</ZonkaProvider>
);
};
import { useZonkaSurvey} from "react-native-zonka_sdk";
user can get startSurvey,sendCustomAttributes,sendDeviceDetails,userInfo,logout from useZonkaSurvey hook
const HomeScreen = () => {
const { startSurvey,sendCustomAttributes,sendDeviceDetails,userInfo,logout } = useZonkaSurvey();
const onPress=()=>{
startSurvey()
}
return (
<View>
<Text>Hello world!</Text>
<Button onClick={onPress}>Press</Button>
</View>
);
}
You can get startSurvey,sendCustomAttributes,sendDeviceDetails,userInfo,logout from useZonkaSurvey
sendCustomAttributes(hash).sendDeviceDetails(true).startSurvey();
if want to pass send custom attributes then use like below:-
const hash={
contact_number:"9999999"
}
await sendCustomAttributes(hash).startSurvey();
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT
---
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)