diff --git a/package.json b/package.json index b19e1b857..cef1ac28f 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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/", diff --git a/src/carousel/Carousel.tsx b/src/carousel/Carousel.tsx index e9daf5b1f..9f094809d 100644 --- a/src/carousel/Carousel.tsx +++ b/src/carousel/Carousel.tsx @@ -261,19 +261,19 @@ export class Carousel 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); } @@ -822,7 +822,7 @@ export class Carousel 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 }); @@ -970,7 +970,7 @@ export class Carousel 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(); @@ -1058,7 +1058,7 @@ export class Carousel 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; @@ -1072,11 +1072,11 @@ export class Carousel 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); } @@ -1146,19 +1146,23 @@ export class Carousel 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 ( {this.props.vertical ? this.props.renderItem({ item, index, dataIndex }, { scrollPosition: this._scrollPos, diff --git a/tsconfig.json b/tsconfig.json index 02d160622..00f02b792 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "allowUnreachableCode": false, "allowUnusedLabels": false, "esModuleInterop": true, - "importsNotUsedAsValues": "error", + // "importsNotUsedAsValues": "error", "forceConsistentCasingInFileNames": true, "jsx": "react", "lib": ["esnext"],