Fork me on GitHub
#clojurescript
<
2019-04-11
>
lepistane13:04:21

Looking for someone with knowledge of cljs+rn or re-natal i am having trouble generating working apk

dnolen13:04:20

@lepistane btw, there's a #cljsrn channel

dnolen13:04:34

oh I see you found it πŸ™‚

πŸ‘ 4
stathissideris13:04:39

is it ok to use *warn-on-infer* without :infer-externs true?

dnolen13:04:06

I don't see what could go wrong

stathissideris13:04:13

thanks πŸ™‚

danieroux13:04:42

I want to consume an npm library, and run on node, I'm going the webpack route. How do I map :global-exports? window is not a node namespace and global doesn't seem to work?

var mqtt = require('mqtt');
global.mqtt = mqtt; // <-- what do I do here?
After a (:require [mqtt]), js/mqtt is bound, but mqtt is not.

orestis14:04:27

@danie Obligatory shadow-cljs mention β€” it has all this ready to go and with a user guide. #shadow-cljs for more info.

orestis14:04:50

(It’s not based on webpack but it sets it up all for you)

orestis14:04:59

Sorry if I can’t be of any more help 😞

danieroux14:04:47

@orestis I have it working in shadow-cljs, and would really prefer the clj/deps/figwheel.main route. shadow confuses me sometimes. I'll go ask questions #shadow-cljs πŸ™‚

mkvlr14:04:30

@danie wrap in a function (function () { this.mqtt = require('mqtt'); }();

mkvlr14:04:07

should work in browser, node and web worker

danieroux14:04:03

@mkvlr webpack did not like that. Which made me google webpack and node, and this works:

module.exports = {
  node: {
      global: true
  }, 
global.mqtt = mqtt;

lilactown15:04:10

yeah this will be undefined in Node.js

lilactown15:04:22

and in strict mode

hoopes18:04:23

total hail mary, has anyone used react-select and material-ui with cljs? i seem to be having trouble reconciling refs (or something???). if someone had an example, i'd be much obliged. fwiw, i'm using shadow, and just npm install react-select @material-ui/core to get access - no cljsjs

Zachary18:04:44

What do you mean by reconciling refs? Do you have some sample code? I've worked with react-select at work

hoopes18:04:24

is there a jsfiddle for cljs? ( https://escherize.com/cljsfiddle/ ha...let me try to get something together)

πŸ‘ 4
hoopes18:04:27

this is gonna take longer than i thought πŸ˜• - my problem appears to be that when i replace the Control component with a TextField, i no longer have input - i can't type to filter. The DOM looks exactly the same between what I have and what's in the example https://material-ui.com/demos/autocomplete/#react-select , but it's not taking the input. Could it be a controlled component issue? The only weird thing is i'm going back and forth between cljs and js (too much?). Sorry for the scattered thoughts, I've been working on this for two days and I have a newborn, so my brain is having trouble.

hoopes18:04:57

i know that's probably hard to understand without code to look at - sorry

Zachary18:04:23

No worries lemme take a look πŸ™‚

hoopes19:04:03

tryign to replace the Control component with this

Zachary19:04:08

@U0G2E3SEM are you replacing it with a pure TextField (no component wrappers around it) or do you create your own custom wrapper?

hoopes19:04:34

this is the example

Zachary19:04:03

if you're trying to forward refs won't u have to use the React.forwardRef function: https://reactjs.org/docs/forwarding-refs.html

Zachary19:04:20

const FancyButton = React.forwardRef((props, ref) => (
  <button ref={ref} className="FancyButton">
    {props.children}
  </button>
));

Zachary19:04:00

did you try seeing if the ref exists?

hoopes19:04:31

ha, i'm not sure, i've never had to get way down in the react weeds yet! but i appreciate you pointing that out, i will try it (although it's not in the example). yeah, i put debuggers in mine, and in the one from the example, the refs look exactly the same

hoopes19:04:57

it's one of those "um, everything looks lined up, but it's not working" things

hoopes19:04:05

almost to the end of my rope...

hoopes19:04:31

another clue is that clicking off the options doesn't close the option dropdown