@react-native-tvos/virtualized-lists 0.82.0-0rc5 → 0.83.0-0rc0

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.
@@ -152,7 +152,11 @@ export interface VirtualizedListWithoutRenderItemProps<ItemT>
152
152
  /**
153
153
  * Rendered in between each item, but not at the top or bottom
154
154
  */
155
- ItemSeparatorComponent?: React.ComponentType<any> | null | undefined;
155
+ ItemSeparatorComponent?:
156
+ | React.ComponentType<any>
157
+ | React.ReactElement
158
+ | null
159
+ | undefined;
156
160
 
157
161
  /**
158
162
  * Rendered when the list is empty. Can be a React Component Class, a render function, or
@@ -24,9 +24,10 @@ import {StyleSheet, View} from 'react-native';
24
24
 
25
25
  export type Props<ItemT> = {
26
26
  CellRendererComponent?: ?React.ComponentType<CellRendererProps<ItemT>>,
27
- ItemSeparatorComponent: ?React.ComponentType<
28
- any | {highlighted: boolean, leadingItem: ?ItemT},
29
- >,
27
+ ItemSeparatorComponent?: ?(
28
+ | React.ComponentType<any | {highlighted: boolean, leadingItem: ?ItemT}>
29
+ | React.MixedElement
30
+ ),
30
31
  ListItemComponent?: ?(React.ComponentType<any> | React.MixedElement),
31
32
  cellKey: string,
32
33
  horizontal: ?boolean,
@@ -199,6 +200,8 @@ export default class CellRenderer<ItemT> extends React.PureComponent<
199
200
  ItemSeparatorComponent
200
201
  : // $FlowFixMe[incompatible-type]
201
202
  ItemSeparatorComponent && (
203
+ // $FlowFixMe[incompatible-type]
204
+ // $FlowFixMe[not-a-component]
202
205
  <ItemSeparatorComponent {...this.state.separatorProps} />
203
206
  );
204
207
  const cellStyle = inversionStyle
@@ -8,7 +8,7 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import typeof VirtualizedListT from './VirtualizedList';
11
+ import type VirtualizedList from './VirtualizedList';
12
12
 
13
13
  import * as React from 'react';
14
14
  import {createContext, useContext, useMemo} from 'react';
@@ -26,12 +26,9 @@ type Context = $ReadOnly<{
26
26
  zoomScale: number,
27
27
  },
28
28
  horizontal: ?boolean,
29
- getOutermostParentListRef: () => React.ElementRef<VirtualizedListT>,
30
- registerAsNestedChild: ({
31
- cellKey: string,
32
- ref: React.ElementRef<VirtualizedListT>,
33
- }) => void,
34
- unregisterAsNestedChild: ({ref: React.ElementRef<VirtualizedListT>}) => void,
29
+ getOutermostParentListRef: () => VirtualizedList,
30
+ registerAsNestedChild: ({cellKey: string, ref: VirtualizedList}) => void,
31
+ unregisterAsNestedChild: ({ref: VirtualizedList}) => void,
35
32
  }>;
36
33
 
37
34
  export const VirtualizedListContext: React.Context<?Context> =
@@ -129,7 +129,7 @@ type OptionalVirtualizedListProps = {
129
129
  * which will update the `highlighted` prop, but you can also add custom props with
130
130
  * `separators.updateProps`.
131
131
  */
132
- ItemSeparatorComponent?: ?React.ComponentType<any>,
132
+ ItemSeparatorComponent?: ?(React.ComponentType<any> | React.MixedElement),
133
133
  /**
134
134
  * Takes an item from `data` and renders it into the list. Example usage:
135
135
  *
@@ -50,7 +50,7 @@ export type SectionBase<SectionItemT, SectionT = DefaultVirtualizedSectionT> = {
50
50
  },
51
51
  ...
52
52
  }) => null | React.MixedElement,
53
- ItemSeparatorComponent?: ?React.ComponentType<any>,
53
+ ItemSeparatorComponent?: ?(React.ComponentType<any> | React.MixedElement),
54
54
  keyExtractor?: (item: ?SectionItemT, index?: ?number) => string,
55
55
  ...
56
56
  };
@@ -450,7 +450,7 @@ class VirtualizedSectionList<
450
450
  index: number,
451
451
  info?: ?Object,
452
452
  listItemCount: number,
453
- ): ?React.ComponentType<any> {
453
+ ): ?(React.ComponentType<any> | React.MixedElement) {
454
454
  info = info || this._subExtractor(index);
455
455
  if (!info) {
456
456
  return null;
@@ -488,8 +488,8 @@ type ItemWithSeparatorCommonProps<ItemT> = $ReadOnly<{
488
488
 
489
489
  type ItemWithSeparatorProps<ItemT> = $ReadOnly<{
490
490
  ...ItemWithSeparatorCommonProps<ItemT>,
491
- LeadingSeparatorComponent: ?React.ComponentType<any>,
492
- SeparatorComponent: ?React.ComponentType<any>,
491
+ LeadingSeparatorComponent: ?(React.ComponentType<any> | React.MixedElement),
492
+ SeparatorComponent: ?(React.ComponentType<any> | React.MixedElement),
493
493
  cellKey: string,
494
494
  index: number,
495
495
  item: ItemT,
@@ -604,18 +604,30 @@ function ItemWithSeparator<ItemT>(
604
604
  section,
605
605
  separators,
606
606
  });
607
- const leadingSeparator = LeadingSeparatorComponent != null && (
608
- <LeadingSeparatorComponent
609
- highlighted={leadingSeparatorHiglighted}
610
- {...leadingSeparatorProps}
611
- />
612
- );
613
- const separator = SeparatorComponent != null && (
614
- <SeparatorComponent
615
- highlighted={separatorHighlighted}
616
- {...separatorProps}
617
- />
618
- );
607
+ const leadingSeparator =
608
+ LeadingSeparatorComponent != null &&
609
+ ((React.isValidElement(LeadingSeparatorComponent) ? (
610
+ LeadingSeparatorComponent
611
+ ) : (
612
+ // $FlowFixMe[not-a-component]
613
+ // $FlowFixMe[incompatible-type]
614
+ <LeadingSeparatorComponent
615
+ highlighted={leadingSeparatorHiglighted}
616
+ {...leadingSeparatorProps}
617
+ />
618
+ )): any);
619
+ const separator =
620
+ SeparatorComponent != null &&
621
+ ((React.isValidElement(SeparatorComponent) ? (
622
+ SeparatorComponent
623
+ ) : (
624
+ // $FlowFixMe[not-a-component]
625
+ // $FlowFixMe[incompatible-type]
626
+ <SeparatorComponent
627
+ highlighted={separatorHighlighted}
628
+ {...separatorProps}
629
+ />
630
+ )): any);
619
631
  const RenderSeparator = leadingSeparator || separator;
620
632
  const firstSeparator = inverted === false ? leadingSeparator : separator;
621
633
  const secondSeparator = inverted === false ? separator : leadingSeparator;
@@ -636,7 +648,7 @@ const VirtualizedSectionListComponent = VirtualizedSectionList as component<
636
648
  DefaultVirtualizedSectionT,
637
649
  > = DefaultVirtualizedSectionT,
638
650
  >(
639
- ref: React.RefSetter<
651
+ ref?: React.RefSetter<
640
652
  interface {
641
653
  getListRef(): ?VirtualizedList,
642
654
  scrollToLocation(params: ScrollToLocationParamsType): void,
package/index.js CHANGED
@@ -19,7 +19,7 @@ import {typeof VirtualizedListContextResetter as VirtualizedListContextResetterT
19
19
  import {keyExtractor} from './Lists/VirtualizeUtils';
20
20
 
21
21
  export type {
22
- ViewToken,
22
+ ViewToken as ListViewToken,
23
23
  ViewabilityConfig,
24
24
  ViewabilityConfigCallbackPair,
25
25
  ViewabilityConfigCallbackPairs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-tvos/virtualized-lists",
3
- "version": "0.82.0-0rc5",
3
+ "version": "0.83.0-0rc0",
4
4
  "description": "Virtualized lists for React Native.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -48,10 +48,10 @@
48
48
  "nullthrows": "^1.1.1"
49
49
  },
50
50
  "devDependencies": {
51
- "react-test-renderer": "19.1.1"
51
+ "react-test-renderer": "19.2.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "@types/react": "^19.1.1",
54
+ "@types/react": "^19.2.0",
55
55
  "react": "*",
56
56
  "react-native": "*"
57
57
  },