Skip to content

Commit cb61e77

Browse files
committed
Revert "feat: initialize TV support"
This reverts commit 8e57607.
1 parent 8e57607 commit cb61e77

File tree

13 files changed

+30
-571
lines changed

13 files changed

+30
-571
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@
77
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
88
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
99

10-
<!-- Android TV Support -->
11-
<uses-feature android:name="android.software.leanback" android:required="false" />
12-
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
13-
1410
<application
1511
android:name=".MainApplication"
1612
android:label="@string/app_name"
1713
android:icon="@mipmap/ic_launcher"
1814
android:roundIcon="@mipmap/ic_launcher_round"
19-
android:banner="@drawable/tv_banner"
2015
android:allowBackup="false"
2116
android:theme="@style/AppTheme"
2217
android:usesCleartextTraffic="${usesCleartextTraffic}"
@@ -33,11 +28,6 @@
3328
<action android:name="android.intent.action.MAIN" />
3429
<category android:name="android.intent.category.LAUNCHER" />
3530
</intent-filter>
36-
<!-- Android TV Leanback Launcher -->
37-
<intent-filter>
38-
<action android:name="android.intent.action.MAIN" />
39-
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
40-
</intent-filter>
4131
</activity>
4232

4333
<!-- FileProvider for APK installation -->

android/app/src/main/res/drawable/tv_banner.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/components/ContentCard.tsx

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useState, useCallback} from 'react';
1+
import React from 'react';
22
import {
33
View,
44
Text,
@@ -16,42 +16,21 @@ import {
1616
accessibilityRoles,
1717
getContentDescription,
1818
} from '../utils/accessibility';
19-
import {isTV, TV_FOCUS_BORDER_COLOR} from '../utils/tv';
20-
import TVFocusable from './TVFocusable';
2119

2220
interface ContentCardProps {
2321
item: Movie | TVShow;
2422
onPress: (item: Movie | TVShow) => void;
2523
size?: 'small' | 'medium' | 'large';
2624
style?: ViewStyle;
27-
hasTVPreferredFocus?: boolean;
28-
onFocus?: () => void;
29-
onBlur?: () => void;
3025
}
3126

3227
const ContentCard: React.FC<ContentCardProps> = ({
3328
item,
3429
onPress,
3530
size = 'medium',
3631
style,
37-
hasTVPreferredFocus = false,
38-
onFocus,
39-
onBlur,
4032
}) => {
41-
const [isFocused, setIsFocused] = useState(false);
42-
const cardDimensions = isTV
43-
? {width: getCardDimensions(size).width * 1.2, height: getCardDimensions(size).height * 1.2}
44-
: getCardDimensions(size);
45-
46-
const handleFocus = useCallback(() => {
47-
setIsFocused(true);
48-
onFocus?.();
49-
}, [onFocus]);
50-
51-
const handleBlur = useCallback(() => {
52-
setIsFocused(false);
53-
onBlur?.();
54-
}, [onBlur]);
33+
const cardDimensions = getCardDimensions(size);
5534
const imageUrl = item.poster_path
5635
? `${TMDB_CONFIG.IMAGE_BASE_URL}${item.poster_path}`
5736
: '';
@@ -67,35 +46,23 @@ const ContentCard: React.FC<ContentCardProps> = ({
6746
const contentDescription = getContentDescription(item);
6847

6948
return (
70-
<TVFocusable
71-
style={[
72-
styles.container,
73-
{width: cardDimensions.width},
74-
style,
75-
isFocused && styles.focusedContainer,
76-
]}
49+
<TouchableOpacity
50+
style={[styles.container, {width: cardDimensions.width}, style]}
7751
onPress={() => onPress(item)}
7852
activeOpacity={0.8}
7953
accessible={true}
8054
accessibilityRole={accessibilityRoles.button}
8155
accessibilityLabel={accessibilityLabel}
8256
accessibilityHint={accessibilityHints.contentCard}
83-
hasTVPreferredFocus={hasTVPreferredFocus}
84-
onFocus={handleFocus}
85-
onBlur={handleBlur}
86-
showFocusBorder={false}>
87-
<View style={[
88-
styles.imageContainer,
89-
cardDimensions,
90-
isFocused && styles.focusedImage,
91-
]}>
57+
accessibilityValue={{text: contentDescription}}>
58+
<View style={[styles.imageContainer, cardDimensions]}>
9259
<OptimizedImage
9360
uri={imageUrl}
9461
style={[styles.image, cardDimensions] as any}
9562
fallbackText="No Image"
9663
showLoadingIndicator={true}
9764
/>
98-
{rating !== undefined && rating > 0 && (
65+
{rating > 0 && (
9966
<View
10067
style={styles.ratingContainer}
10168
accessible={true}
@@ -108,10 +75,7 @@ const ContentCard: React.FC<ContentCardProps> = ({
10875
{size !== 'small' && (
10976
<View style={styles.titleContainer}>
11077
<Text
111-
style={[
112-
styles.title,
113-
isFocused && styles.focusedTitle,
114-
]}
78+
style={styles.title}
11579
numberOfLines={2}
11680
ellipsizeMode="tail"
11781
accessible={true}
@@ -120,29 +84,20 @@ const ContentCard: React.FC<ContentCardProps> = ({
12084
</Text>
12185
</View>
12286
)}
123-
</TVFocusable>
87+
</TouchableOpacity>
12488
);
12589
};
12690

12791
const styles = StyleSheet.create({
12892
container: {
12993
marginRight: spacing.sm,
13094
},
131-
focusedContainer: {
132-
zIndex: 10,
133-
},
13495
imageContainer: {
13596
borderRadius: spacing.sm,
13697
overflow: 'hidden',
13798
backgroundColor: COLORS.NETFLIX_DARK_GRAY,
13899
position: 'relative',
139100
},
140-
focusedImage: {
141-
borderWidth: 3,
142-
borderColor: TV_FOCUS_BORDER_COLOR,
143-
borderRadius: spacing.sm + 2,
144-
transform: [{scale: 1.05}],
145-
},
146101
image: {
147102
borderRadius: spacing.sm,
148103
},
@@ -171,10 +126,6 @@ const styles = StyleSheet.create({
171126
textAlign: 'center',
172127
lineHeight: typography.caption * 1.2,
173128
},
174-
focusedTitle: {
175-
color: TV_FOCUS_BORDER_COLOR,
176-
fontWeight: 'bold',
177-
},
178129
});
179130

180131
export {ContentCard};

src/components/HorizontalScrollList.tsx

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useCallback, useRef, useState} from 'react';
1+
import React, {useCallback} from 'react';
22
import {
33
View,
44
Text,
@@ -11,7 +11,6 @@ import {COLORS} from '../utils/constants';
1111
import {ContentCard} from './ContentCard';
1212
import {getCardDimensions, spacing, typography} from '../utils/responsive';
1313
import {accessibilityRoles} from '../utils/accessibility';
14-
import {isTV} from '../utils/tv';
1514

1615
interface HorizontalScrollListProps {
1716
title: string;
@@ -22,8 +21,6 @@ interface HorizontalScrollListProps {
2221
onEndReached?: () => void;
2322
hasMore?: boolean;
2423
loadingMore?: boolean;
25-
hasTVPreferredFocus?: boolean;
26-
sectionIndex?: number;
2724
}
2825

2926
const HorizontalScrollList: React.FC<HorizontalScrollListProps> = ({
@@ -35,32 +32,9 @@ const HorizontalScrollList: React.FC<HorizontalScrollListProps> = ({
3532
onEndReached,
3633
hasMore = false,
3734
loadingMore = false,
38-
hasTVPreferredFocus = false,
39-
sectionIndex = 0,
4035
}) => {
41-
const flatListRef = useRef<FlatList>(null);
42-
const [focusedIndex, setFocusedIndex] = useState(-1);
43-
44-
const handleItemFocus = useCallback((index: number) => {
45-
setFocusedIndex(index);
46-
// Scroll to focused item on TV
47-
if (isTV && flatListRef.current) {
48-
flatListRef.current.scrollToIndex({
49-
index,
50-
animated: true,
51-
viewPosition: 0.3,
52-
});
53-
}
54-
}, []);
55-
56-
const renderItem = ({item, index}: {item: Movie | TVShow; index: number}) => (
57-
<ContentCard
58-
item={item}
59-
onPress={onItemPress}
60-
size={cardSize}
61-
hasTVPreferredFocus={hasTVPreferredFocus && index === 0}
62-
onFocus={() => handleItemFocus(index)}
63-
/>
36+
const renderItem = ({item}: {item: Movie | TVShow}) => (
37+
<ContentCard item={item} onPress={onItemPress} size={cardSize} />
6438
);
6539

6640
const renderLoadingItem = () => (
@@ -126,21 +100,17 @@ const HorizontalScrollList: React.FC<HorizontalScrollListProps> = ({
126100
</View>
127101
) : (
128102
<FlatList
129-
ref={flatListRef}
130103
data={data}
131104
renderItem={renderItem}
132105
keyExtractor={keyExtractor}
133106
horizontal
134107
showsHorizontalScrollIndicator={false}
135-
contentContainerStyle={[
136-
styles.listContainer,
137-
isTV && styles.tvListContainer,
138-
]}
108+
contentContainerStyle={styles.listContainer}
139109
getItemLayout={getItemLayout}
140-
initialNumToRender={isTV ? 6 : 3}
141-
maxToRenderPerBatch={isTV ? 8 : 5}
142-
windowSize={isTV ? 7 : 5}
143-
removeClippedSubviews={!isTV}
110+
initialNumToRender={3}
111+
maxToRenderPerBatch={5}
112+
windowSize={5}
113+
removeClippedSubviews={true}
144114
updateCellsBatchingPeriod={50}
145115
ListEmptyComponent={renderEmptyComponent}
146116
decelerationRate="normal"
@@ -184,10 +154,6 @@ const styles = StyleSheet.create({
184154
listContainer: {
185155
paddingHorizontal: spacing.md,
186156
},
187-
tvListContainer: {
188-
paddingHorizontal: spacing.lg,
189-
paddingVertical: spacing.sm,
190-
},
191157
loadingContainer: {
192158
flexDirection: 'row',
193159
paddingHorizontal: spacing.md,

src/components/MediaPlayer/hooks/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export { useVideoProgress } from './useVideoProgress';
22
export { useSubtitles } from './useSubtitles';
33
export { useFullscreen } from './useFullscreen';
44
export { useControlsVisibility } from './useControlsVisibility';
5-
export { useTVRemote } from './useTVRemote';

src/components/MediaPlayer/hooks/useTVRemote.ts

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)