Daily Check-in Credit
The Daily Check-in Credit component is designed to incentivize users to check in daily by displaying a notification at the top of the app interface. This notification will automatically close.
Last updated
npm install @questlabs/react-native-sdkimport { Notification } from "@questlabs/react-native-sdk";import { SafeAreaView, StyleSheet } from "react-native";
import React from "react";
import { Notification } from "@questlabs/react-native-sdk";
export default function App() {
return (
<Notification.Provider notificationView={{ backgroundColor: "gray" }} >
<SafeAreaView style={styles.container}>
<MyButton />
</SafeAreaView>
</Notification.Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "lightgray",
justifyContent: "center",
},
});import { View, Text, Button } from "react-native";
import React, { useContext, useEffect } from "react";
import { Notification } from "@questlabs/react-native-sdk";
const MyButton = () => {
const { close, showNotification, setCallBack } = useContext(
Notification.Context
);
const show = () => {
console.log("Close");
};
useEffect(() => {
setCallBack(show);
}, []);
return (
<View>
<Button
title="Open"
onPress={() =>
showNotification({
title: "This is notification title",
detail: "this is the details text",
image:'this is the image uri'
})
}
/>
<Button title="Close" onPress={close} />
</View>
);
};
export default MyButton;