From 196dc77d3fa12ec050f4cc5ab3b4e628e809dbdc Mon Sep 17 00:00:00 2001 From: Giovanni Rodighiero Date: Sat, 29 Jun 2024 18:05:17 +0200 Subject: [PATCH] fix: remove FlatList from props enabling it to be passed down to TimerPicker --- src/components/TimerPicker/index.tsx | 1 - src/tests/TimerPicker.test.tsx | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/TimerPicker/index.tsx b/src/components/TimerPicker/index.tsx index 18bc47b..badf763 100644 --- a/src/components/TimerPicker/index.tsx +++ b/src/components/TimerPicker/index.tsx @@ -22,7 +22,6 @@ const TimerPicker = forwardRef( allowFontScaling = false, amLabel = "am", disableInfiniteScroll = false, - FlatList, hideHours = false, hideMinutes = false, hideSeconds = false, diff --git a/src/tests/TimerPicker.test.tsx b/src/tests/TimerPicker.test.tsx index b93e2c6..17af3ec 100644 --- a/src/tests/TimerPicker.test.tsx +++ b/src/tests/TimerPicker.test.tsx @@ -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"; @@ -26,4 +27,15 @@ describe("TimerPicker", () => { expect(minutePicker).toBeNull(); expect(secondPicker).toBeNull(); }); + + it("uses the custom FlatList component when provided", () => { + const CustomFlatList = (props) => ( + + ); + const { queryAllByTestId } = render( + + ); + const customFlatList = queryAllByTestId("custom-flat-list"); + expect(customFlatList).toHaveLength(3); + }); });