Fork me on GitHub
#cljsrn
<
2021-02-25
>
raspasov15:02:16

Has anyone been able to setup react-native-web to work with ClojureScript? https://github.com/necolas/react-native-web

raspasov15:02:31

Woah, I actually made it work… With a figwheel-main setup… Needs a small tweak in fighweel-main to get the REPL started but very cool nonetheless. Screen Shot 2021-02-25 at 7.56.08 AM.png

👍 3
pez15:02:22

Congrats!

💪 6
cljs 6
clj 3
pez15:02:09

This example project also has it configured. Cheating a bit, of course. https://github.com/PEZ/rn-rf-shadow

raspasov15:02:42

Needs like a JavaScript flavor tweak, need a crossed-JS emoji here 😝

raspasov15:02:15

@pez very cool, I was googling and saw your project, but I haven’t used shadow; that was gonna be my next step if this didn’t work.

raspasov15:02:22

What is the cheat there?

pez16:02:26

Expo. Not for all projects. But when it can be used, it is sweet!

raspasov16:02:42

Yeah, I am going through Expo as well…

raspasov16:02:55

The setup without expo of react-native-web seems pretty verbose.

raspasov16:02:46

… in terms of all-JS-tools-i-want-to-know-nothing about 🙂 (wanted to avoid that if possible)

pez16:02:52

Here’s a very good take at Expo or not Expo: https://www.youtube.com/watch?v=7-t6deIO1JE

raspasov16:02:11

I am not using Expo to build the app… still going through Xcode;

raspasov16:02:21

I only use some libs here and there that are good.

raspasov16:02:50

@pez will watch the video, thanks!

raspasov16:02:39

Basically I pull in expo, but stick to the standard react-native tooling as much as possible… And go through XCode and Android Studio, etc etc… Less magic, and I’ve done through all the setup of those in the past. For somebody who has never touched XCode, it can be overwhelming, even where to click is a challenge (so many knobs, menus, checkboxes, buttons)

pez16:02:51

For me the best thing with Expo isn’t so much the build tooling. It’s how fast I can get the app tested by users.

raspasov16:02:10

@pez that’s a great point; because of Expo Go?

pez16:02:56

Because of the Expo client mostly.

raspasov16:02:37

Technically you can achieve that without Expo via https://github.com/microsoft/code-push (I used that a few years ago, used to be very easy once setup, but now it seems to require some signup with Microsoft App Center)

❤️ 3
pez16:02:59

Will check!

raspasov16:02:27

It just serves your javascript to a native app (that is already in the App Store or Testflight)

raspasov16:02:49

It’s what Expo initially copied pretty much 100% 🙂 (they were pretty open about it)

raspasov16:02:11

Copied in terms of workflow, not in any malicious way, Expo guys are great

pez16:02:56

Can you push a react native app using binary libs that way?

raspasov16:02:06

What do you mean by binary libs

raspasov16:02:14

That require … compiled code?

raspasov16:02:28

I don’t think so… Can you through Expo now?

raspasov16:02:01

I am pretty sure it only worked for JavaScript/Cljs only changes

pez16:02:25

Those libs you can’t use b/c you use Expo. It is because it all needs to either exist in the Expo client or be pure javascript, if I have understood correctly.

raspasov16:02:44

If you needed to add a new binary/compiled dependency that requires some “pod install”, you’d need a new testflight or App Store update

pez16:02:00

Ah, but that would work.

pez16:02:26

Expo should copy that model. 😃

raspasov16:02:01

Wait, perhaps we’re misunderstanding each other 🙂 Anyway… I am 95% certain it’s only JavaScript updates that you can push through code-push and expo currently, nothing else.

pez16:02:51

Yeah, but if my App as such can use whatever libs, that’s much better than the Expo offer, where those libs simply can’t be used.

pez16:02:16

Better in that respect, that is. Expo has a lot going for it.

raspasov16:02:18

@pez I see what you mean, yeah, if you want custom binary libs, you need your own TestFlight or App Store app with those binaries in place (vs the Expo testing app which only has a preset number of them, if I understand correctly)

raspasov16:02:13

@bhauman This is the small tweak I needed to do in order to get react-native-web to comply:

// module.exports = {
//   shimRequire: shimRequire,
//   start: startApp,
//   createBridgeComponent: createBridgeComponent
// };

export {
    shimRequire,
    createBridgeComponent
};
Wasn’t sure how to handle the re-naming of the startApp function (as far as I can tell, that’s only needed if you’re not using Expo).

raspasov16:02:59

@pez did you end up using react-native-web for anything beyond a toy example?

pez16:02:20

Only for toy, so far. 😃

👍 3
joshmiller17:02:20

Speaking of CodePush, has anyone ever tried just putting the JS for their app on the web and serving from there and caching if necessary? Seems like it wouldn’t be all that difficult.

raspasov23:02:24

I thought about it for a second when I was using CodePush, but CodePush was pretty solid at doing that so I didn’t want to reinvent the wheel; it has some nice things like a CLI and ability to roll back etc... but again I haven’t used it recently so I don’t know what is its state right now

frankitox22:02:15

Hi, anyone ever encountered a problem where the debugger disconnects after a reload (in shadow-cljs)? If I add certain closure library namespaces (like goog.date.relative ) then the debugger disconnects in the first reload attempt.

frankitox01:02:57

I'm not sure why this is happening. I tried a new project and it works correctly. I suspect it's something about the size of the project, my app folder goes from 42MB -> 44MB when I add goog.date.relative to the requires.