A test app to try out @react-native-tvos/config-tv
.
Includes code to exercise EAS Update, and show a video using expo-video
.
yarn
eas init
eas build:configure
eas update:configure
# Set up to build for TV
export EXPO_TV=1
npx expo prebuild
# Build debug app with packager
yarn ios
# Build release app for EAS update testing
yarn ios --configuration Release
# Now switch back to building for phone
unset EXPO_TV
npx expo prebuild --clean
yarn ios
yarn ios --configuration Release
You can also use yarn android
to build an Android app for either a TV emulator or a phone emulator.
# Build an iOS simulator app
eas build -e preview -p ios
# Build an Apple TV simulator app
eas build -e preview_tv -p ios
# Build an Android phone app
eas build -e preview -p android
# Build an Android TV app
eas build -e preview_tv -p android
There are also profiles to build development apps for TV that can run against the packager with npx expo start
.
Expo Config Plugin to auto-configure the native directories for TV
Tested against Expo SDK 50 alpha
This package cannot be used in the "Expo Go" app because Expo Go does not support TV.
- First install the package with yarn, npm, or
npx expo install
.
npx expo install tv @react-native-tvos/config-tv
After installing this npm package, add the config plugin to the plugins
array of your app.json
or app.config.js
:
{
"expo": {
"plugins": ["@react-native-tvos/config-tv"]
}
}
or
{
"expo": {
"plugins": [
[
"@react-native-tvos/config-tv",
{
"isTV": true,
"showVerboseWarnings": false
}
]
]
}
}
Plugin parameters:
isTV
: (optional boolean, default false) If true, prebuild should generate or modify Android and iOS files to build for TV (Android TV and Apple TV). If false, the default phone-appropriate files should be generated, and if existing files contain TV changes, they will be reverted. Setting the environment variable EXPO_TV to "true" or "1" will override this value and force a TV build.showVerboseWarnings
: (optional boolean, default false) If true, verbose warnings will be shown during plugin execution.
Warning:
When this plugin is used to generate files in the iOS directory that build an Apple TV or Android TV app, your React Native dependency in package.json
must be set to the React Native TV fork, as shown in the example below:
{
"dependencies": {
"react-native": "npm:react-native-tvos@^0.72.4-0"
}
}
If this is not the case, the plugin will run successfully, but Cocoapods installation will fail, since React Native core repo does not support Apple TV. Android TV build will succeed, but will not contain native changes needed to correctly navigate the screen using a TV remote, and may have other problems.