Fork me on GitHub
#cljsrn
<
2016-01-15
>
alexandergunnarson04:01:11

Hey everyone! Have any of you gotten Figwheel working with js.React? I've already seen the great example of Figwheel with React Native here (https://github.com/decker405/figwheel-react-native)

mfikes04:01:08

@alexandergunnarson: Re-Natal gets you up and running that way pronto.

alexandergunnarson04:01:23

Thanks for your quick response! I'll check that out.

alexandergunnarson04:01:56

It says react-native — is it possible to configure as react.js (WebView)? I want to have a web UI for consistency across platforms. Native UI is great performance-wise but appearance of course varies across platforms, whereas the DOM renders (more or less) in exactly the same way.

alexandergunnarson04:01:04

P.S. — amazing job with Planck! It's incredibly fast and I love it!

mfikes04:01:31

Ahh, you, my friend, are in the native channel simple_smile Having said that, Artem has a really cool thing that can sync across all three. Check out the video he has on https://github.com/artemyarulin/om-next-cross-platform-template

alexandergunnarson04:01:55

I figured this channel would be the best way to go because even though I'm not looking for a native UI, I'm looking for cross-platform deployment... but yeah, maybe there's a better channel 😉

mfikes04:01:56

I don’t know if you can hook into a WebView running on a mobile device, if that’s what you mean.

alexandergunnarson04:01:34

Yeah that's what I mean. Hmm

alexandergunnarson04:01:48

Thanks so much for the link by the way! I'm checking it out now.

mfikes04:01:23

Yeah, one thing to consider is the “learn once, write anywhere” theme of React.

alexandergunnarson04:01:57

Yeah, I've been reading about that. I don't mind learning a ton of new stuff — I'm just not in the group of people who wants or needs a native look and feel. Native performance is awesome, but I want a consistent visual appearance across platforms.

alexandergunnarson04:01:44

To my knowledge, there's not some abstraction that ensures cross-platform visual consistency of native components. Right?

alexandergunnarson04:01:56

That's why I figured I'd have to stick with the (V)DOM

alexandergunnarson04:01:19

om-next-cross-platform-template looks awesome! I'm actually using Reagent, but that doesn't seem to be a problem because it's likely a simple switch of dependencies and minor code refactoring. It seems that it's using react-native for mobile devices though, which is again something I probably don't want to do for the reasons I mentioned.

mfikes04:01:51

@alexandergunnarson: My guess is you’d want to render things in a WebView, but use conventional React with a Reagent binding.

alexandergunnarson04:01:52

Yup! That's exactly it.

mfikes04:01:54

Once you start using React Native, the consistency diverges and you start getting native look and especially feel (animations, gestures, etc.)

alexandergunnarson04:01:50

Like I said, I really enjoy the performance benefits of native but it's not a tradeoff I can make given the UI inconsistencies. I'm probably among the minority though

alexandergunnarson04:01:33

React Native is amazing though! If I ever have a need for native look and feel, it's the first thing I'll turn to.

alexandergunnarson04:01:42

So you were saying that you're not quite sure you can hook Figwheel into a WebView on a mobile device, correct? I might ask this on a different channel then, so as not to clog this channel up with non- React Native questions 😉

alexandergunnarson04:01:02

Thanks so much for your help! I really appreciate it.

mfikes04:01:50

I bet you can… Figwheel just needs websocket support I believe. Might need a little hacking.

alexandergunnarson04:01:31

WebView doesn't have websockets? 😧

alexandergunnarson04:01:47

Or it just requires a little configuring like you said?

mfikes04:01:10

It does… the hacking might simply be in getting Figwheel to hook to it.

alexandergunnarson04:01:46

Right. I was shocked for a second haha... I was like that doesn't even make sense that WebView wouldn't have something as essential as that

alexandergunnarson04:01:02

Hmm... yeah I wonder if there are any existing repos for it... from what I can see there aren't

alexandergunnarson04:01:34

There's mobile + React Native + Figwheel, and mobile + ClojureScript REPL, but no mobile + WebView + Figwheel out there so far as I can see.

mfikes04:01:31

@alexandergunnarson: It might just work if you have your native app create a WebView and instruct it to open the URL that you’d normally hand-type into a web browser URL bar when using Figwheel.

alexandergunnarson04:01:48

That's what my plan of action was.

alexandergunnarson04:01:46

I just need to use XCode, learn a bit of Swift, and set that all up so the WebView is created and goes straight to the page.

alexandergunnarson04:01:17

I was hoping to not have to go the manual route but if there's nothing out-of-the-box... that's how it'll have to be haha

alexandergunnarson04:01:52

I was originally thinking something like Cordova (or PhoneGap, same thing basically) might work, but it seems like it might not be tailor-fit to my situation.

alexandergunnarson05:01:53

Done. Got it solved really painlessly using Cordova in like 0.3 seconds. I don't know why I didn't do it earlier!

artemyarulin07:01:34

yeah Cordova is exactly for that purpose. Although IMHO it’s past and with RN i see almost no reason to start projects with that

dvcrn07:01:55

so in re-natal, if I use use-component, how do I actually include it in my project?

dvcrn07:01:12

the component is now compiled into the project and loaded by figwheel and what not, but how do I use it from cljs?

dvcrn07:01:48

js/require? node/require? 😛

dvcrn07:01:50

let me try that

dvcrn07:01:09

yep that seems to have worked. At least I have a reference to the component now

dvcrn07:01:25

I know I said it already but crazy how high polished re-natal feels

artemyarulin07:01:24

yeah, the whole idea that you can use js/require as in RN

dvcrn08:01:29

Now all I need is a neural network that can design UIs for me 😛

jaen08:01:59

@dvcrn: https://thegrid.io/ (though it's webpages only at the moment)

artemyarulin08:01:10

@jaen: Ha, ad looks awesome. Can I have the same but for the source code? Tired of writing the software 😄

jaen08:01:58

But if that happened then we would all be jobless D :

dvcrn08:01:44

or maybe I should just hire a designer >_>

artemyarulin09:01:13

actually yeah - I have the same problem. Usually when I design everything by myself the end result is amazing, but for some reason other people vomit from that :thinking_face:

dvcrn09:01:06

Too bad users don't appreciate beautiful code 😞

dvcrn09:01:29

maybe time to stop developing on that app for a while and get my ass on getting better in design

meow13:01:28

anyone? ^