diff --git a/src/components/metadata/SeriesContent.tsx b/src/components/metadata/SeriesContent.tsx index 3f996fd94..b39780295 100644 --- a/src/components/metadata/SeriesContent.tsx +++ b/src/components/metadata/SeriesContent.tsx @@ -134,10 +134,12 @@ export const SeriesContent: React.FC = ({ if (selectedIndex !== -1) { // Wait a small amount of time for layout to be ready setTimeout(() => { - seasonScrollViewRef.current?.scrollTo({ - x: selectedIndex * 116, // 100px width + 16px margin - animated: true - }); + if (seasonScrollViewRef.current && typeof (seasonScrollViewRef.current as any).scrollToOffset === 'function') { + (seasonScrollViewRef.current as any).scrollToOffset({ + offset: selectedIndex * 116, // 100px width + 16px margin + animated: true + }); + } }, 300); } } @@ -181,14 +183,17 @@ export const SeriesContent: React.FC = ({ return ( Seasons - >} + data={seasons} + horizontal showsHorizontalScrollIndicator={false} style={styles.seasonSelectorContainer} contentContainerStyle={styles.seasonSelectorContent} - > - {seasons.map(season => { + initialNumToRender={5} + maxToRenderPerBatch={5} + windowSize={3} + renderItem={({ item: season }) => { const seasonEpisodes = groupedEpisodes[season] || []; let seasonPoster = DEFAULT_PLACEHOLDER; if (seasonEpisodes[0]?.season_poster_path) { @@ -234,8 +239,9 @@ export const SeriesContent: React.FC = ({ ); - })} - + }} + keyExtractor={season => season.toString()} + /> ); }; @@ -583,46 +589,37 @@ export const SeriesContent: React.FC = ({ maxToRenderPerBatch={3} windowSize={5} /> - ) : + ) : ( // Vertical Layout (Traditional) - isTablet ? ( - ( - + {isTablet ? ( + + {currentSeasonEpisodes.map((episode, index) => ( + + {renderVerticalEpisodeCard(episode)} + + ))} + + ) : ( + currentSeasonEpisodes.map((episode, index) => ( + {renderVerticalEpisodeCard(episode)} - )} - keyExtractor={episode => episode.id.toString()} - numColumns={2} - style={styles.episodeList} - contentContainerStyle={styles.episodeListContentVerticalTablet} - initialNumToRender={10} - maxToRenderPerBatch={10} - windowSize={10} - /> - ) : ( - ( - - {renderVerticalEpisodeCard(episode)} - - )} - keyExtractor={episode => episode.id.toString()} - style={styles.episodeList} - contentContainerStyle={styles.episodeListContentVertical} - initialNumToRender={10} - maxToRenderPerBatch={10} - windowSize={10} - /> - ) + )) + )} + + ) )}