@darwin Is it possible to use devtools
or dirac
in React Native development?
it should be possible, but I’m not very familiar with that stack
I tried it a few years back and in it was rough
just test devtools can work
?
devtools
works, but dirac
not.
looks like dirac
use js/document
ReferenceError: document is not defined
at Object.clojure.browser.repl.bootstrap.goog.writeScriptTag__ (repl.cljs?rel=1519577273852:149)
at clojure.browser.repl.bootstrap.goog.writeScriptTag_ (repl.cljs?rel=1519577273852:165)
at Object.goog.importScript_ (base.js:951)
at Object.goog.writeScripts_ (base.js:1394)
at goog.require (base.js:706)
at figwheel-bridge.js:215
at syncImportScripts (figwheel-bridge.js:134)
at importJs (figwheel-bridge.js:148)
at figwheel-bridge.js:210
at syncImportScripts (figwheel-bridge.js:134)
however, this is not exist in react native.
hmm, this callstack does not look like related to dirac
it looks like figwheel
this is because to make figwheel work in react native there's a figwheel_bridge.js
do a lot of shim work, so the error stack looks meaningless.
does dirac
require the JS runtime which it works with, must be a browser environment?
no
dirac can work with nodejs javascript environment for example
^ this may be outdated, but it worked at some point
I think you only need to instruct dirac to connect to javascript context in your React Native “shell”
the problem could be that the shell has pretty old version, so the debugger protocol between dirac devtools (devtools) and shell does not match
at least that was my problem when I tried it a few years ago, RN shell was 6+ months old
because it was using electron-shell, which was behind
the shell
stands for what?
some stuff run on the mobile?
no
maybe terminology changed? I don’t know - back in the old days, electron-shell was that componet in electron which was wrapping chrome engine
that make sense
actually it is this subproject: https://github.com/electron/libchromiumcontent
electron is using it as “chrome engine”, it depends what version do you have
you can easily detect it by asking for navigator.userAgent
in javascript context inside your RN app
in react native, although you can open a devtool for logging and debugging, you can't evaluate javascript code, if you try to do alert
, it will alert in the chrome, not the app. will this still be a problem for cljs repl, if dirac
install success on RN?
the technology here looks really complex.
I’m not surprised that alert shows in the browser instead of native app.
I would guess you have to use RN-specific apis to affect state of your native app
I’m sorry I have never used RN seriously. I cannot help here.
In general you want run javascript context in your RN app with remote debugging enabled and then connect to it with dirac (running in your browser as extension). If both RN js context and dirac versions roughly match, then they should be able to talk and you should be able to issue cljs commands which will compile to javascript which exectutes in your RN js context. This will allow you to do everything javascript code can do in that context.,
okay, tomorrow i will try to use dirac without figwheel. maybe will get more useful information. and devtools
satisfies me at this moment.
thanks for all the help!!
good luck!