Fork me on GitHub
#cljsrn
<
2020-04-16
>
jimberlage02:04:43

This is what I would typically do in a work project. • For shadow-cljs imports where the typical JS import syntax is import { Alert } from 'react-native'; I use :refer to get the same effect. I've found it helps newcomers to clojure from Javascript to see syntax that's visually similar. • When styles are shared, I'll use a def statement so I can merge them in different components. Generally though, I stay away from the Stylesheet.create paradigm, and try to define the styles close to the elements they target instead. • With that, I break up components into smaller molecules, which helps when not using Stylesheet.

Shako Farhad19:04:56

By the way, @U4QC052UQ, what do you think of the setup of the core.cljs file? Am I initiating my app correctly? :o

jimberlage20:04:01

I'll take a look a bit later and do the same thing I did for this file for ya

Shako Farhad21:04:51

Wow thank you! Much appreciated! That is awesome!

Shako Farhad08:04:03

Alright that is great! I will make the appropriate changes! 😄

Shako Farhad08:04:24

Do you use Reanimated and Gesturehandler? I am not quite sure how to get those into my project and begin using them. The examples online are also kind of lackluster. I have setup my project with NPM but online they want to use yarn to add these modules. And as I understand it, we shouldn't use both yarn and npm for packages, right?

raspasov08:04:30

@shakof91 I’d stick to yarn for React Native; I don’t have scientific proof for it, but it has been better than npm in my experience

👍 4
raspasov08:04:40

I have also used Reanimated/Gesturehandler, they are quite good, but only go for them if you really have the use case for them

Shako Farhad08:04:55

I want to explore them and kind of write up how to use them. How did you import them into your project? Any steps that need to be taken? I see there is something about linking the packages etc. I don't quite understand what that means. I will also restart my project with yarn this time.

jimberlage14:04:53

Linking should be mostly taken care of on newer versions of react-native. Basically, some of the objective-c and java files needed to be told about the existence of objective c and java files in libraries you imported. Now, react-native has an automated way to do that.

Shako Farhad14:04:30

Ah ok. So as long as I run that link command, it should be taken care of? I am using the cutting edge versions of react and react native. ^^

jimberlage15:04:06

Yeah, linking shouldn't be a thing you have to consciously run a command to do on new versions of react native. If a library doesn't support auto-linking, they usually call it out in their readme

Shako Farhad15:04:24

Alright. I understand. Thank you!

dnolen20:04:01

All right the Reagent tutorial for Krell is done - https://github.com/vouch-opensource/krell/wiki/Reagent-Tutorial

❤️ 16
dnolen20:04:11

I tested that hot-reloading, production build works - I didn't try every combination simulator/device but I'm sure I'll hear from people if something doesn't work

dnolen20:04:35

as far as features, I'm not sure there is going to be much more - but if you're really itching for something, let me know

dnolen20:04:04

my main priority on this project will be to be keep the feature set small and work on performance

dnolen20:04:13

I think we can make simpler version of Metro's cache on device and that would help w/ shorter time to see the app and getting to actually hacking w/ a REPL

⚒️ 12
dnolen20:04:22

oh and another thing, I'm not interested in flags or options for the entry point

dnolen20:04:31

I just think that kind of customization is gratuitous

dnolen20:04:43

just return your component from -main that's already a convention

👍 4
dnolen20:04:18

there's also no real need for integration - the reloader is in the Krell root - so as long your ClojureScript React libs returns a component - there's nothing to do

dotemacs20:04:11

Thank you for your work @dnolen I’ve already gave it a spin and I like what you’ve done!

dnolen20:04:53

👍:skin-tone-4:

jimberlage21:04:01

@shakof91 I think this would work for you: • reagent.core/reactify-component I think does a lot of the heavy lifting to simplify this file. • I removed the refs - but perhaps you needed them to enforce executing only once? You can also store a :first-run? flag in the DB if that will persist across reloads, to get the same effect. • As a personal taste thing, I usually remove the brackets around namespaces I'm loading for side effects. It makes them stand out visually

Shako Farhad21:04:16

Thank you very much! I will test this out. This looks sooo much better! Also, I actually didn't know you could call rf/dispatch-n. I always wrapped that and dispatch-later in an event. Wow I feel dumb ><

Oliver George23:04:42

@dnolen I'm hitting an error with the production build step in the tutorial. I wondered if it was a constant folding thing but same error occurs with simple both advanced targets.

TypeError: undefined is not an object (evaluating 'Z.unstable_cancelCallback')

<anonymous>
    main.js:224:85
<anonymous>
    main.js:57:86
<global>
    main.js:57:13
loadModuleImplementation
    require.js:321:11
<global>
    index.js:10
loadModuleImplementation
    require.js:321:11
guardedLoadModule
    require.js:201:44
global code
    index.bundle?platform=ios&dev=true&minify=false:176206:3

Oliver George23:04:22

Stand down red alert. I re-did the tutorial and it's working.

Oliver George23:04:05

This was the only change. Yeah, confirming that caused the error.

-        reagent {:mvn/version "0.10.0"}}}
+        reagent {:mvn/version "0.10.0"
+                 :exclusions [cljsjs/react cljsjs/react-dom]}}}