Skip to content

fix: 修复输出RN swiper在开启指示条时key重复警告 - #2298

Merged
mackwang112 merged 7 commits into
masterfrom
fix-swiper-key-warn
Nov 18, 2025
Merged

fix: 修复输出RN swiper在开启指示条时key重复警告#2298
mackwang112 merged 7 commits into
masterfrom
fix-swiper-key-warn

Conversation

@mackwang112

Copy link
Copy Markdown
Collaborator
const renderChildrens = showPagination ? [animateComponent, renderPagination()] : animateComponent

代码中 renderChildrens为数组时(即animateComponentrenderPagination())需要为数组中每个元素添加 key 属性,避免报错 Warning: Each child in a list should have a unique "key" prop.

@mackwang112 mackwang112 changed the title fix: 修复输出RN swiper在开启指示条时报错key重复 fix: 修复输出RN swiper在开启指示条时key重复警告 Nov 3, 2025
@mackwang112 mackwang112 added the platform:RN Mpx 跨端输出 RN label Nov 3, 2025
style: [normalStyle, layoutStyle, styles.swiper]
}, layoutProps, innerProps)
const animateComponent = createElement(Animated.View, {
key: 1,

@hiyuki hiyuki Nov 5, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key改为有含义的字符串,比如pagination和pageContainer

@mackwang112
mackwang112 merged commit ff8d973 into master Nov 18, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform:RN Mpx 跨端输出 RN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants