lastCallbackNode is not a function

夙愿已清 提交于 2021-01-29 09:22:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!