Skip to content

Releases: thedevelobear/react-rewards

v2.0.4

01 Jun 07:36
56e1e7f
Compare
Choose a tag to compare
  • Add support for React 18
  • Memoize reward function

v2.0.3

28 Mar 16:04
98adb14
Compare
Choose a tag to compare

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

28 Mar 10:23
669e6c0
Compare
Choose a tag to compare
  • 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

25 Mar 20:58
a9aa935
Compare
Choose a tag to compare

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

06 Mar 17:55
d3483bc
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/thedevelobear/react-rewards/commits/v1.1.2