Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Readme to include important source files change for new versions #11

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ React Native components.
This library is in active development. It is useful, but incomplete.

== Usage
WARNING: If you are using expo SDK +40 version, use `expo-application-40` as there were breaking changes. For older expo versions use `expo-application`

Add the latest version to your project dependencies. At the moment the helper code
only supports apps written with Expo, but if you look in `expo-application` you'll
only supports apps written with Expo, but if you look in `expo-application-40` you'll
see there isn't much to change to work with non-expo apps.

We only test against the shadow-cljs build tool. If you're using standard cljs compiler for npm deps then you'll have to
Expand Down Expand Up @@ -67,15 +68,14 @@ You'll want your shadow-cljs config to include an after-load function that calls
== Loading Fonts and Images with Expo

Expo provides a mechanism to pre-load and cache fonts and static images during app startup. If you use the
`com.fulcrologic.fulcro-native.expo-application/fulcro-app` function, this is taken care of for you. All you need to do is specify the
`com.fulcrologic.fulcro-native.expo-application-40/fulcro-app` function, this is taken care of for you. All you need to do is specify the
images and/or fonts you want to cache in the app configuration, as follows:

[source, clojure]
-----
(ns
(ns my.app.root
(:require
[com.fulcrologic.fulcro-native.expo-application :as expoapp]
[com.fulcrologic.fulcro.application :as app]))
[com.fulcrologic.fulcro-native.expo-application-40 :as expo]))

; require images individually, so you can reference them when needed in the app
(defonce profile-blank (js/require "../assets/images/profile.png"))
Expand All @@ -88,8 +88,8 @@ images and/or fonts you want to cache in the app configuration, as follows:
["Avenir Next" (js/require "../assets/fonts/AvenirNext-Regular-08.ttf")]])


(defonce app (expoapp/fulcro-app {:cached-images images
:cached-fonts fonts}))
(defonce app (expo/fulcro-app {:cached-images images
:cached-fonts fonts}))
-----

Note that the asset paths are relative to the /app directory, or wherever you have set the output directory for the mobile app build.
Expand Down Expand Up @@ -187,13 +187,11 @@ Something like this should work (pay attention to the goog-define):
"Entry point for native client."
(:require
[app.application :refer [SPA]]
[com.fulcrologic.fulcro-native.expo-application :as expo]
[com.fulcrologic.fulcro-native.expo-application-40 :as expo]
[app.mobile-ui.root :as root]
[taoensso.timbre :as log]
[com.fulcrologic.fulcro.networking.http-remote :as net]
[com.fulcrologic.fulcro.application :as app]
[com.fulcrologic.fulcro.ui-state-machines :as uism]
[app.model.session :as session]))
[com.fulcrologic.fulcro.application :as app]))

;; Allow defines in shadow-cljs to define API endpoint for dev mode (and even prod mode)
(goog-define SERVER_URL "http://production.server.com/api")
Expand Down Expand Up @@ -232,4 +230,5 @@ section of your shadow-cljs build config:
com.fulcrologic.fulcro.inspect.websocket-preload]}}}}
-----

See the fulcro native template for a working example.
See the fulcro native template for a working example:
https://github.com/fulcrologic/fulcro-native-template