Skip to content

Commit

Permalink
fix: remove FlatList from props enabling it to be passed down to Time…
Browse files Browse the repository at this point in the history
…rPicker
  • Loading branch information
giovanniRodighiero committed Jun 29, 2024
1 parent a398065 commit 196dc77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/components/TimerPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
allowFontScaling = false,
amLabel = "am",
disableInfiniteScroll = false,
FlatList,
hideHours = false,
hideMinutes = false,
hideSeconds = false,
Expand Down
12 changes: 12 additions & 0 deletions src/tests/TimerPicker.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";

import { render } from "@testing-library/react-native";
import { FlatList } from "react-native";

import TimerPicker from "../components/TimerPicker";

Expand All @@ -26,4 +27,15 @@ describe("TimerPicker", () => {
expect(minutePicker).toBeNull();
expect(secondPicker).toBeNull();
});

it("uses the custom FlatList component when provided", () => {
const CustomFlatList = (props) => (
<FlatList {...props} testID="custom-flat-list" />
);
const { queryAllByTestId } = render(
<TimerPicker FlatList={CustomFlatList} />
);
const customFlatList = queryAllByTestId("custom-flat-list");
expect(customFlatList).toHaveLength(3);
});
});

0 comments on commit 196dc77

Please sign in to comment.