From this comment: #848 (comment) it became apparent to me that we can now add more values to the "contentContainerStyle" prop in Flashlist v2.
I'm using "@shopify/flash-list": "^2.0.0-rc.2",
It seems that we can now add ViewStyle values to the "contentContainerStyle" prop. The problem is that if we add a value that's not in this list:
"backgroundColor"
| "paddingTop"
| "paddingLeft"
| "paddingRight"
| "paddingBottom"
| "padding"
| "paddingVertical"
| "paddingHorizontal"
typescript will give you the following error:
Object literal may only specify known properties, and 'flexGrow' does not exist in type 'ContentStyle'.ts(2353)
FlashListProps.d.ts(103, 5): The expected type comes from property 'contentContainerStyle' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<FlashList> & Pick<Readonly<FlashListProps>, "scrollEnabled" | ... 184 more ... | "onCommitLayoutEffect"> & InexactPartial<...> & InexactPartial<...>'
We can get around this by doing:
import { ViewStyle } from "react-native"
and then
contentContainerStyle={{ flexGrow: 1 } as ViewStyle}
but we shouldn't have to do this as I can see that ContentStyle is updated to include ViewStyle, yet it doesn't detect it. In FlashListProps.ts we have:
export type ContentStyle = Pick<
ViewStyle,
| "backgroundColor"
| "paddingTop"
| "paddingLeft"
| "paddingRight"
| "paddingBottom"
| "padding"
| "paddingVertical"
| "paddingHorizontal"
>;
From this comment: #848 (comment) it became apparent to me that we can now add more values to the "contentContainerStyle" prop in Flashlist v2.
I'm using "@shopify/flash-list": "^2.0.0-rc.2",
It seems that we can now add ViewStyle values to the "contentContainerStyle" prop. The problem is that if we add a value that's not in this list:
typescript will give you the following error:
We can get around this by doing:
import { ViewStyle } from "react-native"and then
contentContainerStyle={{ flexGrow: 1 } as ViewStyle}but we shouldn't have to do this as I can see that ContentStyle is updated to include ViewStyle, yet it doesn't detect it. In FlashListProps.ts we have: