Skip to content

Commit

Permalink
fix(loadMinimal): prevent flick when loop and loadMinimal are enabled
Browse files Browse the repository at this point in the history
fix #1062
  • Loading branch information
ArrayZoneYour committed Sep 29, 2019
1 parent 3a119c8 commit 67822de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/index.js
Expand Up @@ -9,9 +9,9 @@ import Basic from './components/Basic'; // Only update index when scrollEnd
import DisableButton from './components/DisableButton';
import Loop from './components/Loop';
import Dynamic from './components/Dynamic/';
import LoadMinimal from './components/LoadMinimal/'; // flicker existing when shift from last to first (or last to first)
import LoadMinimal from './components/LoadMinimal/';
import Phone from './components/Phone/';
// import PhotoView from './components/PhotoView/'; // not working
import Swiper from './components/Swiper/'; // working but no title displayed, direction vertical not work well on android
import SwiperNumber from './components/SwiperNumber/'; // working but no title displayed
AppRegistry.registerComponent(appName, () => DisableButton);
AppRegistry.registerComponent(appName, () => LoadMinimal);
8 changes: 6 additions & 2 deletions src/index.js
Expand Up @@ -832,8 +832,12 @@ export default class extends Component {
pages = pages.map((page, i) => {
if (loadMinimal) {
if (
i >= index + loopVal - loadMinimalSize &&
i <= index + loopVal + loadMinimalSize
(i >= index + loopVal - loadMinimalSize &&
i <= index + loopVal + loadMinimalSize) ||
// The real first swiper should be keep
i === loopVal ||
// The real last swiper should be keep
i === total - 1 + loopVal
) {
return (
<View style={pageStyle} key={i}>
Expand Down

0 comments on commit 67822de

Please sign in to comment.