You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The SpatialNavigationVirtualizedList component does not display more than the initial set of items when fetching additional data on reaching the end of the list. The UI does not render the newly fetched items even though the data is correctly fetched and available.
To Reproduce
importReact,{useMemo,useState}from'react';import{View}from'react-native';import{SpatialNavigationVirtualizedList,SpatialNavigationNode}from'react-tv-space-navigation';importDetailedItemCardfrom'./DetailedItemCard';import{useVideoSearchRepository}from'./hooks';constMyComponent=()=>{const[queryText,setQueryText]=useState('');// queryText is updated based on the input state logic// Example: setQueryText(inputValue);const{rows: videoRows,fetchNextPage: fetchNextVideoPage,}=useVideoSearchRepository(queryText);constmemoizedVideoRows=useMemo(()=>videoRows||[],[videoRows]);console.log(memoizedVideoRows);// Logs 16 items when onEndReached is triggeredconstrenderVideoItem=({ item, index })=>(<SpatialNavigationNodekey={`video-${item.id}-${index}`}isFocusable={true}onSelect={()=>onVideoItemSelected(item)}>{({ isFocused })=>(<Viewstyle={{backgroundColor: theme.colors.BACKGROUND}}><DetailedItemCarditem={item}isFocused={isFocused}width={380}height={210}/></View>)}</SpatialNavigationNode>);return(<SpatialNavigationVirtualizedListdata={memoizedVideoRows}renderItem={renderVideoItem}itemSize={230}numberOfRenderedItems={8}numberOfItemsVisibleOnScreen={4}onEndReachedThresholdItemsNumber={4}onEndReached={fetchNextVideoPage}orientation="vertical"/>);};
Expected behavior
When the onEndReached function is triggered and new data is fetched, the component should render the additional items. For example, if the initial set of 8 items is displayed, and 8 more items are fetched, the component should then display a total of 16 items.
Screenshots
Due to confidentiality terms, I cannot provide screenshots. If necessary, I can recreate the code with alternate names for demonstration purposes. Please feel free to let me know if you need further details or additional context.
Version and OS
Library version: react-tv-space-navigation 3.5.0
React Native version: 0.72.0
OS: Mac Sonoma 14.5, Node v16.20.2
Additional context
The issue is observed when running the development environment with the target set for web using the command:
webpack serve --env development --config webpack.config.js
Here are additional code snippets for the hook and its respective calls:
Thank you for the detailed issue. I'll give a try to the pagination feature, it's been a while since it was tested (my bad -- there's no working example on that nor any test).
Hey! Sorry I totally forgot to give news on this. I did an example on the project... and it worked well 😱
You can check out this branch: fix/repro-pagination and have a look at the example, see if there is any difference with what you've done 🤔
Describe the bug
The SpatialNavigationVirtualizedList component does not display more than the initial set of items when fetching additional data on reaching the end of the list. The UI does not render the newly fetched items even though the data is correctly fetched and available.
To Reproduce
Expected behavior
When the onEndReached function is triggered and new data is fetched, the component should render the additional items. For example, if the initial set of 8 items is displayed, and 8 more items are fetched, the component should then display a total of 16 items.
Screenshots
Due to confidentiality terms, I cannot provide screenshots. If necessary, I can recreate the code with alternate names for demonstration purposes. Please feel free to let me know if you need further details or additional context.
Version and OS
Additional context
The issue is observed when running the development environment with the target set for web using the command:
Here are additional code snippets for the hook and its respective calls:
The text was updated successfully, but these errors were encountered: