SwipeableViewsProps is not allowed spread parameter(3 dot operation)
Opened this issue · 2 comments
- I have searched the issues of this repository and believe that this is not a duplicate.
hello, i use react-swipeable-views with typescript
and i`ll try to pass object using spread(3dot operation), like below
import SwipeableViews, { SwipeableViewsProps } from 'react-swipeable-views';
const test = React.FC = () => {
const propsSlide: SwipeableViewsProps = {
...
}
return (
<>
<SwipeableViews {...propsSlide}>
<SwipeableViews/>
</>
)
}
the problem is SwipeableViews
only accept attribute IntrinsicClassAttributes<SwipeableViews>
beside, props object is SwipeableViewsProps
in react-swipeable-views
.
and in this case, where can i use SwipeableViewsProps
object and
how do i pass to object as property with 3 dot operation.?
thank you
Your Environment
Tech | Version |
---|---|
@types/react-swipeable-views | ^0.13.0 |
react-swipeable-views | ^0.13.3 |
React | ^16.12.0 |
platform | Window |
etc |
Hi,
Well noticed, i will try and test this next week, if you want you can create a PR which addresses this issue i will than check and merge the PR within a day.
any update on this issue?. I had the same issue as well.
It is not nice solution but I have a workaround like this.
import SwipeableViews, { SwipeableViewsProps } from 'react-swipeable-views';
type MySwipeableViewsProps = SwipeableViewsProps;
const MySwipeableViews = ({ ...rest }: MySwipeableViewsProps) => {
return (
<SwipeableViews
containerStyle={{
transition: 'transform 0.35s cubic-bezier(0.15, 0.3, 0.25, 1) 0s',
}}
{...(rest as any)}
/>
);
};
export default MySwipeableViews;
Edit: Since I want to apply initial rendering in every SwipeableViews, I was adding this containerStyle and creating my custom value. Ref: #599 (comment)