Skip to content

Commit 3e24033

Browse files
drhopsmeta-codesync[bot]
authored andcommitted
Add missing strictMode prop to FlatList TypeScript types (#57674)
Summary: FlatList's `strictMode` prop is implemented in the component and declared in the Flow types (OptionalFlatListProps in FlatList.js), but missing from the shipped TypeScript definitions. TS users can't set it on <FlatList> without augmenting the module themselves. This adds `strictMode?: boolean` to the TypeScript FlatListProps, matching the Flow declaration. Types-only, no runtime change. ## Changelog: [GENERAL] [ADDED] - Add missing strictMode prop to FlatList TypeScript types Pull Request resolved: #57674 Test Plan: Types-only change: - Before, `<FlatList ... strictMode />` errored `(Property 'strictMode' does not exist);` - After, it type-checks. Matches the Flow prop and the runtime use in `render(): const renderer = strictMode ? this._memoizedRenderer : this._renderer;` Reviewed By: cortinico Differential Revision: D113631325 Pulled By: Abbondanzo fbshipit-source-id: 84866649daec3385b564e4c13f139aea0a787b37
1 parent 6d0612c commit 3e24033

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/react-native/Libraries/Lists/FlatList.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ export interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
161161
* @platform android
162162
*/
163163
fadingEdgeLength?: number | {start: number; end: number} | undefined;
164+
165+
/**
166+
* Enable an optimization to memoize the item renderer to prevent unnecessary rerenders.
167+
*/
168+
strictMode?: boolean | undefined;
164169
}
165170

166171
export abstract class FlatListComponent<

0 commit comments

Comments
 (0)