Skip to content

Commit 7e5371b

Browse files
committed
Fix up template release/0.69.0 for TV
1 parent 511e139 commit 7e5371b

File tree

14 files changed

+668
-102
lines changed

14 files changed

+668
-102
lines changed

template/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import {
2727
ReloadInstructions,
2828
} from 'react-native/Libraries/NewAppScreen';
2929

30+
import 'react-native/tvos-types.d';
31+
3032
const Section: React.FC<{
3133
title: string;
3234
}> = ({children, title}) => {

template/android/app/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: "com.android.application"
22

33
import com.android.build.OutputFile
4+
import org.apache.tools.ant.taskdefs.condition.Os
45

56
/**
67
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -158,6 +159,15 @@ android {
158159
// Make sure this target name is the same you specify inside the
159160
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
160161
targets "helloworld_appmodules"
162+
// Fix for windows limit on number of character in file paths and in command lines
163+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
164+
arguments "NDK_APP_SHORT_COMMANDS=true"
165+
}
166+
}
167+
}
168+
if (!enableSeparateBuildPerCPUArchitecture) {
169+
ndk {
170+
abiFilters (*reactNativeArchitectures())
161171
}
162172
}
163173
if (!enableSeparateBuildPerCPUArchitecture) {

template/android/app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33

44
<uses-permission android:name="android.permission.INTERNET" />
55

6+
<!--
7+
android:icon is used to display launcher icon on mobile devices.
8+
android:banner is used to display a rectangular banned launcher icon on Android TV devices.
9+
-->
610
<application
711
android:name=".MainApplication"
812
android:label="@string/app_name"
13+
android:banner="@drawable/tv_banner"
914
android:icon="@mipmap/ic_launcher"
1015
android:roundIcon="@mipmap/ic_launcher_round"
1116
android:allowBackup="false"
@@ -20,6 +25,8 @@
2025
<intent-filter>
2126
<action android:name="android.intent.action.MAIN" />
2227
<category android:name="android.intent.category.LAUNCHER" />
28+
<!-- Needed to properly create a launch intent when running on Android TV -->
29+
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
2330
</intent-filter>
2431
</activity>
2532
</application>

template/android/app/src/main/java/com/helloworld/MainApplication.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public void onCreate() {
5555
// If you opted-in for the New Architecture, we enable the TurboModule system
5656
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
5757
SoLoader.init(this, /* native exopackage */ false);
58+
// Normally we only send key up events in ReactAndroidHWInputDeviceHelper
59+
// Change enableKeyDownEvents to true to send both key down and key up events
60+
ReactFeatureFlags.enableKeyDownEvents = false;
61+
5862
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
5963
}
6064

27.8 KB
Loading

template/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
1212
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13-
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
13+
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m
1414

1515
# When configured, Gradle will run in incubating parallel mode.
1616
# This option should only be used with decoupled projects. More details, visit
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>LSRequiresIPhoneOS</key>
24+
<true/>
25+
<key>NSAppTransportSecurity</key>
26+
<dict>
27+
<key>NSExceptionDomains</key>
28+
<dict>
29+
<key>localhost</key>
30+
<dict>
31+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
32+
<true/>
33+
</dict>
34+
</dict>
35+
</dict>
36+
<key>NSLocationWhenInUseUsageDescription</key>
37+
<string></string>
38+
<key>UILaunchStoryboardName</key>
39+
<string>LaunchScreen</string>
40+
<key>UIRequiredDeviceCapabilities</key>
41+
<array>
42+
<string>arm64</string>
43+
</array>
44+
<key>UISupportedInterfaceOrientations</key>
45+
<array>
46+
<string>UIInterfaceOrientationPortrait</string>
47+
<string>UIInterfaceOrientationLandscapeLeft</string>
48+
<string>UIInterfaceOrientationLandscapeRight</string>
49+
</array>
50+
<key>UIViewControllerBasedStatusBarAppearance</key>
51+
<false/>
52+
</dict>
53+
</plist>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
</dict>
24+
</plist>

0 commit comments

Comments
 (0)