A proof-of-concept of Expo + NativeScript, made possible by Node-API.
This proof-of-concept is limited to React Native v0.72.4 because that's the latest version that supports our old fork of Hermes, which we need to provide Node-API support as explained below.
React Native 0.72.4 was part of Expo SDK 50, so we have to use the expo@~50.0.4 npm package. However, we must use the CLI from Expo SDK 51 or above to create and prebuild the project (as Expo SDK 51 is when this PR landed).
This project Microsoft's fork of Hermes v0.12.3, with a few extra patches to add Node-API support (which NativeScript depends upon).
This template provides a ready-built Hermes: hermes-ios-release.tar.gz, which it references in ios/Podfile via the HERMES_ENGINE_TARBALL_PATH environment variable. However, you can build it from source yourself by following these instructions.
NativeScript is only available for iOS for now, so the provided Android template is just the usual expo-template-bare-minimum.
We recommend bun as it installs much quicker.
# Via npm
npx create-expo@latest --template https://github.com/shirakaba/jamie-expo-templates/tree/nativescript/templates/nativescript
# Via bun
bun create expo@latest --template https://github.com/shirakaba/jamie-expo-templates/tree/nativescript/templates/nativescriptThe first time you create the app, it will prebuild it for you as well.
The app will be ready-prebuilt upon first creating from this template, but in case you want to do a manual prebuild, here's how.
The easy way is to use the script written into the package.json. However, it's slow because it has to download this repo.
# Via npm
npm run prebuild
# Via bun
bun prebuildThe faster way, if you're planning to prebuild often, is to download this repo yourself and create a ready-packed template that you can prebuild from locally. This avoids having to redownload it on each prebuild.
git clone --single-branch --branch nativescript git@github.com:shirakaba/jamie-expo-templates.git
cd jamie-expo-templates/templates/nativescript
npm pack
# This will output your local prebuild template: expo-template-nativescript-50.0.33.tgzNow you can prebuild from that template:
# Via npm
npx expo prebuild --template path/to/expo-template-nativescript-50.0.33.tgz
# Via bun
bunx expo prebuild --template path/to/expo-template-nativescript-50.0.33.tgz
# (Consider committing the template to the repo and adding an npm script for this)