0.22: Hermes Support 🏛️
yarn add moti
This version adds support for Hermes. It was long a mystery why this didn't work properly. (Read #214)
I suspected incrementing framer-motion
's version was the cause. Its use of Proxy
could complicate things with Hermes. But adding a resolution to older versions didn't help.
I diff'd the last version of Moti that worked with Hermes (0.17
) with the first one that didn't (0.18
) and spent hours comparing them line-by-line. To my surprise, the issue didn't lie in a lockfile – rather, it was the syntax of a for loop.
Changing for (const key in styles)
to Object.keys(styles).forEach(key
fixed it.
I have no idea why the former syntax didn't work properly. It didn't throw any sort of error. But it subtly resulted in useAnimatedStyle
's worklet going stale after the first render.
You can see the one line-ish PR here at #253.
- for (const key in exitStyle || {}) {
+ Object.keys(exitStyle || {}).forEach((key) => {
Happy Friday night 🕺