@imagine10255/react-carousel
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -516,2 +516,15 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) { | ||
var oldKey = prevProps.data.map(function (row) { | ||
return row.key; | ||
}).join('_'); | ||
var nextKey = this.props.data.map(function (row) { | ||
return row.key; | ||
}).join('_'); | ||
if (oldKey != nextKey) { | ||
this.goToActualIndex(this.info.actual.firstIndex, false); | ||
} | ||
}; | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { | ||
@@ -544,9 +557,3 @@ var nextWindowSize = nextState.windowSize; | ||
}).join('_'); | ||
var isDiffKey = oldKey !== nextKey; | ||
if (isDiffKey) { | ||
this.goToActualIndex(this.info.actual.firstIndex, false); | ||
} | ||
return isDiffKey; | ||
return oldKey !== nextKey; | ||
}; | ||
@@ -553,0 +560,0 @@ |
@@ -514,2 +514,15 @@ import { createElement, createRef, Component } from 'react'; | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) { | ||
var oldKey = prevProps.data.map(function (row) { | ||
return row.key; | ||
}).join('_'); | ||
var nextKey = this.props.data.map(function (row) { | ||
return row.key; | ||
}).join('_'); | ||
if (oldKey != nextKey) { | ||
this.goToActualIndex(this.info.actual.firstIndex, false); | ||
} | ||
}; | ||
_proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) { | ||
@@ -542,9 +555,3 @@ var nextWindowSize = nextState.windowSize; | ||
}).join('_'); | ||
var isDiffKey = oldKey !== nextKey; | ||
if (isDiffKey) { | ||
this.goToActualIndex(this.info.actual.firstIndex, false); | ||
} | ||
return isDiffKey; | ||
return oldKey !== nextKey; | ||
}; | ||
@@ -551,0 +558,0 @@ |
@@ -39,2 +39,3 @@ import * as React from 'react'; | ||
componentWillUnmount(): void; | ||
componentDidUpdate(prevProps: Readonly<IProps>, prevState: Readonly<IState>, snapshot?: any): void; | ||
/*** | ||
@@ -41,0 +42,0 @@ * 優化渲染 |
@@ -33,6 +33,2 @@ import { ReactNode } from 'react'; | ||
} | ||
export interface IElement { | ||
children: React.ReactNode; | ||
key: String; | ||
} | ||
export interface IInfo { | ||
@@ -65,3 +61,3 @@ formatElement: Array<{ | ||
export interface IData { | ||
key: string; | ||
key: string | number; | ||
paginationContent?: ReactNode; | ||
@@ -68,0 +64,0 @@ children: ReactNode; |
{ | ||
"name": "@imagine10255/react-carousel", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Most modern mobile touch slider with hardware accelerated transitions by react", | ||
@@ -5,0 +5,0 @@ "author": "imagine10255", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
223741
2692