This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-27
Channels
- # announcements (2)
- # beginners (85)
- # boot (4)
- # calva (4)
- # cider (14)
- # cljdoc (8)
- # cljs-dev (5)
- # cljsrn (10)
- # clojure (101)
- # clojure-europe (1)
- # clojure-italy (6)
- # clojure-nl (12)
- # clojure-spec (4)
- # clojure-uk (71)
- # clojurescript (119)
- # core-async (20)
- # cursive (1)
- # datascript (2)
- # duct (3)
- # emacs (19)
- # fulcro (150)
- # graphql (1)
- # hoplon (2)
- # instaparse (2)
- # jobs (1)
- # jobs-discuss (11)
- # joker (9)
- # luminus (6)
- # lumo (1)
- # off-topic (33)
- # onyx (1)
- # quil (1)
- # re-frame (23)
- # reagent (11)
- # robots (2)
- # rum (6)
- # sql (1)
- # test-check (10)
- # unrepl (1)
Hi! How do you require functions on cljs? for example I have (from NativeBase https://docs.nativebase.io/Customize.html#theaming-nb-headref)
import React, { Component } from 'react';
import { Container, Content, Text, StyleProvider } from 'native-base';
import getTheme from './native-base-theme/components';
import material from './native-base-theme/variables/material';
export default class ThemeExample extends Component {
render() {
return (
<StyleProvider style={getTheme(material)}>
<Container>
<Content>
<Text>
I have changed the text color.
</Text>
</Content>
</Container>
</StyleProvider>
);
}
}
I've installed './native-base-theme/components';
in my project, but I don't know how to require getTheme
. Someone can explain me how to correctly require not-component things? thx@U38C71QAH does this help: https://github.com/drapanjanas/re-natal/blob/master/README.md#using-external-react-native-components
In your project, run: yarn add native-base
.
Then in your code, do something like:
(def native-base (js/require "native-base"))
(def get-theme (r/adapt-react-class (.-getTheme native-base)))
...
i cannot do this because getTheme is not a property.. It's the default exported from the library
(def native-base (js/require "native-base"))
(def get-theme (-> native-base
(goog.object/get #js ["getTheme"])
r/adapt-react-class))
OK, sorry, my bad. Try this:
after installing native-base
you have to: node node_modules/native-base/ejectTheme.js
then run: re-natal require ./native-base-theme/components
followed by: re-natal use-figwheel
then at the REPL: (def get-theme (aget (js/require "./native-base-theme/components") "default"))
or better: (def get-theme (goog.object/get (js/require "./native-base-theme/components") #js ["default"]))