Updated May 19, 2021
How to Create an Expo Template for React Native Development
I recently created a simple free Expo template to make building React Native tutorials easier and, hopefully, help the community out a bit.
In doing so I had to ask the question... how do I actually create an Expo template?
As with all things Expo related, it was simple.
How to Create An Expo Template
As I found out in my research (which consisted of looking at existing Expo templates) I found out that any Expo app can be turned into a template.
Note: You'll need to have the Expo CLI installed.
Then create a new project.
expo init TemplateApp
Next you'll need to actually create the starter/template app you want to use.
In my case I added some components, prettier, eslint, navigation, and project structure.
Publishing the Expo Template
First, make sure to create a good (or at least decent) README so people know how to use the template.
You'll then need to prepare it to be published on NPM.
In summary this means updating your package.json
.
- Set the
name
property to something unique (like@react-native-school/expo-template
) - Remove
private: true
- Give it a description
- Add some keywords
- Add a homepage link
- Add a repository link
- Add a license
- Set the author - give yourself some credit!
Run npm publish
.
And you're set!
Using the Expo Template
Using the template is likewise very easy. Just init the project with the template you published to NPM.
expo init my-app --template @react-native-school/expo-template