Where does RN CellRendererComponent get its props from?

135 views Asked by At

In React Native, when CellRendererComponent is used in a FlatList, where does it get its props from? For example, if I want to set style to something specific, how is it done?

const CellRendererComponent = ({ item, index, onLayout, children, style } ) => {
    
}

<FlatList
   ...
  renderItem={renderItem}
  CellRendererComponent={CellRendererComponent}
   ...
/>

Looking at the definition of CellRendererProps, it appears style should be a prop in its own right, just as well as item.

export interface CellRendererProps<ItemT> {
  cellKey: string;
  children: React.ReactNode;
  index: number;
  item: ItemT;
  onFocusCapture?: ((event: FocusEvent) => void) | undefined;
  onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
  style: StyleProp<ViewStyle> | undefined;
}
0

There are 0 answers