Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/virtual-list-testid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@plextv/react-lightning': patch
'@plextv/react-lightning-components': patch
---

`VirtualList` forwards `testID` to its outer container. Its props were a closed interface with no `testID`, so the prop was dropped and never reached an element, which left any screen whose root is a `VirtualList` invisible to test tooling that matches on it. `testID` is also declared on `LightningViewElementProps` now, since the react-native compat layer already passed it through untyped and the element treats it as inert.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function VirtualListInner<T>(
extraData,
contentContainerStyle,
style,
testID,
ListHeaderComponent,
listHeaderSize = 0,
ListFooterComponent,
Expand Down Expand Up @@ -891,6 +892,7 @@ function VirtualListInner<T>(
allowOffscreen={true}
autoFocus={autoFocus}
style={outerStyle}
testID={testID}
trapFocusDown={trapFocusDown}
trapFocusLeft={trapFocusLeft}
trapFocusRight={trapFocusRight}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export interface VirtualListProps<T> {
contentContainerStyle?: ContentStyle;
/** Style for the outer list container. Must include w and h. */
style?: LightningViewElementStyle;
/** Forwarded to the outer container so test tooling can find the list. */
testID?: string;

/** Component rendered before the first item. */
ListHeaderComponent?: ComponentType | ReactElement | null;
Expand Down
2 changes: 2 additions & 0 deletions packages/react-lightning/src/types/Props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export interface LightningViewElementProps<
rtt?: boolean;
children?: ReactNode | null;
style?: TStyleProps | null;
/** Inert at render time, but the inspector mirrors it for test tooling. */
testID?: string;
}

export type LightningImageElementProps<
Expand Down
Loading