Fork me on GitHub
#cljsrn
<
2019-08-05
>
vikeri09:08:52

Done! šŸ˜„

danielneal11:08:57

Also done šŸ™‚ thanks for taking the time to work on this

thheller11:08:21

thank clojurists together for funding the time šŸ˜‰

ā¤ļø 16
thanks2 4
Michaƫl Salihi20:08:24

Hi eveybody ! Is there a difference (maybe performance ?) to require react-native like this

(ns test.android.core
  (:require [reagent.core :as r :refer [atom]]))

(def ReactNative (js/require "react-native"))

(def text (r/adapt-react-class (.-Text ReactNative)))

(defn app-root
  []
  [text "Hello World!"])

...

Michaƫl Salihi20:08:21

Instead like this

(ns test.android.core
  (:require [reagent.core :as r :refer [atom]]
            ["react-native" :as rn :erfer [Text]]))

(defn app-root
  []
  [:> Text "Hello World!"])

...

thheller20:08:59

no difference in performance no. otherwise the only difference is the amount of code

Michaƫl Salihi20:08:49

Perfect, thx @thheller ! Yes I prefer the second one and surprise to often see

(def ReactNative (js/require "react-native"))

(def app-registry (.-AppRegistry ReactNative))
(def text (r/adapt-react-class (.-Text ReactNative)))
(def view (r/adapt-react-class (.-View ReactNative)))
(def image (r/adapt-react-class (.-Image ReactNative)))
(def touchable-highlight (r/adapt-react-class (.-TouchableHighlight ReactNative)))
Like in Re-natal template

thheller20:08:12

dunno how well the second version is supported outside of shadow-cljs

thheller20:08:43

but support for that came after re-natal came out so it probably just wasn't updated

Michaƫl Salihi21:08:41

I just tried the second version with re-natal/figwheel and it works well. Maybe I'll propose a pull request.

Michaƫl Salihi21:08:49

Notice : I do not test to build app right now