Releases: thedevelobear/react-rewards
v2.0.4
v2.0.3
Fix useRewards hook that didn't work with async components.
Here's an example of the code that didn't work in v2.0.0/v2.0.1/v2.0.2:
const SomeAsyncScreen = () => {
const [ data, setData ] = useState(undefined);
const { reward, isAnimating } = useReward("rewardId", "confetti");
useEffect(() => {
setTimeout(() => {
setData({});
}, 500);
}, []);
if (!data) return "Loading...";
return (
<div className="App">
<span id="rewardId" />
<button disabled={isAnimating} onClick={reward}>
Make it rain!
</button>
</div>
);
};
The problem was that the element was grabbed in useLayoutEffect, which fired synchronously after all DOM mutations. In this case there was no element with an id === "rewardId" on mount.
The problem was fixed in this release.
v2.0.2
- Fixed isAnimating flag for confetti animation
EDIT: This release contains an issue with useReward hook not finding an element in asynchronous components (#83).
It was fixed in v2.0.3 (https://github.com/thedevelobear/react-rewards/releases/tag/v2.0.3)
v2.0.0
v2.0.0 is here!
- Rebuilt the library from scratch (new bundler configs, added TS)
- The library now works with hooks
- You can import confetti(), emoji() and balloons() functions directly if you can't/don't want to use hooks
- Got rid of Lottie-Web and React-Pose dependencies (those looked cool, but made this package much bigger and unnecessarily complex)
- Added new balloons animation
- Worked on confetti animation to make it look more life-like
EDIT: This release introduced an issue with useReward hook not finding an element in asynchronous components (#83). It was fixed in v2.0.3 (https://github.com/thedevelobear/react-rewards/releases/tag/v2.0.3)
Full Changelog: v1.1.2...v2.0.0
v1.1.2
What's Changed
- Swap "him" for "them" by @matchai in #4
- Log file(s) by @jacekk in #5
- Fix minor typo by @lehaSVV2009 in #11
- Bump eslint-utils from 1.4.0 to 1.4.3 by @dependabot in #12
- student project documentation edits by @compSciKai in #14
- Bump handlebars from 4.1.2 to 4.5.3 by @dependabot in #16
- Bump handlebars from 4.1.2 to 4.5.3 in /example by @dependabot in #15
- Added typescript definitions (closes #20) by @CampbellMG in #23
- Create LICENSE by @marvinschopf in #33
- Bump websocket-extensions from 0.1.3 to 0.1.4 by @dependabot in #18
- Bump websocket-extensions from 0.1.3 to 0.1.4 in /example by @dependabot in #19
- Bump http-proxy from 1.17.0 to 1.18.1 by @dependabot in #24
- Bump http-proxy from 1.17.0 to 1.18.1 in /example by @dependabot in #25
- Bump ini from 1.3.5 to 1.3.7 by @dependabot in #27
- Bump ini from 1.3.5 to 1.3.7 in /example by @dependabot in #28
- Bump elliptic from 6.5.0 to 6.5.4 by @dependabot in #36
- Bump elliptic from 6.5.0 to 6.5.4 in /example by @dependabot in #37
- Bump y18n from 3.2.1 to 3.2.2 by @dependabot in #38
- Bump y18n from 3.2.1 to 3.2.2 in /example by @dependabot in #39
- Bump ua-parser-js from 0.7.20 to 0.7.28 in /example by @dependabot in #41
- Bump handlebars from 4.5.3 to 4.7.7 in /example by @dependabot in #42
- Bump handlebars from 4.5.3 to 4.7.7 by @dependabot in #43
- Bump hosted-git-info from 2.8.4 to 2.8.9 by @dependabot in #45
- Bump hosted-git-info from 2.8.4 to 2.8.9 in /example by @dependabot in #46
- Bump dns-packet from 1.3.1 to 1.3.4 by @dependabot in #47
- Bump dns-packet from 1.3.1 to 1.3.4 in /example by @dependabot in #48
- Bump merge-deep from 3.0.2 to 3.0.3 by @dependabot in #50
- Bump path-parse from 1.0.6 to 1.0.7 by @dependabot in #55
- Bump path-parse from 1.0.6 to 1.0.7 in /example by @dependabot in #56
- Bump tar from 4.4.10 to 4.4.19 by @dependabot in #57
- Bump tar from 4.4.10 to 4.4.19 in /example by @dependabot in #58
- Bump tmpl from 1.0.4 to 1.0.5 in /example by @dependabot in #59
- Bump tmpl from 1.0.4 to 1.0.5 by @dependabot in #60
- Bump urijs from 1.19.1 to 1.19.8 by @dependabot in #70
- Bump urijs from 1.19.1 to 1.19.8 in /example by @dependabot in #71
- Bump url-parse from 1.4.7 to 1.5.10 by @dependabot in #72
- Bump url-parse from 1.4.7 to 1.5.10 in /example by @dependabot in #73
- Bump follow-redirects from 1.7.0 to 1.14.9 in /example by @dependabot in #74
- Bump follow-redirects from 1.13.0 to 1.14.9 by @dependabot in #75
- Bump ws from 7.1.2 to 7.5.7 by @dependabot in #76
New Contributors
- @matchai made their first contribution in #4
- @jacekk made their first contribution in #5
- @lehaSVV2009 made their first contribution in #11
- @dependabot made their first contribution in #12
- @compSciKai made their first contribution in #14
- @CampbellMG made their first contribution in #23
- @marvinschopf made their first contribution in #33
Full Changelog: https://github.com/thedevelobear/react-rewards/commits/v1.1.2