问题
I've imported the farmer-motion library using shadow-cljs. The framer motion library has the custom react component div.motion. It's used as follows:
https://www.framer.com/api/motion/examples/#animation
:
import { motion } from "framer-motion"
export const MyComponent = () => (
<motion.div
animate={{ scale: 2 }}
transition={{ duration: 0.5 }}
/>
)
I'm using reagent to render the div.motion component:
(ns myapp.foo
(:require
;; shadow-cljs import
[framer-motion :refer (motion MagicMotion AnimateSharedLayout
AnimatePresence useSpring useMotionValue
useTransform useViewportScroll) :as motion]
))
;; call div.motion just div.
(def div (.-div motion))
(defn my-component []
;; ":>" is short for r/adapt-react-class
[:> div "Foo"])
Yet rendering with reagent-dom/render, my-component gives the error:
TypeError: lastCallbackNode is not a function. (In 'lastCallbackNode()', 'lastCallbackNode' is 1)
flushFirstCallback — module$node_modules$scheduler$cjs$scheduler_development.js:2:479
flushWork — module$node_modules$scheduler$cjs$scheduler_development.js:6:147
(anonymous function) — module$node_modules$scheduler$cjs$scheduler_development.js:12:365
flushFirstCallback — module$node_modules$scheduler$cjs$scheduler_development.js:2:479
Why would that be? What am I doing wrong? I've also raised an issue on the reagent GitHub repo with more details (https://github.com/reagent-project/reagent/issues/502) and the symptoms of this bug.
来源:https://stackoverflow.com/questions/62545637/lastcallbacknode-is-not-a-function