Skip to content

Commit ff8d973

Browse files
authored
Merge pull request #2298 from didi/fix-swiper-key-warn
fix: 修复输出RN swiper在开启指示条时key重复警告
2 parents f61f2a7 + 8e8bf48 commit ff8d973

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/webpack-plugin/lib/runtime/components/react/mpx-swiper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
322322
}
323323
}
324324
return (
325-
<View pointerEvents="none" style={paginationStyle}>
325+
<View pointerEvents="none" style={paginationStyle} key="pagination">
326326
<View style={[styles['pagerWrapper' + dir]]}>
327327
<Animated.View style={[
328328
dotCommonStyle,
@@ -888,6 +888,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
888888
style: [normalStyle, layoutStyle, styles.swiper]
889889
}, layoutProps, innerProps)
890890
const animateComponent = createElement(Animated.View, {
891+
key: 'swiperContainer',
891892
style: [{ flexDirection: dir === 'x' ? 'row' : 'column', width: '100%', height: '100%' }, animatedStyles]
892893
}, wrapChildren({
893894
children: arrPages

0 commit comments

Comments
 (0)