@react-native-tvos/virtualized-lists 0.73.4 → 0.73.6-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -390,4 +390,12 @@ export interface VirtualizedListWithoutRenderItemProps<ItemT>
390
390
  | React.ComponentType<CellRendererProps<ItemT>>
391
391
  | null
392
392
  | undefined;
393
+
394
+ /**
395
+ * Defines regions within the list that are exempt from virtualization,
396
+ * ensuring they remain rendered at all times. Useful for cases where
397
+ * users can't afford blank areas in certain parts of the list.
398
+ * The specified regions are lazily rendered after the initial render.
399
+ */
400
+ additionalRenderRegions?: {first: number; last: number}[] | undefined;
393
401
  }
@@ -31,6 +31,7 @@ import {
31
31
  ScrollView,
32
32
  View,
33
33
  StyleSheet,
34
+ TVFocusGuideView,
34
35
  findNodeHandle,
35
36
  } from 'react-native';
36
37
  import Batchinator from '../Interaction/Batchinator';
@@ -64,7 +65,6 @@ import {
64
65
  onEndReachedThresholdOrDefault,
65
66
  windowSizeOrDefault,
66
67
  } from './VirtualizedListProps';
67
- import TVFocusGuideView from '../../react-native/Libraries/Components/TV/TVFocusGuideView';
68
68
 
69
69
  export type {RenderItemProps, RenderItemType, Separators};
70
70
 
@@ -1900,13 +1900,19 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
1900
1900
  first: number,
1901
1901
  last: number,
1902
1902
  }> => {
1903
+ let nonViewportRenderRegions = [];
1904
+
1905
+ if (props?.additionalRenderRegions?.length) {
1906
+ nonViewportRenderRegions = [...props.additionalRenderRegions];
1907
+ }
1908
+
1903
1909
  // Keep a viewport's worth of content around the last focused cell to allow
1904
1910
  // random navigation around it without any blanking. E.g. tabbing from one
1905
1911
  // focused item out of viewport to another.
1906
1912
  if (
1907
1913
  !(this._lastFocusedCellKey && this._cellRefs[this._lastFocusedCellKey])
1908
1914
  ) {
1909
- return [];
1915
+ return nonViewportRenderRegions;
1910
1916
  }
1911
1917
 
1912
1918
  const lastFocusedCellRenderer = this._cellRefs[this._lastFocusedCellKey];
@@ -1920,7 +1926,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
1920
1926
  VirtualizedList._getItemKey(props, focusedCellIndex) !==
1921
1927
  this._lastFocusedCellKey
1922
1928
  ) {
1923
- return [];
1929
+ return nonViewportRenderRegions;
1924
1930
  }
1925
1931
 
1926
1932
  let first = focusedCellIndex;
@@ -1952,7 +1958,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
1952
1958
  ).length;
1953
1959
  }
1954
1960
 
1955
- return [{first, last}];
1961
+ return [...nonViewportRenderRegions, {first, last}];
1956
1962
  };
1957
1963
 
1958
1964
  _updateViewableItems(
@@ -285,6 +285,13 @@ type OptionalProps = {|
285
285
  * The legacy implementation is no longer supported.
286
286
  */
287
287
  legacyImplementation?: empty,
288
+ /**
289
+ * Defines regions within the list that are exempt from virtualization,
290
+ * ensuring they remain rendered at all times. Useful for cases where
291
+ * users can't afford blank areas in certain parts of the list.
292
+ * The specified regions are lazily rendered after the initial render.
293
+ */
294
+ additionalRenderRegions?: Array<{first: number, last: number}>,
288
295
  |};
289
296
 
290
297
  export type Props = {|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-tvos/virtualized-lists",
3
- "version": "0.73.4",
3
+ "version": "0.73.6-1",
4
4
  "description": "Virtualized lists for React Native with TV focus engine support.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,4 +29,4 @@
29
29
  "peerDependencies": {
30
30
  "react-native": "*"
31
31
  }
32
- }
32
+ }