Skip to content

fix wheelpicker in android #2558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 1, 2023
Merged
Changes from 3 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
8 changes: 8 additions & 0 deletions src/components/WheelPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ const WheelPicker = ({
const prevIndex = useRef(currentIndex);
const [flatListWidth, setFlatListWidth] = useState(0);
const keyExtractor = useCallback((item: ItemProps, index: number) => `${item}.${index}`, []);
const androidFlatListProps = useMemo(() => {
if (Constants.isAndroid) {
return {
maxToRenderPerBatch: items.length
};
}
}, [items]);

useEffect(() => {
// This effect making sure to reset index if initialValue has changed
Expand Down Expand Up @@ -324,6 +331,7 @@ const WheelPicker = ({
<View flexG>
<AnimatedFlatList
{...flatListProps}
{...androidFlatListProps}
testID={`${testID}.list`}
listKey={`${testID}.flatList`}
height={height}
Expand Down