인덱스 0을 클릭하면이 메서드가 작동하지 않습니다. 인덱스 0을 클릭하면 1과 2가 작동을 멈 춥니 다. 1 또는 2에서 2 번 클릭하면 슬라이더가 원하는 슬라이드로 이동합니다. 그러나 제로 인덱스는 전혀 작동하지 않습니다. 말해줘, 뭐가 문제 야?반응식 네이티브 스 와이프 메서드 scrollBy
<Swiper
onMomentumScrollEnd={(e, state, context) => this.setState({index:
state.index})}
ref={(swiper) => {this.swiper = swiper;}}
showsButtons={false}
width={500}
height={500}
showsPagination={false}
index={0}
loop={true} >
<View>
<Text>One</Text>
</View>
<View>
<Text>Two</Text>
</View>
<View>
<Text>Three</Text>
</View>
</Swiper>
<Text onPress={()=>{this.swiper.scrollBy(0, true)}}>One</Text>
<Text onPress={()=>{this.swiper.scrollBy(1, true)}}>Two</Text>
<Text onPress={()=>{this.swiper.scrollBy(2, true)}}>Three</Text>
'scrollBy' 스크롤됩니다. 이것이'scrollBy (0)'가 아무런 효과도없는 이유입니다. –
방법이 어떻게 배열되는지 설명해 주셔서 감사합니다. –