Fork me on GitHub
#cljsrn
<
2021-05-15
>
Ale14:05:43

I'm writing a simple app with Krell. What would you recommend to use to create/access sqlite databases? (mostly interested in working with android at the moment) I tried using react-native-sqlite-storage, but for some strange reason, both (require '[sqlite-react-native-storage :as sqlite]) and (js/require "react-native-sqlite-storage) return nil . I'm new to the ecosystem so I have no clear clue what's going on. It seems I was importing the library the wrong way - in ES6 the right way to import it is import SQLite from 'react-native-sqlite-storage' so I tried with (require '[react-native-sqlite-storage :refer [SQLite]]) but this seems the wrong way to do it. But this question is probably more fit in #beginners I verified both require('react-native-sqlite-storage') and importing it the es6 way are working by requiring/importing in the krell_repl.js file.

dotemacs15:05:23

Maybe try to import it in the REPL via js/require, see what is being returned and take it from there? Alliteratively look at this wrapper for hints https://github.com/condense/cljsrn-react-native-sqlite-storage/blob/master/src/interop/andpor/react_native_sqlite_storage/v1.cljs

Ale15:05:57

Thanks! I'll try ^^

Ale15:05:06

re. importing it from the cljs repl, I tried both js/require and plain require (both should work from the krell repl). Both of them return nil - really no clues why. requiring it from js, I get an object that prints out as {} if I console.log it, but I can still call methods on it.

Ale15:05:33

@U3SG7RX7A the above code would fail at the assert for me - no clues what's wrong tbh

dotemacs15:05:14

Not in front of a computer right now…

Ale17:05:47

It seems it was due to some transpilation leftovers, it worked after a cleanup, but not on the repl - it seems I can't dynamically require stuff in react-native

Michael Jung18:05:20

Hi all, I’m trying to get started with cljs and RN using Krell. I was following the instructions at https://github.com/vouch-opensource/krell/wiki/Reagent-Tutorial without getting any issues. However, I don’t see any of the cljs stuff on my Android phone. I only see the default “Welcome to React Native” screen. The REPL is not being connected to either. Looks like I need to do some additional change so the compiled cljs code gets picked up (it is there at target/main.js). Any ideas what I’m doing wrong?

3