sag1v / react-elastic-carousel

A flexible and responsive carousel component for react https://sag1v.github.io/react-elastic-carousel
MIT License
348 stars 150 forks source link

Bug in importing {consts} in typescript #237

Closed Kartik-989 closed 1 year ago

Kartik-989 commented 2 years ago

Describe the bug

import {consts} from 'react-elastic-carousel'; This is not working in typescript files. I have file with .js then imoprt is working and in .tsx it gives error

Error is: Module '"react-elastic-carousel"' has no exported member 'consts'. Did you mean to use 'import consts from "react-elastic-carousel"' instead?

Sandbox link Please provide a link to a codesandbox with the reproduced bug

Screenshots If applicable, add screenshots to help explain your problem. https://codesandbox.io/s/awesome-stitch-760o29?file=/src/App.tsx

itseasy21 commented 2 years ago

I've forked a version of this and added TS/React 18 support: https://www.npmjs.com/package/@itseasy21/react-elastic-carousel

Hopefully, this helps :-)

MiroKopecky commented 2 years ago

@itseasy21 Hi, I installed your forked version 0.12.2 to my project and found a bug. When I want to swipe to the right, everything swipes to the left firstly and also otherwise. Could you please fix this ?:) Adding working sandbox with v0.12.2: https://codesandbox.io/s/react-elastic-carousel-forked-fcr8x0?file=/src/index.js&resolutionWidth=320&resolutionHeight=675

MiroKopecky commented 2 years ago

@itseasy21 Hi, I installed your forked version 0.12.2 to my project and found a bug. When I want to swipe to the right, everything swipes to the left firstly and also otherwise. Could you please fix this ?:) Adding working sandbox with v0.12.2: https://codesandbox.io/s/react-elastic-carousel-forked-fcr8x0?file=/src/index.js&resolutionWidth=320&resolutionHeight=675

itseasy21 commented 2 years ago

@MiroKopecky apologies missed the issue over here. Maybe try to set enableSwipe on breakpoint with width 1 and see if that fixes the issue?

const breakPoints = [
  { width: 1, itemsToShow: 1, enableSwipe: true },
  { width: 408, itemsToShow: 3, itemsToScroll: 0 }
];

Also, if you have another fix, happy to take a PR on https://github.com/itseasy21/react-elastic-carousel

MiroKopecky commented 2 years ago

@itseasy21 thanks for the answer but unfortunately that didnt help. What's odd is that is works on older versions just fine (in sandbox; in my project I receive different error (some react swipeable) so I thought it would be easier to fix this package). I havent figured it out myself neither:/

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.