- This project requires a working setup of React Native. Follow the steps in this guide under the
React Native CLI Quickstart
tab. - Sleeper uses the following tool versions for development. If you run into any issues with setup, you can try changing your environment to point to these versions. We recommend a version manager like asdf to automate switching these between projects.
Tool | Version |
---|---|
XCode | 15.0 |
MacOS | 13.6 |
java | zulu-11.56.19 |
nodejs | 20.10.0 |
ruby | 3.1.0 |
cocoapods | 1.12.1 |
- Install the latest version of our custom vscode-react-native plugin. This is a fork of the official project that includes fixes to run webpack with react native.
- Clone this repo locally.
- Run
yarn
from thetemplate/
folder andpod install
fromtemplate/ios
to set up node modules and native dependencies. - If running in VS code, make sure to start the app from the vscode project file. This will automatically set your webpack dev server to the correct ports.
- If running manually, make sure to run with
yarn start
andyarn ios
. These will also make sure your dev ports are set up correctly.
- Contact us to enable developer mode on your account.
- Start up the Sleeper app. This can be the production app, a development mode app in a simulator or on device, or a Mac Catalyst build.
- If your account is marked as a developer, you may, at any point, physically shake your phone to open up a connection window. This displays your device's IP, current connection status to this template project on your computer, and buttons to refresh + send data manually to your PC at any time.
- Tap on the last tab in the tab bar at the bottom of the screen. Select "Developer Mini" from the list.
- Copy the IP address from the dev menu, and paste it in app.json.
- Launch this app by following the steps in how to run above.
- If all goes well, the Sleeper app will automatically connect after a few seconds.
- You can now make any change you want in the mini, and when you hit the "refresh" button in Sleeper, the new code will update.
- We've prepackaged this project with a few starter templates, located here.
- Select a project to start with by editing app.json and changing the selected sample ID. Restart your packager each time you change this value.
- All user changes should hook into the main index.js file of the sample you selected from these folders. Feel free to delete or modify components as necessary, but refrain from modifying any library files or index.tsx, as those handle some behind the scenes communication events.
- Feel free to edit the top level
package.json
and add new packages to your project. Note that these packages either must already exist within Sleeper (if they include native code), or must be entirely comprised of javascript. For a list of packages included in Sleeper, check out mini_packages.json. - Some types and components have been provided for use through an included
@sleeperhq/mini-core
package. You can check out the repo here. - Further documentation and API hooks are in development.
Try restarting the phone that Sleeper is running on. Also stop and restart the packager for your development app.
You can run yarn build-mini
to generate a .zip file containing all of your source code. Please contact us and send this file over when you are ready to release. In the future, this process will be automated.