Bootstrapping
Starter kits for ReactΒ Native
Set up a starter repo to help you learn about and bootstrap your Tamagui app:
Templates
There are four starter templates:
- Free - Expo, Expo Router, Solito and Next.js (with both
/pagesand/appdir). - Learn - Client-only web app with Webpack or Vite. Useful to understand how to set up tamagui.config.ts.
- Expo Router - The Expo Router default starter with
Tamagui added via
@tamagui/metro-plugin. - Takeout - A more robust, paid and supported starter kit.
Usage
yarn
npm
bun
pnpm
yarn create tamagui@latest
Check out the source of the templatesΒ .
A big shout out to Fernando RojoΒ for creating SolitoΒ , a great library for sharing all your views between Expo and Next.js, and the bootstrap repo we borrowed from.
Starting out
The starter-free app requires yarn to run.
To run the app:
Terminal
cd myappyarnyarn web # Web local devyarn native # Expo local dev (only for `starter-free`)
π¦ Included packages (starter-free)
tamaguifor cross-platform views, themes and animationssolitofor cross-platform navigationexpo-routerfor having same routing concepts between web and native- Expo SDK 48
- Next.js 13
By integrating Tamagui, expo-router, Solito, and Next.js you can enjoy
the power and simplicity of creating universal apps.
π Folder layout
-
appsentry points for each appexponext
-
packagesshared packages across appsappyouβll be importing most files fromapp/features(donβt use ascreensfolder. organize by feature.)provider(all the providers that wrap the app, and some no-ops for Web.)navigationonly for starter-free template, contains the navigation code for RN
You can add other folders inside of packages/ if you know what youβre doing
and have a good reason to.
π Start the app
-
Install dependencies:
yarn -
Next.js local dev:
yarn web- Runs
yarn next
- Runs
-
Expo local dev:
yarn native- Runs
expo start
- Runs
π Add new dependencies
Pure JS dependencies
If youβre installing a JavaScript-only dependency that will be used across
platforms, install it in packages/app:
Terminal
cd packages/appyarn add date-fnscd ../..yarn
Native dependencies
If youβre installing a library with any native code, you must install it in
apps/expo:
Terminal
cd apps/expoyarn add react-native-reanimatedcd ../..yarn
You can also install the native library inside of packages/app if you want to
get autoimport for that package inside of the app folder. However, you need to
be careful and install the exact same version in both packages. If the
versions mismatch at all, youβll potentially get terrible bugs. This is a
classic monorepo issue. I use lerna-update-wizard to help with this (you donβt
need to use Lerna to use that lib).