how to add custom emoji
bilalturkmen opened this issue ยท 2 comments
bilalturkmen commented
Hello,
thanks for the nice package.
how to add custom emoji? it might be helpful add an example to the document.
i tried like below. is this the right way?
import { useReward } from 'react-rewards';
...
const { reward: confettiReward, isAnimating } = useReward(
"rewardId",
"emoji",
{
emoji: ["โก๏ธ", "๐ฅ", "โจ", "๐ซ", "๐ธ", "๐"],
}
);
...
<button
disabled={isConfettiAnimating}
onClick={() => {
confettiReward();
}}
>
<span id="confettiReward" />
๐
</button>
AnaBelenBernardez commented
Here is an example that works for me ๐:
import { useReward } from "react-rewards";
. . .
const { reward: confettiReward, isAnimating } = useReward(
"rewardId",
"emoji",
{
emoji: ["โก๏ธ", "โจ", "๐", "๐"],
}
);
. . .
<button
disabled={isAnimating}
onClick={() => {
confettiReward();
}}
>
<span id="rewardId" />
๐
</button>
bilalturkmen commented
thank you Ana,
We can also use some settings in the readme file
example
const { reward: confettiReward, isAnimating } = useReward("rewardId", "emoji", {
emoji: ["โก๏ธ", "๐ฅ", "โจ", "๐ซ", "๐ธ", "๐", "๐"],
elementSize: 15,
elementCount: 60,
lifetime: 100,
});
very nice package ๐