An example of using expo-router in ClojureScript RN app.
- Install expo-router in your project, follow instructions here
- Patch expo-router to point to JS entry point generated from your CLJS code
- A patch for [email protected] is included in this repo patches/expo-router+4.0.17.patch
- Follow this guide to patch expo-router package
- Add
:root-ns app.layout
setting in yourshadow-cljs.edn
build configapp.layout
is root layout of your app
- Set
:target :expo-router
inshadow-cljs.edn
build config and make sure to putshadow.build.targets.expo-router
namespace on class path, this ns adds:expo-router
build target. - Make sure that your
layout
,tabs
and pages namespaces export UI components, via^:export
meta. Those components will be automatically rendered by expo router.
Unlike in Expo, none of cljs namespaces are automatically required, except project's entry point, which means you still have to require them somewhere. In this example
layout
namespaces at every level of routing hierarchy require neighboring namespaces and child layout namespaces.