From f1c7edbe9cfd04f9f5519db321d65f92e9787606 Mon Sep 17 00:00:00 2001 From: JulienIzz Date: Tue, 30 Jan 2024 15:38:16 +0100 Subject: [PATCH] chore: example of non virtualized manual grid --- packages/example/App.tsx | 3 + .../src/pages/NonVirtualizedGridPage.tsx | 66 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 packages/example/src/pages/NonVirtualizedGridPage.tsx diff --git a/packages/example/App.tsx b/packages/example/App.tsx index ff3e21e4..f8cb626f 100644 --- a/packages/example/App.tsx +++ b/packages/example/App.tsx @@ -13,6 +13,7 @@ import { BottomTabBarProps, createBottomTabNavigator } from '@react-navigation/b import { ProgramInfo } from './src/modules/program/domain/programInfo'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import { ProgramDetail } from './src/pages/ProgramDetail'; +import { NonVirtualizedGridPage } from './src/pages/NonVirtualizedGridPage'; const Stack = createNativeStackNavigator(); @@ -21,6 +22,7 @@ const Tab = createBottomTabNavigator(); export type RootTabParamList = { Home: undefined; ProgramGridPage: undefined; + NonVirtualizedGridPage: undefined; }; export type RootStackParamList = { @@ -45,6 +47,7 @@ const TabNavigator = () => { > + ); }; diff --git a/packages/example/src/pages/NonVirtualizedGridPage.tsx b/packages/example/src/pages/NonVirtualizedGridPage.tsx new file mode 100644 index 00000000..211b5c6f --- /dev/null +++ b/packages/example/src/pages/NonVirtualizedGridPage.tsx @@ -0,0 +1,66 @@ +import { DefaultFocus, SpatialNavigationNode } from 'react-tv-space-navigation'; +import { Page } from '../components/Page'; +import '../components/configureRemoteControl'; +import { getPrograms } from '../modules/program/infra/programInfos'; +import { useNavigation } from '@react-navigation/native'; +import { NativeStackNavigationProp } from '@react-navigation/native-stack'; +import { RootStackParamList } from '../../App'; +import styled from '@emotion/native'; +import { Fragment } from 'react'; +import { scaledPixels } from '../design-system/helpers/scaledPixels'; +import { ProgramNode } from '../modules/program/view/ProgramNode'; + +export const NonVirtualizedGridPage = () => { + return ( + + + + + + + + + + + + + + ); +}; + +const ShortProgramList = () => { + const navigation = useNavigation>(); + const programs = getPrograms().slice(0, 6); + return ( + + + {programs.map((program) => { + return ( + navigation.push('ProgramDetail', { programInfo: program })} + key={program.id} + /> + ); + })} + + + ); +}; + +const ListContainer = styled.View(({ theme }) => ({ + flexDirection: 'row', + flexWrap: 'wrap', + justifyContent: 'center', + gap: theme.spacings.$4, + padding: theme.spacings.$4, +})); + +const Container = styled.View({ + backgroundColor: '#222', + margin: 'auto', + borderRadius: scaledPixels(20), + padding: scaledPixels(30), + justifyContent: 'center', + alignItems: 'center', +});