All Projects → flexsurfer → rn-shadow-steroid

flexsurfer / rn-shadow-steroid

Licence: other
React Native with shadow-cljs on steroids

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to rn-shadow-steroid

learn-re-frame-course-files
🎦 Learn re-frame course files for building Cheffy app
Stars: ✭ 51 (-10.53%)
Mutual labels:  reagent, re-frame, shadow-cljs
Re Frame Template
A Leiningen template for creating a re-frame application (client only)
Stars: ✭ 454 (+696.49%)
Mutual labels:  reagent, re-frame
Conduit
Real world application built with ClojureScript + re-frame
Stars: ✭ 422 (+640.35%)
Mutual labels:  reagent, re-frame
ui-gorilla
Reagent UI renderer for data visualization.
Stars: ✭ 14 (-75.44%)
Mutual labels:  reagent, shadow-cljs
re-frame-realword-example-app
Exemplary real world application built with Clojurescript and re-frame
Stars: ✭ 16 (-71.93%)
Mutual labels:  reagent, re-frame
Lein template descjop
A Leiningen template(Clojure/ClojureScript Project) for Web based desktop application with Electron (atom-shell).
Stars: ✭ 394 (+591.23%)
Mutual labels:  reagent, re-frame
Re Frame
A ClojureScript framework for building user interfaces, leveraging React
Stars: ✭ 4,980 (+8636.84%)
Mutual labels:  reagent, re-frame
re-frame-http-fx-alpha
A ClojureScript client library for HTTP requests. Provides a re-frame "effect handler" keyed :http
Stars: ✭ 37 (-35.09%)
Mutual labels:  reagent, re-frame
Re Com
A ClojureScript library of reusable components for Reagent
Stars: ✭ 690 (+1110.53%)
Mutual labels:  reagent, re-frame
Tincture
Frontend development toolkit for ClojureScript
Stars: ✭ 24 (-57.89%)
Mutual labels:  reagent, re-frame
Re Pollsive
Re-pollsive is a clojurescript library that handles polling events for re-frame applications
Stars: ✭ 27 (-52.63%)
Mutual labels:  reagent, re-frame
Status React
a free (libre) open source, mobile OS for Ethereum
Stars: ✭ 3,307 (+5701.75%)
Mutual labels:  reagent, re-frame
Kee Frame
re-frame with batteries included
Stars: ✭ 289 (+407.02%)
Mutual labels:  reagent, re-frame
Re Frisk
Take full control of re-frame app
Stars: ✭ 396 (+594.74%)
Mutual labels:  reagent, re-frame
notebook
Web based Clojure notebook application/-library.
Stars: ✭ 96 (+68.42%)
Mutual labels:  reagent, re-frame
Re Frame 10x
A debugging dashboard for re-frame. X-ray vision as tooling.
Stars: ✭ 491 (+761.4%)
Mutual labels:  reagent, re-frame
Ventas
Clojure ecommerce platform
Stars: ✭ 114 (+100%)
Mutual labels:  reagent, re-frame
nw-calculator
A crafting calculator for the New World game
Stars: ✭ 16 (-71.93%)
Mutual labels:  reagent, re-frame
codesunaba
A simple ClojureScript code sandbox in your browser.
Stars: ✭ 18 (-68.42%)
Mutual labels:  reagent, shadow-cljs
Cljfx
Declarative, functional and extensible wrapper of JavaFX inspired by better parts of react and re-frame
Stars: ✭ 624 (+994.74%)
Mutual labels:  reagent, re-frame

rn-shadow-steroid

A Clojure library with a few functions-steroids for react native app, can be used only with shadow-cljs

IMG

Clojars

Usage

{:dependencies [[rn-shadow-steroid "0.2.8"]]}

Register root reagent component in app registry

(:require [steroid.rn.core :as rn])

(defn root-comp []
  [rn/view
   [rn/text "HELLO WORLD"]])

(defn init []
  (rn/register-comp "app-name" root-comp))

Register root component with HOT RELOAD

(:require [steroid.rn.core :as rn])

(defn root-comp []
  [rn/view
   [rn/text "HELLO WORLD"]])

(defn init []
  (rn/register-reload-comp "app-name" root-comp))

shadow-cljs.edn

{:source-paths ["src"]

 :dependencies [[rn-shadow-steroid "0.2.6"]]

 :builds       {:dev
                {:target     :react-native
                 :init-fn    app.core/init
                 :output-dir "app"
                 :devtools   {:after-load steroid.rn.core/reload
                              :build-notify steroid.rn.core/build-notify}}}}

Now each time you change your code it will be hot reloaded keeping an app state. NOTE react native fast refresh should be turned off

React Native components

Basic components

[steroid.rn.core :as rn]
rn/app-registry rn/view rn/text rn/image rn/text-input rn/scroll-view
rn/touchable-highlight rn/touchable-native-feedback rn/touchable-opacity rn/touchable-without-feedback

UI components

[steroid.rn.components.ui :as ui]
ui/button ui/switch

List components

[steroid.rn.components.list :as list]
list/flat-list list/section-list

Platform

[steroid.rn.components.platform :as platform]
platform/platform platform/os platform/version platform/android? platform/ios?

Other components

[steroid.rn.components.other :as other]
other/activity-indicator other/alert other/dimensions other/keyboard-avoiding-view other/modal other/refresh-control 

StatusBar components

[steroid.rn.components.status-bar :as status-bar]
(status-bar/set-bar-style bar-style)
(status-bar/set-background-color background-color)
(status-bar/set-hidden hidden)
(status-bar/set-network-activity-indicator-visible network-activity-indicator-visible)
(status-bar/set-translucent translucent)

Picker component

yarn add @react-native-picker/picker
[steroid.rn.components.picker :as picker]
picker/picker picker/item

DateTimePicker component

yarn add @react-native-community/datetimepicker
[steroid.rn.components.datetimepicker :as datetimepicker]
datetimepicker/date-time-picker

Async storage component

yarn add @react-native-async-storage/async-storage
[steroid.rn.components.async-storage :as async-storage]
(async-storage/set-item "key" {:my-value "value"})
(async-storage/get-item "key" #(println "value" %))
(async-storage/remove-item "key")
(async-storage/get-all-keys #(println "keys" %))
(async-storage/clear)

EXAMPLE

(:require [steroid.rn.core :as rn]
          [steroid.rn.components.list :as list])

(defn item-render [{:keys [title image-url description]}]
  [rn/touchable-opacity {:on-press #(do "smth")}
   [rn/view {:style {:padding 5 :flex-direction :row :align-items :center}}
    [rn/image {:style {:width 50 :height 50 :margin 5 :border-radius 25 :margin-right 10}
               :source {:uri image-url}}]
    [rn/view {:style {:flex 1}}
     [rn/text {:style {:font-size 18 :font-family "Inter" :flex-shrink 1}} title]
     [rn/text {:style {:font-family "Inter" :flex-shrink 1 :color :gray :margin-top 5}
               :number-of-lines 2}
      description]]]])

(defn myapp []
    [rn/view {:style {:flex 1 :background-color :white}}
     [rn/text {:style {:font-size 22 :align-self :center :margin 10 :font-family "Inter"}}
      "MyApp"]
     [list/flat-list {:data data-vector :render-fn item-render}]])

React Navigation with HOT RELOAD

Navigation container component

yarn add @react-navigation/native
[steroid.rn.navigation.core :as rnn]
rnn/navigation-container
rnn/create-navigation-container-reload

Stack components

yarn add @react-navigation/stack
[steroid.rn.navigation.stack :as stack]
stack/stack

Bottom tabs components

yarn add @react-navigation/bottom-tabs
[steroid.rn.navigation.bottom-tabs :as bottom-tabs]
bottom-tabs/bottom-tab

Safe area components

yarn add react-native-safe-area-context
[steroid.rn.navigation.safe-area :as safe-area]
safe-area/safe-area-provider safe-area/safe-area-consumer safe-area/safe-area-view

EXAMPLE

`yarn add @react-navigation/native @react-navigation/stack @react-navigation/bottom-tab react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-masked-view/masked-view`

`cd ios; pod install; cd ..`
  (:require [steroid.rn.core :as rn]
            [re-frame.core :as re-frame]
            [steroid.rn.navigation.core :as rnn]
            [steroid.rn.navigation.stack :as stack]
            [steroid.rn.navigation.bottom-tabs :as bottom-tabs]
            [clojurernproject.views :as screens]
            [steroid.rn.navigation.safe-area :as safe-area]
            steroid.rn.navigation.events))

(defn main-screens []
  [bottom-tabs/bottom-tab
   [{:name      :home
     :component screens/home-screen}
    {:name      :basic
     :component screens/basic-screen}]])

(defn root-stack []
  [safe-area/safe-area-provider
   [(rnn/create-navigation-container-reload
     {:on-ready #(re-frame/dispatch [:init-app-db])}
     [stack/stack {:mode :modal :header-mode :none}
      [{:name      :main
        :component main-screens}
       {:name      :modal
        :component screens/modal-screen}]])]])

(defn init []
  (rn/register-comp "ClojureRNProject" root-stack))

Notice that we register root-stack without hot reload but create navigation-container-reload.

re-frame navigation events steroid.rn.navigation.events

After steroid.rn.navigation.events has been required once, re-frame events are registered and you can use them for navigation

(re-frame/dispatch [:navigate-to :modal])

(re-frame/dispatch [:navigate-to :basic])

(re-frame/dispatch [:navigate-back])

ENJOY!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].