添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@chayancbnits swiper must reset him-self on next mount... But if you want to animated slide to initial index (1) before unmount event you can do it by ref. Something like this:

class SwiperWrapper extends React.Component {
  swiperRef;
  componentWillUnmount() {
    this.swiperRef && this.swiperRef.goTo(1);
  render() {
    return (
      <Swiper ref={swiperInstance => this.swiperRef = swiperInstance} from={1}>
      </Swiper>

See last chapter of README for details

In my case. All the components are in the same Stack Navigator. So the React Life Cycle Methods does not work for me in Swiper Wrapper Component.
I have make a Workaround by using the React Navigation Event "isFocused" , Something like this:

Is this a better approach?