This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-28
Channels
- # beginners (33)
- # boot (58)
- # cider (21)
- # cljs-dev (197)
- # cljsrn (112)
- # clojure (136)
- # clojure-belgium (5)
- # clojure-dev (57)
- # clojure-greece (1)
- # clojure-italy (3)
- # clojure-russia (6)
- # clojure-spec (148)
- # clojure-uk (54)
- # clojurescript (29)
- # cursive (24)
- # datomic (36)
- # devops (4)
- # emacs (11)
- # figwheel (1)
- # graphql (18)
- # hoplon (6)
- # leiningen (2)
- # luminus (4)
- # off-topic (7)
- # om (4)
- # onyx (27)
- # precept (1)
- # protorepl (12)
- # quil (1)
- # re-frame (28)
- # reagent (10)
- # ring (9)
- # robots (1)
- # rum (2)
- # slack-help (5)
- # spacemacs (16)
- # sql (16)
- # untangled (16)
- # vim (3)
- # yada (2)
@aj @pesterhazy in case you’re curious, the solution was to remove the (overlooked) caret from the line "react-native-svg": "^5.1.8",
in package.json
. I was trying to downgrade to an earlier version of react-native-svg, but was getting the later version, which had a breaking change.
would anyone be interested in using CLJS with create-react-native-app
? I made a quick example here: https://github.com/thheller/shadow-cljs-examples/tree/master/cljs-react-native-app
I don’t do any react-native
development myself but interop with JS packages should be much simpler and doesn’t require cljsjs packages
Hi, in order to have StackNavigator with the horizontal animation (on Android), I followed the instructions on this issue https://github.com/react-community/react-navigation/issues/1759 . The problem is that by importing CardStackStyleInterpolator i got this warning
Requiring module 'react-navigation/src/views/CardStackStyleInterpolator.js' by name is only supported for debugging purposes and will BREAK IN PRODUCTION!
Is there another way to require CardStackStyleInterpolator?
Thanks@thheller advantages over re-natal?
I just use create-react-native-app
.. no tweaks other than adding a config for shadow-cljs
not saying that this is any better … just wanted to show an alternative that might integrate “better” with existing JS code
no you tell me 🙂
(ns demo.app
(:require ["react" :as react :refer (createElement)]
["react-native" :as rn :refer (Text View StyleSheet)]))
The boilerplate doesn't bother me very much (you need a ton of boilerplate for the XCode project etc. anyway). More important are compilation speed, live reloading (figwheel-like), reliability, how easy it is to integrate with js projects, ease of upgrading react-native versions
it uses the built-in live-reloading from CRNA, compile speed should be faster or equal to figwheel, more reliable, it is CRNA so integration seems solid
I did the basic example … and thats it. re-natal
has a ton more “experience” behind it
i’m having a really hard time using react-native components with use-component
. my latest attempt is using react-native-multi-slider
. i have
(def Slider (js/require "@ptomasroos/react-native-multi-slider/MultiSlider"))
(def slider (r/adapt-react-class (.-MultiSlider Slider)))
in my core.cljs
file, and in the repl
(js/require "@ptomasroos/react-native-multi-slider/MultiSlider")
evals to
#js {:default #object[MultiSlider "function MultiSlider(props) {
[rest elided]
so i assume i re-natal use-component
d correctly.
but this in the repl (and in the simulator) fails:
(def slider (reagent.core/adapt-react-class (.-MultiSlider Slider)))
#object[Error Error: Assert failed: c]
Error: Assert failed: c
because (.-MultiSlider Slider) returns nil, not the component. i’m at a loss as to why.I know unfortunately little about javascript and react. i believe that (.-MultiSlider Slider) is the correct function call because in MultiSlider.js there’s the line:
export default class MultiSlider extends React.Component
i wish i knew how to list properties of javascript objects in clojurescript. 😐@thheller did you do live cljs dev, compile and deploy or was it more like compile, reload the app, repeat?
@mfm (def Slider (js/require "react-native-multi-slider")) Did you try to require in this way?
@carocad not sure I understand the question? shadow-cljs watch app
auto-compiles and the react-native packager reloads the code?
@manu I get #object[Error Error: Unknown named module: 'react-native-multi-slider'] Error: Unknown named module: 'react-native-multi-slider'
just now.
searching the archives of this slack, i’ve heard you’re supposed to require
it exactly as you npm install
d it.
@thheller yes but that is the “basic” approach in Cljs. My question is rather, when the app reloads, do you loose the current state? or is it kept like using fighweel with reagent/om, etc
(i also just tried all combinations of “@ptomasroos” “react-native-multi-slider” “MultiSlider” and got the same error)
I don’t know what the default built-in reload does, it probably just resets the state?
i did npm install --save @ptomasroos/react-native-multi-slider
then re-natal use-component @ptomasroos/react-native-multi-slider/MultiSlider
in package.json i see: "@ptomasroos/react-native-multi-slider": "0.0.8"
and in .re-natal : "@ptomasroos/react-native-multi-slider/MultiSlider"
@thheller would you mind doing the experiment and letting us know since you already have everything setup 🙂 ? I think it should be pretty simple to setup. A text input would suffice. Simply set its content to a ratom and afterwards change its style. That should trigger compilation. If the state is kept only the style should change, otherwise your text input would be reset.
@mfm ok, you did wrong the re-natal installation. you have to do re-natal use-component @ptomasroos/react-native-multi-slider
@kurt-o-sys I remember talking about BLE with you. What manufacturer of BLE chips are you going to use?
right... I don't know yet. It's a side-project, and I haven't had time to move forward with it the last 6 weeks - especially since my co-dev was not available 😛. You plan to use one yourself?
Haha ok. Yeah we’re using Nordic Semiconductor NRF52. Can really recommend Nordic, really good tools. And we’ve developed a lib for updating the BLE chip OTA which is neat if yo’du need that.
oh, nice! thanks for your advice 🙂. I may come back to you one day, if we get to the point where we do some hardware-stuff.
@mfm delete the wrong component from the file and install properly the right component 🙂
@mfm then on the core.cljs (def Slider (js/require "@ptomasroos/react-native-multi-slider")) (def Multislider (.-MUltislider Slider))
Someone knows how can I require a component that is not available into the API and avoid this warning
Requiring module 'react-navigation/src/views/CardStackStyleInterpolator.js' by name is only supported for debugging purposes and will BREAK IN PRODUCTION!
?
Thanks@carocad confirmed that the default reloader kills all state, I’ll update the example to use the better reloader 😉
(thanks for (.keys js/Object [thing]), i’ve been looking for something like that for a long time)
---- Could not Analyze <cljs form> line:1 column:18 ----
Unknown dot form of (. default - (Slider)) with classification [:cljs.analyzer/expr :cljs.analyzer/property :cljs.analyzer/expr]
1 (.keys js/Object (.- default Slider))
^---
---- Analysis Error ----
nil
@thheller nice to know. Thanks for the input ! but what do you mean by the better reloader
?
@carocad hmm wait .. there is live reloading and hot reloading. hot reloading does preserve state. by better I mean the built-in from shadow-cljs which is like figwheel
trying both of those in the repl:
(.-propTypes Slider)
nil
testingupdaterenatal.ios.core> (.-defaultProps Slider)
nil
#js ["values" "onValuesChangeStart" "onValuesChange" "onValuesChangeFinish" "sliderLength" "touchDimensions" "customMarker" "min" "max" "step" "optionsArray" "containerStyle" "trackStyle" "selectedStyle" "unselectedStyle" "markerStyle" "pressedMarkerStyle"]
i think i’m starting to understandand:
(.keys js/Object (.-defaultProps (.-default Slider)))
#js ["values" "onValuesChangeStart" "onValuesChange" "onValuesChangeFinish" "step" "min" "max" "touchDimensions" "customMarker" "sliderLength"]
and I was a bit confused, I though that you were using a vanilla create-react-native-app. My mistake
yes but you have a three steps build process right?
Something like cljs -> shadow-cljs -> js -> create-react-native-app -> native app
I thought that we were only discussing about replacing the rn packager with crna which is why I said I was mistaken
from what I understand, in theory yes, it should be. In practice I think they havent reached that state yet. From their readme Install the Expo app on your iOS or Android phone, and use the QR code in the terminal to open your app.
Does this mean that you cannot use a different approach?
I definitely like not having to install android studio nor xcode but if I get chained to a specific way of developing apps then that is another story 😕
I have no idea how all that works. It works as advertised in development but no idea about actually publishing the app
on a related topic. Your shadow-cljs library compiles files down to node-compatible-require right? like require('some-cljs-file')
do you have an example of that. It would be very very interesting. The boot-react-native project currently hacks the packager to get that working
yes but that project has all react-native stuff in it. I was just wondering if I can test it without any relation to react native. My point is that if a developer can get a compilation that is independent of google closure then that would reduce all the boilerplate that we are all dealing with and it would also be independent of the packager used around the compiled files 🙂
https://gist.github.com/thheller/74473e8b9ca2b795962d0f65fdecf8af#file-shadow-cljs-code-gen-js-L12 😞 I thought that you were replacing the goog.require with node-like requires
yeah nobody likes the packager that much. But it is what it is so for the time being we have to deal with it
you might want to check a project call haul
which is an alternative to rn packager. Though it didnt work for me when I tried it 😆
but I want to integrate with the react-native
packager since that is the “official” thing
I think the problem is that the rn packager scans the js files for matches to require(....)
so even if you assign goog to your internal require it would still cause problems. That is actually the same approach taken by the figwheel-bridge
used by re-natal
I think we are talking about different things hehe. I can pretend it is not there, no problem 😉 but afaik the rn packager wouldnt do that. In any case I will like to test your lib and see how well does it play with the current status
@mfm if you require it by (js/require "@ptomasroos/react-native-multi-slider/MultiSlider ") do you get an error?
@mfm ok so lets require it in this way, and use the keys method to watch what there inside it