Fork me on GitHub
#reagent
<
2017-07-25
>
kurt-o-sys10:07:39

I was setting up a project to use react-native with re-natal/reagent. After having some issues with the RN setup and upgrading to RN 0.46, I seem to have issues with reagent, which doesn't seem to be compatible with react >15.5.0... Am I right? (`React.createClass` doesn't exist anymore in 16.0)

kurt-o-sys10:07:16

problem solved... new version of reagent...

joshkh12:07:01

has anyone here tried the antizer react wrapper with reagent? https://github.com/priornix/antizer i'm trying to create a dropdown but i get the following error:

(defn menu []
  [ant/menu
   [ant/menu-item "one"]
   [ant/menu-item "two"]
   [ant/menu-item "three"]])

(defn dd [] [ant/dropdown {:overlay menu}])
antd.inc.js:32809 Uncaught TypeError: Cannot read property 'props' of undefined in the Dropdown.render function

pesterhazy12:07:28

maybe [ant/dropdown {:overlay #(r/as-element [menu])}]? just guessing

joshkh12:07:45

.. giving it a shot

joshkh12:07:52

hmm, nope, same error. weird.

pesterhazy12:07:13

where did you get the attribute overlay from?

joshkh12:07:51

overlay comes from the original ant-design docs:

import { Menu, Dropdown, Icon } from 'antd';

const menu = (
  <Menu>
    <Menu.Item>
      <a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">1st menu item</a>
    </Menu.Item>
    <Menu.Item>
      <a target="_blank" rel="noopener noreferrer" href="http://www.taobao.com/">2nd menu item</a>
    </Menu.Item>
    <Menu.Item>
      <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">3d menu item</a>
    </Menu.Item>
  </Menu>
);

ReactDOM.render(
  <Dropdown overlay={menu}>
    <a className="ant-dropdown-link" href="#">
      Hover me <Icon type="down" />
    </a>
  </Dropdown>
, mountNode);

joshkh12:07:09

the props error is what i get in the console

pesterhazy12:07:58

try [ant/dropdown {:overlay (r/as-element [menu])}]

joshkh12:07:56

hey that got me closer! errors went away, and some menus appear. they're misbehaving (not closing) but that might just be something in the antd api i need to explore

joshkh12:07:03

thanks for the help, pesterhazy 🙂

joshkh12:07:06

while not reagent related, do you know how i can access files in the classpath? the author mentions something about it in the Usage part of the readme but i'm not entirely sure how it's done https://github.com/priornix/antizer#usage

joshkh12:07:10

.. or even how i can see what's in the classpath? trying to read that location as a resource fails.

pesterhazy12:07:14

(-> ( "cljsjs/development/antd.inc.css") slurp) ?

pesterhazy12:07:43

I don't know what your server setup is like

pesterhazy12:07:08

personally I prefer to serve assets from a static location anyway (S3?)

pesterhazy12:07:33

the whole "static resources in the jar" thing never struck me as ideal

joshkh12:07:55

i prefer to serve my css as part of my server build, as in from /resources/public/css, however i don't like exposing the entire bower's vendor or npm's node_modules directory, and building less with paths outside the resources directory doesn't work

joshkh13:07:05

some of my apps need to run in an intranet so cdns aren't always an option. haven't really figured out a good solution...

joshkh13:07:22

(exception for lein tasks to copy files, but that feels hacky)

danielcompton22:07:26

@joshkh, @daiyi and @saskia are working on this problem too, of serving static files as part of a JAR