@@ -33,7 +33,7 @@ type ProgramListProps = {
3333 data ?: ProgramInfo [ ] ;
3434 listSize ?: number ;
3535 variant ?: 'normal' | 'variable-size' ;
36- parentRef ?: MutableRefObject < SpatialNavigationVirtualizedListRef > ;
36+ parentRef ?: MutableRefObject < SpatialNavigationVirtualizedListRef | null > ;
3737 isActive : boolean ;
3838} ;
3939
@@ -45,7 +45,7 @@ export const ProgramList = React.forwardRef<View, ProgramListProps>(
4545 ( { orientation, containerStyle, data, parentRef, isActive, variant, listSize = 1000 } , ref ) => {
4646 const navigation = useNavigation < NativeStackNavigationProp < RootStackParamList > > ( ) ;
4747 const theme = useTheme ( ) ;
48- const listRef = useRef < SpatialNavigationVirtualizedListRef > ( null ) ;
48+ const listRef = useRef < SpatialNavigationVirtualizedListRef | null > ( null ) ;
4949
5050 const renderItem = useCallback (
5151 ( { item, index } : { item : ProgramInfo ; index : number } ) => (
@@ -80,13 +80,13 @@ export const ProgramList = React.forwardRef<View, ProgramListProps>(
8080 ( pressedKey : SupportedKeys ) => {
8181 const isBackKey = pressedKey === SupportedKeys . Back ;
8282 const isRowActive = isActive && isScreenFocused ;
83- const isFirstElementFocused = listRef . current . currentlyFocusedItemIndex === 0 ;
83+ const isFirstElementFocused = listRef . current ? .currentlyFocusedItemIndex === 0 ;
8484
8585 if ( ! isBackKey || ! isRowActive || isFirstElementFocused ) {
8686 return false ;
8787 }
8888
89- listRef . current . focus ( 0 ) ;
89+ listRef . current ? .focus ( 0 ) ;
9090 return true ;
9191 } ,
9292 [ isActive , isScreenFocused , listRef ] ,
@@ -104,8 +104,10 @@ export const ProgramList = React.forwardRef<View, ProgramListProps>(
104104 numberOfRenderedItems = { WINDOW_SIZE }
105105 numberOfItemsVisibleOnScreen = { NUMBER_OF_ITEMS_VISIBLE_ON_SCREEN }
106106 onEndReachedThresholdItemsNumber = { NUMBER_OF_ITEMS_VISIBLE_ON_SCREEN }
107+ // @ts -expect-error TODO change the type from ReactElement to ReactNode in the core
107108 descendingArrow = { isActive ? < LeftArrow /> : null }
108109 descendingArrowContainerStyle = { styles . leftArrowContainer }
110+ // @ts -expect-error TODO change the type from ReactElement to ReactNode in the core
109111 ascendingArrow = { isActive ? < RightArrow /> : null }
110112 ascendingArrowContainerStyle = { styles . rightArrowContainer }
111113 ref = { ( elementRef ) => {
@@ -124,11 +126,13 @@ export const ProgramsRow = ({
124126 variant = 'normal' ,
125127 listSize,
126128 parentRef,
129+ data,
127130} : {
128131 containerStyle ?: object ;
129132 variant ?: 'normal' | 'variable-size' ;
130133 listSize ?: number ;
131- parentRef ?: MutableRefObject < SpatialNavigationVirtualizedListRef > ;
134+ parentRef ?: MutableRefObject < SpatialNavigationVirtualizedListRef | null > ;
135+ data ?: ProgramInfo [ ] ;
132136} ) => {
133137 const theme = useTheme ( ) ;
134138 return (
@@ -143,6 +147,7 @@ export const ProgramsRow = ({
143147 listSize = { listSize }
144148 parentRef = { parentRef }
145149 isActive = { isActive }
150+ data = { data }
146151 />
147152 ) }
148153 </ SpatialNavigationNode >
0 commit comments