Skip to content
Open
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
15 changes: 15 additions & 0 deletions src/__tests__/native/className-with-style.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ test("View with multiple className properties where inline style takes precedenc
]);
});

test("FlatList: className should map to style", () => {
registerCSS(`.bg-red { background-color: red; }`);

const component = render(
<FlatList
testID={testID}
data={[]}
renderItem={() => null}
className="bg-red"
/>,
).getByTestId(testID);

expect(component.props.style).toStrictEqual({ backgroundColor: "#f00" });
});

/**
* Tests for style={undefined} not destroying computed className styles.
*
Expand Down
1 change: 1 addition & 0 deletions src/components/FlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { copyComponentProperties } from "./copyComponentProperties";

const mapping: StyledConfiguration<typeof RNFlatList> = {
className: "style",
ListFooterComponentClassName: "ListFooterComponentStyle",
ListHeaderComponentClassName: "ListHeaderComponentStyle",
columnWrapperClassName: "columnWrapperStyle",
Expand Down