Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-snap-carousel",
"version": "4.0.0-beta.6",
"version": "4.0.0-beta.7",
"description": "Swiper/carousel component for React Native with previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down Expand Up @@ -68,7 +68,7 @@
"eslint-plugin-standard": "4.0.1",
"react": "16.13.1",
"react-native": "0.63.2",
"typescript": "3.9.7"
"typescript": "^5.8.3"
},
"eslintIgnore": [
"node_modules/",
Expand Down
48 changes: 26 additions & 22 deletions src/carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,19 @@ export class Carousel<TData> extends React.Component<
componentWillUnmount () {
this._mounted = false;
this.stopAutoplay();
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._initTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._apparitionTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._hackSlideAnimationTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._enableAutoplayTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._autoplayTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._snapNoMomentumTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._androidRepositioningTimeout);
}

Expand Down Expand Up @@ -822,7 +822,7 @@ export class Carousel<TData> extends React.Component<

this._scrollTo({ offset: offset + scrollDelta, animated: false });

// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._hackSlideAnimationTimeout);
this._hackSlideAnimationTimeout = setTimeout(() => {
this._scrollTo({ offset, animated: false });
Expand Down Expand Up @@ -970,7 +970,7 @@ export class Carousel<TData> extends React.Component<
// The touchEnd event is buggy on Android, so this will serve as a fallback whenever needed
// https://github.com/facebook/react-native/issues/9439
if (IS_ANDROID && this._autoplay && !this._autoplaying) {
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._enableAutoplayTimeout);
this._enableAutoplayTimeout = setTimeout(() => {
this.startAutoplay();
Expand Down Expand Up @@ -1058,7 +1058,7 @@ export class Carousel<TData> extends React.Component<
return;
}

// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._autoplayTimeout);
this._autoplayTimeout = setTimeout(() => {
this._autoplaying = true;
Expand All @@ -1072,11 +1072,11 @@ export class Carousel<TData> extends React.Component<

pauseAutoPlay () {
this._autoplaying = false;
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._autoplayTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearTimeout(this._enableAutoplayTimeout);
// @ts-expect-error setTimeout / clearTiemout is buggy :/
// @ts-ignore setTimeout / clearTiemout is buggy :/
clearInterval(this._autoplayInterval);
}

Expand Down Expand Up @@ -1146,19 +1146,23 @@ export class Carousel<TData> extends React.Component<
const mainDimension = this.props.vertical ?
{ height: this.props.itemHeight } :
{ width: this.props.itemWidth };
const specificProps = this._needsScrollView() ?
{
key: keyExtractor ?
keyExtractor(item, index) :
this._getKeyExtractor(item, index)
} :
{};

// const specificProps = this._needsScrollView() ?
// {
// key: keyExtractor ?
// keyExtractor(item, index) :
// this._getKeyExtractor(item, index)
// } :
// {};
const uniqueKey = this._needsScrollView()
?(keyExtractor
? keyExtractor(item, index)
: this._getKeyExtractor(item, index))
:undefined;
return (
<Component
style={[mainDimension, slideStyle, animatedStyle]}
pointerEvents='box-none'
{...specificProps}
key={uniqueKey}
>
{this.props.vertical ? this.props.renderItem({ item, index, dataIndex }, {
scrollPosition: this._scrollPos,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"importsNotUsedAsValues": "error",
// "importsNotUsedAsValues": "error",
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
Expand Down