我正在尝试在Reagent应用程序中使用ReactBootstrap的模态组件,但得到一个"无法读取属性' findDOMNode'未定义"尝试显示模态时出错。
我有[cljsjs / react-bootstrap" 0.28.1-1"]作为我项目中的依赖项。
以下是我用来测试的来源:
(ns react-bootstrap-test.core
(:require
[reagent.core :as r]
cljsjs.react-bootstrap))
(def rbutton (r/adapt-react-class js/ReactBootstrap.Button))
(def rmodal (r/adapt-react-class js/ReactBootstrap.Modal))
(def modal-header (r/adapt-react-class js/ReactBootstrap.Modal.Header))
(def modal-title (r/adapt-react-class js/ReactBootstrap.Modal.Title))
(def modal-body (r/adapt-react-class js/ReactBootstrap.Modal.Body))
(defonce show-modal (r/atom false))
(defn modal-test []
[:div
[rbutton {:bsStyle "primary"
:bsSize "large"
:active true
:on-click (fn [e]
(reset! show-modal true)
(.stopPropagation e))}
"Show Modal"]
[:div.rmodal
[rmodal {:show @show-modal}
[modal-header
[modal-title "Title"]]
[modal-body
[:h3 "Body"]]]]])
(r/render-component [modal-test]
(. js/document (getElementById "app")))