From 104806e38e97e5755cd554d3d2b301cd38a88ad1 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 25 Aug 2026 11:32:59 +0200 Subject: [PATCH] fix(vendor): forward testID from VirtualList to its outer container --- .changeset/virtual-list-testid.md | 6 ++++++ .../src/components/VirtualList/VirtualList.tsx | 2 ++ .../src/components/VirtualList/VirtualListTypes.ts | 2 ++ packages/react-lightning/src/types/Props.ts | 2 ++ 4 files changed, 12 insertions(+) create mode 100644 .changeset/virtual-list-testid.md diff --git a/.changeset/virtual-list-testid.md b/.changeset/virtual-list-testid.md new file mode 100644 index 00000000..ed59c7c0 --- /dev/null +++ b/.changeset/virtual-list-testid.md @@ -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. diff --git a/packages/react-lightning-components/src/components/VirtualList/VirtualList.tsx b/packages/react-lightning-components/src/components/VirtualList/VirtualList.tsx index 4f6035f1..d69b5d62 100644 --- a/packages/react-lightning-components/src/components/VirtualList/VirtualList.tsx +++ b/packages/react-lightning-components/src/components/VirtualList/VirtualList.tsx @@ -121,6 +121,7 @@ function VirtualListInner( extraData, contentContainerStyle, style, + testID, ListHeaderComponent, listHeaderSize = 0, ListFooterComponent, @@ -891,6 +892,7 @@ function VirtualListInner( allowOffscreen={true} autoFocus={autoFocus} style={outerStyle} + testID={testID} trapFocusDown={trapFocusDown} trapFocusLeft={trapFocusLeft} trapFocusRight={trapFocusRight} diff --git a/packages/react-lightning-components/src/components/VirtualList/VirtualListTypes.ts b/packages/react-lightning-components/src/components/VirtualList/VirtualListTypes.ts index 77d0a10e..b5c39a72 100644 --- a/packages/react-lightning-components/src/components/VirtualList/VirtualListTypes.ts +++ b/packages/react-lightning-components/src/components/VirtualList/VirtualListTypes.ts @@ -92,6 +92,8 @@ export interface VirtualListProps { 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; diff --git a/packages/react-lightning/src/types/Props.ts b/packages/react-lightning/src/types/Props.ts index 793f3a1d..5974d11f 100644 --- a/packages/react-lightning/src/types/Props.ts +++ b/packages/react-lightning/src/types/Props.ts @@ -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<