-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Omit renderItem from TCarouselProps<T> causes mode prop to be incompatible. #592
Comments
The issue you're facing stems from a TypeScript type incompatibility related to the To resolve this, you can define a new type that includes type CustomCarouselMode = "parallax" | "horizontal-stack" | "vertical-stack";
type CustomCarouselProps = Omit<TCarouselProps<CarouselMedia>, 'renderItem' | 'mode'> & {
mode?: CustomCarouselMode;
showSteps?: boolean;
isFullScreen?: boolean;
quitButton?: {
onPress: () => void;
};
}; This approach omits both
|
Any infos on how should I fix this? |
To fix the TypeScript error you're encountering, you need to adjust your
type CustomCarouselMode = "parallax" | "horizontal-stack" | "vertical-stack";
type CustomCarouselProps = Omit<TCarouselProps<CarouselMedia>, 'renderItem' | 'mode'> & {
mode?: CustomCarouselMode;
showSteps?: boolean;
isFullScreen?: boolean;
quitButton?: {
onPress: () => void;
};
};
Ensure that the rest of your component implementation correctly passes the By following these steps, you should be able to resolve the TypeScript error and use the
|
Describe the bug
When omitting the renderItem prop from the Carousel it causes the mode prop to turn incompatible with the required props.
Here's a working example that should show the error.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It shouldn't give me a warning when omitting a prop from the props.
Screenshots
Versions (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: