This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-27
Channels
- # admin-announcements (1)
- # aws-lambda (2)
- # beginners (48)
- # boot (231)
- # capetown (1)
- # cider (35)
- # cljs-dev (25)
- # cljsrn (74)
- # clojure (273)
- # clojure-austin (2)
- # clojure-berlin (5)
- # clojure-hk (1)
- # clojure-poland (1)
- # clojure-russia (50)
- # clojure-spec (63)
- # clojure-uk (58)
- # clojurescript (51)
- # cursive (5)
- # datomic (39)
- # defnpodcast (3)
- # dirac (13)
- # editors (6)
- # emacs (3)
- # hoplon (86)
- # jobs (2)
- # lein-figwheel (1)
- # liberator (3)
- # off-topic (10)
- # om (113)
- # onyx (34)
- # protorepl (29)
- # re-frame (2)
- # reagent (8)
- # remote-jobs (1)
- # ring (4)
- # test-check (42)
- # untangled (31)
- # yada (2)
so in re-natal, in the sample app, if i wanna set the greeting when pressing the button, i would call (dispatch [:set-greeting "bla"])
?
also, i want to have persistent storage of the db, so i keep the greeting after app restart. i found AsyncStorage. is there an example of usage with re-natal?
@pvinis: calling dispatch is the re-frame way of changing the global app state. You can read the re-frame docs they are very well written. I know luno example app uses persistent storage take a look there
Btw there are other options of what you can use like om-next or rum which are not using re-frame for state handling. And there changing state is done differently, so I guess there is no one "cljsrn" way of doing this.
yeah, cljsrn should be less opinionated about which react-wrapper to use; it works fine with any of those
by the way, my boot-react-native branch is now updated to React Native 0.29.2 and ready for testing: https://github.com/pesterhazy/boot-react-native/tree/develop
but it would be nice if we could share more code. I still hope one day re-natal and boot-react-native will join forces. 🙂
I'm hoping to get it merged into boot-react-native master soon
if anyone could give it a try, that'd be appreciated
yea like seantempesta says. it would be cool if they merge. i prefer boot, but re-natal seems to work better for now
I remember thoughts about custom packager implementation. I think it would be cool to have a lightweight packager which we could use for development and make it work for boot and lein. But I have no clue how hard it would be to implement
it's important I think to decomplect the tools. The cljs-packager integration should be agnostic of the react wrapper, for example, or of additional libraries like re-frame or pre-built RN components.
I agree I imagine it would just take the js file compiled with optimizations none and transform it to whatever original packager emmits including required external libs static images and etc
i am trying to add react-native-store
to my project but i keep getting Requiring unknown module "react-native-store/Store".If you are sure the module is there, try restarting the packager or running "npm install”
@pvinis: are you use re-natal?
re-natal use-component react-native-store
re-natal use-figwheel
Can you see react-native-store the modules of your .re-natal
file? Then re-running re-natal use-figwheel
should work.
you’ll have to re-run lein figwheel ios
too since use-figwheel
does a clean first
it’d be nice to change that behavior. I’ve forgotten to do that like 10 times already
Try opening this link in a browser and see if you can find the ‘react-native-store’ in the output: localhost:8081/index.ios.bundle
I don’t think so. I usually run lein figwheel ios and hit run in Xcode around the same time
i saw there is this on the re-natal site, and (set! js/Store (js/require "react-native-store"))
on luno
well, let’s start lower down in the process. Is it in the output in your index.ios.bundle?
also, i keep getting
Error: Error validating module options: child "platform" fails because ["platform" must be a string]
at declareOpts.js:60:13
at Promise.resolve.then (index.js:248:20)
at tryCallOne (/Users/pvinis/Source/pvinis/cashish/node_modules/promise/lib/core.js:37:12)
at /Users/pvinis/Source/pvinis/cashish/node_modules/promise/lib/core.js:123:15
at flush (/Users/pvinis/Source/pvinis/cashish/node_modules/asap/raw.js:50:29)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
this even though the app runs fine. it happens sometimes.. randomlymodule.exports=store;
}, "react-native-store/lib/index.js");
__d(633 /* react-native-store/lib/store.js */, function(global, require, module, exports) {'use strict';
the platform error is separate actually. you can fix it by running re-natal enable-source-maps
okay, good. then try just running (js/require “react-native-store/Store”)
in your repl
actually, I think you want to just run (js/require "react-native-store")
hmm, no nil would mean it doesn’t load
ExceptionsManager.js:61 Requiring unknown module "react-native-store/Store".If you are sure the module is there, try restarting the packager or running "npm install”.
did you try doing the js/require w/o the /Store?
with out
yeah, that’s it
yeah, you gotta translate ES6 (or whatever import
is) into normal javascript. I use http://babeljs.io/repl to help me:
import Store from 'react-native-store’;
=
'use strict';
var _reactNativeStore = require('react-native-store');
var _reactNativeStore2 = _interopRequireDefault(_reactNativeStore);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
you don’t have to set!
it unless you want to pollute the global namespace. You can just (def Store (js/require “react-native-store”))
and reference the Store
in your code
yup. javascript is a pain in the ass. 🙂
yes.. and cljs makes things nicer, but when you interact with js, its back to the same confusion
no problem. Don’t forget to (clj->js {})
any arguments if you call it