-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix invalid prop forwarding for custom motion components
- Loading branch information
1 parent
2011892
commit 4c9bfe7
Showing
1 changed file
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { chakra } from '@chakra-ui/react'; | ||
import { motion } from 'framer-motion'; | ||
|
||
export const AnimatedDiv = motion.custom(chakra.div); | ||
export const AnimatedForm = motion.custom(chakra.form); | ||
export const AnimatedH1 = motion.custom(chakra.h1); | ||
export const AnimatedH3 = motion.custom(chakra.h3); | ||
export const AnimatedButton = motion.custom(chakra.button); | ||
/** | ||
* Even though this seems to do nothing, this fixes the issue of Chakra Factory forwarding | ||
* framer-motion props when it shouldn't. | ||
* | ||
* @see https://chakra-ui.com/docs/features/chakra-factory | ||
*/ | ||
const shouldForwardProp = () => true; | ||
|
||
export const AnimatedDiv = chakra(motion.div, { shouldForwardProp }); | ||
export const AnimatedForm = chakra(motion.form, { shouldForwardProp }); |