Skip to content

Commit 0bed7e6

Browse files
authored
Merge pull request #74 from jarredt/remove_key_change_logic
Remove key change logic
2 parents b58759b + bbbb358 commit 0bed7e6

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,7 @@ export default () => (
108108
)
109109
```
110110

111-
This is possible because `Swiper` used `cloneElement` and inject internally the `activeIndex` and `index` props to each slide.
112-
113-
> `keys` are automatically set for each child of `Swiper` (when injecting props), if `activeIndex - index` is `0`, it will set the key to `-1`.
114-
> **This will cause the new active slide to rerender**
111+
This is possible because `Swiper` used `cloneElement` and inject internally the `activeIndex` and `index` props to each slide. This also means that all slides will re-render on swipe, since the `activeIndex` prop value changes on swipe.
115112

116113
---
117114

src/Swiper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class Swiper extends React.Component {
265265
slideWrapperStyle,
266266
])}
267267
>
268-
{cloneElement(el, { key: i - this.getActiveIndex() ? i : -1, activeIndex: this.getActiveIndex(), index: i })}
268+
{cloneElement(el, { activeIndex: this.getActiveIndex(), index: i })}
269269
</View>
270270
))}
271271
</Animated.View>

0 commit comments

Comments
 (0)